lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] lwIP hangs after some data transferred


From: Grzegorz Niemirowski
Subject: Re: [lwip-users] lwIP hangs after some data transferred
Date: Tue, 2 Sep 2014 19:34:13 +0200

Thanks Noam. I have interrupt priorities set exactly as you have written. The problem must be somewhere else.

Best regards,
Grzegorz Niemirowski

Noam weissman <address@hidden> napisał(a):
Hi,
You must check interrupt priorities and your FreeRTOSConfig definition
file
Here is my interrupt settings from the FreeRTOSConfig .h file:
------------------------------------------------------------------------
----------------------------------------------------
/* Cortex-M specific definitions. */
#ifdef __NVIC_PRIO_BITS
/* __BVIC_PRIO_BITS will be specified when CMSIS is being used.
*/
#define configPRIO_BITS       __NVIC_PRIO_BITS
#else
#define configPRIO_BITS       4        /* 15 priority
levels */
#endif
/* The lowest interrupt priority that can be used in a call to a "set
priority"
function. */
#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 0xF
/* The highest interrupt priority that can be used by any interrupt
service
routine that makes calls to interrupt safe FreeRTOS API functions.  DO
NOT CALL
INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A
HIGHER
PRIORITY THAN THIS! (higher priorities are lower numeric values. */
#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 5
/* Interrupt priorities used by the kernel port layer itself.  These are
generic
to all Cortex-M ports, and do not rely on any particular library
functions. */
#define configKERNEL_INTERRUPT_PRIORITY (
configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
/* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero
!!!!
See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
#define configMAX_SYSCALL_INTERRUPT_PRIORITY (
configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
#define ETH_ISR_PRIO           10
#define SERIAL_ISR_PRIO        6
------------------------------------------------------------------------
----------------------------------------------------
As you can see in the above file
configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY  is 5 as ETH_ISR_PRIO is 10
Set your ETH interrupt as follows:
 NVIC_PriorityGroupConfig(NVIC_PriorityGroup_4);
 /* Configures and enable the Ethernet global interrupt. */
 NVIC_InitStructure.NVIC_IRQChannel = ETH_IRQn;
 NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = ETH_ISR_PRIO;
 NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
 NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
 NVIC_Init(&NVIC_InitStructure);
FreeRTOS function uses critical section protection that actually blocks
interrupts
Any ISR code that uses FreeRTOS functions MUST have a lower interrupt
priority. If you do not follow this
The critical section protection will not work and therefore you get
unpredictable or un stable system.
I also suggest reading the FreeRTOS section on interrupts:
   http://www.freertos.org/a00110.html
   http://www.freertos.org/RTOS-Cortex-M3-M4.html
Hope that helped,
Noam.
-----Original Message-----
From: address@hidden
[mailto:address@hidden On Behalf Of
Grzegorz Niemirowski
Sent: Tuesday, September 02, 2014 12:09 AM
To: address@hidden
Subject: [lwip-users] lwIP hangs after some data transferred
Hello,
I write code for SMT32 board using FreeRTOS and lwIP 1.4.1. I use
sockets.
There is a simple TCP server: it accepts incoming connection, reads 100
bytes sent from PC, sends 100 byte reply, closes connection and waits
for another connection. I observed that after some time lwIP stops
ACKing packets fast enough and eventually it hangs. It no longer
responds to SYN or ICMP ping. Here are two examples of such
communication. Both files contain whole communication between PC and my
device after device reset. For testing purposes there were four
applications running at the same time so the problem could be observed
withing shorter time.
http://www.grzegorz.net/test1a.pcapng
http://www.grzegorz.net/test2a.pcapng
Is it a problem with lwIP, low level IF driver or FreeRTOS?
Best regards,
Grzegorz Niemirowski




reply via email to

[Prev in Thread] Current Thread [Next in Thread]