lwip hanging on memory allocation (sem)

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

lwip hanging on memory allocation (sem)

DownyTif
Hi,

I would like to know if someone ever came into this problem...
I have a little application developped on the Atmel EVK1100 product, using the FreeRTOS and lwip with the sequential API.

My application is running fine when I'm using the clocks at 48MHz (CPU, HSB, PBB, while PBA is 12MHz). When I change the clocks to 66MHz (CPU, HSB, PBB, while PBA is 33MHz), the lwip configuration hangs on a semaphore here:

\lwip-1.2.0\src\core\mem.c LINE 274.
sys_sem_wait(mem_sem);

The stack looks like this:
10 _handle_Data_Address_Read()  0x80018a34

9 xQueueGenericReceive() C:\Projets\AVR Workspace\EthernetBenchTest\SOFTWARE_FRAMEWORK\SERVICES\FREERTOS\Source\queue.c:843 0x8000d9b4
       
8 sys_arch_sem_wait() C:\Projets\AVR Workspace\EthernetBenchTest\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-port\AT32UC3A\sys_arch.c:247 0x8000048c
       
7 sys_sem_wait() C:\Projets\AVR Workspace\EthernetBenchTest\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.2.0\src\core\sys.c:119 0x8000798a
       
6 mem_malloc() C:\Projets\AVR Workspace\EthernetBenchTest\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.2.0\src\core\mem.c:274 0x80009162
       
5 ethernetif_init() C:\Projets\AVR Workspace\EthernetBenchTest\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-port\AT32UC3A\ethernetif.c:358 0x80000b2e
       
4 netif_add() C:\Projets\AVR Workspace\EthernetBenchTest\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.2.0\src\core\netif.c:92 0x800086ee
       
3 EthernetConfigInterface() C:\Projets\AVR Workspace\EthernetBenchTest\Ethernet.c:283 0x80010732
       
2 tcpip_thread() C:\Projets\AVR Workspace\EthernetBenchTest\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.2.0\src\api\tcpip.c:115 0x8000ad00
       
1 <symbol is not available> 0xdeadbeef

So, to resume, the tcpip_init() call creates a thread which calls my function for ethernet configuration, which calls "netif_add(...)" ---> "init(netif)" ---> ethernetif = (struct ethernetif *)mem_malloc(sizeof(struct ethernetif)); ---> the mem_alloc semaphore.


I'm kind of confused, because everything works fine at 48MHz and the board is supposed to support up to 66MHz. I've seen posts of people using the same board at 66MHz, so it's probably not related to lwip, but I'm taking a chance.

Any hints will be welcome!

Thanks,
Downy
Reply | Threaded
Open this post in threaded view
|

Re: lwip hanging on memory allocation (sem)

Jonathan Larmour
DownyTif wrote:

>
> So, to resume, the tcpip_init() call creates a thread which calls my
> function for ethernet configuration, which calls "netif_add(...)" --->
> "init(netif)" ---> ethernetif = (struct ethernetif
> *)mem_malloc(sizeof(struct ethernetif)); ---> the mem_alloc semaphore.
> [which waits forever]
>
> I'm kind of confused, because everything works fine at 48MHz and the board
> is supposed to support up to 66MHz. I've seen posts of people using the same
> board at 66MHz, so it's probably not related to lwip, but I'm taking a
> chance.

I suspect the faster CPU means changing your memory controller timings,
and something's not right there.

Alternatively, the faster code execution may have resulted in some other
thread in your system trying to do lwIP things before lwIP is fully
initialised, which maybe (theoretically - it just depends) might cause
problems.

Jifl
--
eCosCentric Limited      http://www.eCosCentric.com/     The eCos experts
Barnwell House, Barnwell Drive, Cambridge, UK.       Tel: +44 1223 245571
Registered in England and Wales: Reg No 4422071.
------["The best things in life aren't things."]------      Opinions==mine


_______________________________________________
lwip-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-users