2020-06-08 09:26 AM
2020-06-08 09:32 AM
You'll perhaps need to search more broadly, rather than board specific.
Find examples using this on other STM32 Platforms, or find examples using the SPI connectivity and port those.
2020-06-09 01:22 AM
I searched as you said to me and I Finded this tutorial for STM32F4 https://www.youtube.com/watch?v=9Wac0tJUMsE&t=297s&app=desktop and I'm getting 0xFF in the spiData buffer. I can't solve this problem. I don't know how to solve it.
2020-06-09 04:43 AM
The ENC28J60 is an older ethernet MAC/PHY and has some issues when used with an STM32. Microchip has a newer ENC424J600 10/100 ethernet controller with a much better SPI interface. I used both many years ago. The older ENC28J60 is not easy to use and I would not recommend going forward with it since there is a far better alternative.
One issue is read/write clock edge for the SPI clock. Writes to the ENC28J60 are on the rising edge, but read are clocked on the falling edge. You need to reconfigure the SPI clock polarity depending on transfer direction. STM32 SPI ports only read/write on the same edge. Check the timing diagrams on the ENC28J60 to see how data is read and written. If you use the wrong edge you get invalid data, as you see with 0xFF.
Also, make sure the chip select remains on past the last bit clocked in/out. The SPI port has a flag to inform when shifting is complete. Otherwise data is lost.
Jack Peacock
2020-06-09 07:52 AM
Thank you for your explanation, So you mean if I use another module will be better than trying to solve problems and probably it will take time to solve.