реклама на сайте
подробности

 
 
> STM32F207+FreeRTOS+LwIP замирает задача ethernetif_input
V_M_Luck
сообщение Oct 16 2012, 14:03
Сообщение #1


Участник
*

Группа: Участник
Сообщений: 55
Регистрация: 26-11-05
Пользователь №: 11 420



Продолжаю разбираться с FreeRTOS+LwIP. Камень STM32F207, физика KSZ8041.
Делаю простой UDP сервер, netconn, на основе примера ST.

Симптом следующий.
Посылаю с ПК запросы, устройство отвечает. Примерно через полчаса такой работы ответы приходить перестают. Просмотр состояния задач, очередей показал, что задача ethernetif_input висит в состоянии READY, но sheduler ее не запускает. Cемафор s_xSemaphore заполняется полностью. При этом другие задачи с меньшим приоритетом (мигание лампочки) выполняться продолжают.

Прочитал топик, внес изменения в ethernetif.c, это ни к чему не привело.
CODE
static void ethernet_watchdog(void) {
/* When Rx Buffer unavailable flag is set: clear it and resume reception */
if ((ETH->DMASR & ETH_DMASR_RBUS) != (u32)RESET)
{
/* Clear RBUS ETHERNET DMA flag */
ETH->DMASR = ETH_DMASR_RBUS;

/* Resume DMA reception. The register doesn't care what you write to it. */
ETH->DMARPDR = 0;
}
}

unsigned int thread_cnt = 0;
void ethernetif_input( void * pvParameters )
{
struct pbuf *p;

for( ;; )
{
if (xSemaphoreTake( s_xSemaphore, emacBLOCK_TIME_WAITING_FOR_INPUT)==pdTRUE)
{
while ((p = low_level_input( s_pxNetIf )) != 0)
// p = low_level_input( s_pxNetIf );
{
thread_cnt++;
if (p != 0) {
if (ERR_OK != s_pxNetIf->input( p, s_pxNetIf))
{
pbuf_free(p);
p=NULL;
}
}
}
}
ethernet_watchdog();
}
}


Настройки FreeRTOS:
CODE
#define configUSE_PREEMPTION 1
#define configUSE_IDLE_HOOK 0
#define configUSE_TICK_HOOK 0
#define configCPU_CLOCK_HZ ( ( unsigned long ) 120000000 )
#define configTICK_RATE_HZ ( ( portTickType ) 1000 )
#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 7 )
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 128 )
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 15 * 1024 ) )
#define configMAX_TASK_NAME_LEN ( 16 )
#define configUSE_TRACE_FACILITY 0
#define configUSE_16_BIT_TICKS 0
#define configIDLE_SHOULD_YIELD 1
#define configUSE_MUTEXES 1
#define configUSE_COUNTING_SEMAPHORES 1
#define configUSE_MALLOC_FAILED_HOOK 0

//For queue trace
#define configQUEUE_REGISTRY_SIZE 5

#define configCHECK_FOR_STACK_OVERFLOW 0

/* Co-routine definitions. */
#define configUSE_CO_ROUTINES 0
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )

/* Set the following definitions to 1 to include the API function, or zero
to exclude the API function. */

#define INCLUDE_vTaskPrioritySet 0
#define INCLUDE_uxTaskPriorityGet 0
#define INCLUDE_vTaskDelete 0
#define INCLUDE_vTaskCleanUpResources 0
#define INCLUDE_vTaskSuspend 0
#define INCLUDE_vTaskDelayUntil 0
#define INCLUDE_vTaskDelay 1

/* This is the raw value as per the Cortex-M3 NVIC. Values can be 255
(lowest) to 0 (1?) (highest). */
#define configKERNEL_INTERRUPT_PRIORITY 255
#define configMAX_SYSCALL_INTERRUPT_PRIORITY 191 /* equivalent to 0xb0, or priority 11. */


/* This is the value being used as per the ST library which permits 16
priority values, 0 to 15. This must correspond to the
configKERNEL_INTERRUPT_PRIORITY setting. Here 15 corresponds to the lowest
NVIC value of 255. */
#define configLIBRARY_KERNEL_INTERRUPT_PRIORITY 15


Настройки LwIP:
CODE
#define SYS_LIGHTWEIGHT_PROT 1

#define ETHARP_TRUST_IP_MAC 0
#define IP_REASSEMBLY 0
#define IP_FRAG 0
#define ARP_QUEUEING 0

#define LWIP_TCPIP_CORE_LOCKING 0

#define NO_SYS 0

#define MEM_ALIGNMENT 4

#define MEM_SIZE (20*1024)

#define MEMP_NUM_PBUF 200
#define MEMP_NUM_UDP_PCB 6
#define MEMP_NUM_TCP_PCB 10
#define MEMP_NUM_TCP_PCB_LISTEN 5
#define MEMP_NUM_TCP_SEG 20
#define MEMP_NUM_SYS_TIMEOUT 10

#define PBUF_POOL_SIZE 20

#define PBUF_POOL_BUFSIZE 500

#define LWIP_TCP 0
#define TCP_TTL 255

#define LWIP_ICMP 1

#define LWIP_DHCP 0

#define LWIP_UDP 1
#define UDP_TTL 255

/* ---------- Statistics options ---------- */
#define LWIP_STATS 1
#define ETHARP_STATS 1
#define UDP_STATS 1
#define LWIP_PROVIDE_ERRNO 1
#define MEM_STATS 1


#define CHECKSUM_BY_HARDWARE

#define LWIP_NETCONN 1

#define LWIP_SOCKET 0

#define LWIP_DEBUG 0

#define TCPIP_THREAD_STACKSIZE 1000
#define TCPIP_MBOX_SIZE 50
#define DEFAULT_UDP_RECVMBOX_SIZE 2
#define DEFAULT_TCP_RECVMBOX_SIZE 20
#define DEFAULT_ACCEPTMBOX_SIZE 20
#define DEFAULT_THREAD_STACKSIZE 500
#define TCPIP_THREAD_PRIO (configMAX_PRIORITIES - 2)



Go to the top of the page
 
+Quote Post



Reply to this topicStart new topic
1 чел. читают эту тему (гостей: 1, скрытых пользователей: 0)
Пользователей: 0

 


RSS Текстовая версия Сейчас: 18th July 2025 - 07:54
Рейтинг@Mail.ru


Страница сгенерированна за 0.01366 секунд с 7
ELECTRONIX ©2004-2016