Hi guys,
I am facing this problem for a long time and different versions of Keil.
When net_eth.o is in off-chip RW_RAM1 (beginning at 0x60000000) networking does not work properly. (STM32F4xx, Network Component 7.12) Simplified Problem:
Thread 1:
netInitialize(); osThreadNew(ts_net_thread); socket(); ioctlsocket(set non-blocking); connect(); set socket connecting while(1){ osEventFlagsWait(.....); if( received ){ PrintData(); } }
Thread 2 - ts_net_thread:
while(1){ osEventFlagsWait(any, 1500ms); if(socket is connecting){ int ret = connect(sckId, .... ); if( ret == BSD_ISCONN) socket = connected; } if(socket is connected){ int ret = recv(scktId, .... ); if( ret < 0) print("0x%X"); else osEventFlagsSet(datarecvd) } }
When the code is compiled and eth is in RW_IRAM1 recv does not return BSD_ELOCKED but when eth is in RW_RAM1 problem appear and recv() returns BSD_LOCKED.
Earlier I find that there should be a problem with ETH driver and DMA. Does anybody have a hint to this problem?
What external RAM do you use static or dynamic RAM?
Have you checked the timing settings for external RAM? Are you sure the time settings are correct?
Can you check which thread is stuck when you receive BSD_ELOCKED? Use RTX Viewer for this (Debug -> View -> Watch Windows -> RTX RTOS) I see no reason for this error code.
net_eth.o has no interaction with Ethernet DMA. So it should not matter where the RAM variables are. Only the EMAC_STM32F4xx.c driver uses dedicated Ethernet DMA. Try to set only driver variables to RW_IRAM1 and everything else to external RAM.
Unfortunately I don't have enough information for a more detailed answer. Can you capture a debug log using EventRecorder, or a serial output using ITM?
Hi, I am realy sorry. It was my fault. I cant beleive I did it. NULL pointer access to really big class and it overwrites variables in net lib. But I found the solution thanks to you! In RTX RTOS view I wanted to tell you that all mutexes all unlocked and that time I realized that they should not be all unlocked! But this behaviour is similar to problem I had a long time ago. Thank you for your time!