cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H7 with W5500 SPI DMA not working

jain2051
Associate

My project requires me to make W5500 driver for ethernet. Everything works fine when using non-DMA. But as need to large data continuously, non-DMA is not ideal and need speed thus plan to use SPI DMA with W5500. In past, I had made successfully run W5500 with DMA using F4 series. I am trying hard from one month but still not able to successfully run SPI DMA with W5500, I tried dcache invalidation and cleaning, also, tried mpu set up and assigning rx and tx to non-cacheable memories. But all failed. 

Please, if anyone can help and can give demo code for W5500 dma with H7 series or help me set up MPU or help me set up cache maintenance in correct way. Note: I read many solutions and implemented them, nothing working.

 

2 REPLIES 2
KDJEM.1
ST Employee

Hello @jain2051 and welcome to the Community 🙂,

I advise you to take a look to these FAQs, may help you to solve the issue:

DMA is not working on STM32H7 devices, or the transmitted/received data are corrupted. Polling and interrupt based methods for the same peripheral configuration are working.

The Ethernet peripheral on STM32H7x3 is not sending, or receiving data correctly. Or, the IP stack is not able to establish connection to other devices.

I hope this help you.

Thank you.

Kaouthar

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Thank you for swift reply. I have read these FAQs and many more. Tried all suggested solutions with my understanding but still not completely resolved my problem. I am able to ping and establish connection and even able to send small data successfully but whenever sending larger data, then received data is corrupted. To demonstrate, I am attaching a loopback code which can be testing using hercules utility as client. if we comment out #use DMA then it will work in non DMA mode and then it works perfectly, even with max buffer size. But if use DMA then it will work ok if data size is 130-140 bytes, but if send anything bigger, it starts sending garbage data or continuous data and then connection disconnects. 

Secondly, I tried using  SCB_CleanDCache_by_Addr after transmit but it doesnt works to successfully establish connection and only when using SCB_CleanDCache() connection is able to establish. I want to avoid using full dcache clean. IF possible and if correct MPU settings can be suggested, then want to minimum use any dcache maintenance.

If possible, please suggest what changes should I make in this loopback code so that W5500 in SPI-DMA mode works perfectly and thus able to send max size of data similar to NON DMA SPI.