Im using stm32f207 HAL library, LwIP stack with RAW api, no RTOS for an UDP server implementation.
Server is receiving frames by polling way because of client nature demands. Client is constantly asking server for reading mcu inputs and asking for writing mcu outputs. Data payload per request from client to the server and data payload per answer from the server to the client are less than 20 bytes. Minimum one could be 2 bytes.
According some statistics his communication reaches 900Kb/sec but Ethernet is configured for 100Mb/sec. It seems to be a great margin and not seems to be too much stressed. Digital IO reads/writes probably are the most speedy hw operations in therms of CPU processing.
- Server could be working and attending 1, 2, 3 even 4 python clients during 12 hours even bit more and sometimes only for 1 hour.
- Suddenly client stops receiving answers from server.
- using breakpoints we can see that server has no more reception requests
- HAL_ETH_GetReceivedFrame (&heth) call is not returning HAL_OK so I go inside this function and I see:
- after heth --> state = busy
- heth->RxDesc->Status == 1
- where this means that descriptor status register has OWN bit = 1 and DMA is not passing the descriptor to the MAC controller in order to put received frame from RMII line towards DMA block.
- After this observation we check for error flags on this statuts register and we don't see any error.
- After this another observation, we enabled irq and we added the irq handler to our code with the hope of detecting ethernet error interruptions, but execution thread sitlls not jumping there. So no error is detected when DMA is rapturing the Ethernet fram descriptor.
The questions now are:
- what kind of situation is making that DMA is not freeing this descriptor and passing it to the MAC controller if no error is detected?
- Despite of the rest ot the mcu functionalities are working and the application is running, the only way for recovering the network from this situation is manually reseting the application. We have no error detection for forcing an only ethernet reseting or re-init. Even I'm not sure that deinit and init works.