This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Network Component recv() locked when Net4_CM3_L.lib(net_eth.o) compiled to off-chip RAM

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?

Parents
  • 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?

Reply
  • 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?

Children