2025-03-17 6:19 AM
Hello,
I am attempting to send data from an STM32G474RE (Client) to a laptop (Server) over TCP using the W5500 module. However, I am encountering an issue where the data transmission works properly only up to an SPI baud rate of 18 MHz. When I attempt to increase the SPI baud rate beyond 18 MHz, the transmission fails, and no data is sent to the server.
I have also tried using DMA mode for SPI, but there was no improvement in the situation.
According to the W5500 datasheet, the recommended practical SPI baud rate is 33.3 MHz. Despite this, I am unable to send data reliably at higher speeds.
Can Anyone suggest a solution to resolve this issue and allow for successful data transmission at SPI speeds above 18 MHz?
2025-03-17 10:33 AM
Apologies for the previous confusion. Here's a clearer description of my setup:
IMU(On-CAN) -> STM32(Client)-> (SPI) W5500 module (Ethernet) -> Laptop(Server) (Deserialize the IMU Data).
The data flow in the system follows this path: The IMU sensor sends data via the CAN bus to the STM32 microcontroller, which acts as the client in this setup. The STM32 then communicates with the W5500 Ethernet module over SPI to transmit the IMU data. The W5500 module handles the Ethernet communication, sending the data to a laptop, which serves as the server. The laptop then deserializes the IMU data for further processing or analysis. This setup allows the STM32 to capture sensor data and send it over a network to the laptop for real-time monitoring and interpretation.
The system works correctly with an SPI baud rate up to 18 MHz (equivalent to(72 MHz-Clock/4 prescaler) 18 Mbps in STM32). However, if I increase the SPI baud rate beyond 18 MHz, data transmission from the STM32 to the laptop stops. I am aiming for higher throughput and lower latency, so I want toto achieve this by increasing the SPI speed in STM32.
2025-03-17 11:33 AM
@Kirtan wrote:if I increase the SPI baud rate beyond 18 MHz, data transmission from the STM32 to the laptop stops.
So you need to determine if that's because:
You still haven't given details of the connection between STM32 and WS5500
2025-03-17 1:32 PM
> Apologies for not mentioning earlier that I am using the Nucleo STM32G474RE, rather than a custom board.
Jumper wires between the nucleo and a breakout board are unlikely to support 18 MHz reliably, let alone higher.
2025-03-17 2:20 PM
It sounds like you're encountering an SPI communication issue between the W5500 and STM32G474RE. First, ensure that the SPI clock speed is within the W5500's supported range (typically up to 80 MHz). Double-check the SPI mode (CPOL and CPHA) to match the W5500's requirements (usually Mode 0 or 3). Also, verify that the chip select (CS) pin is properly toggling and that the wiring is correct. If the issue persists, try reducing the SPI clock speed and using a logic analyzer to inspect the SPI signals for timing or data errors. Let us know if you need further assistance!
2025-03-17 2:21 PM
SPI issues with the W5500 and STM32G474RE can often be traced to configuration mismatches or hardware problems. Make sure the SPI peripheral is correctly initialized in your STM32 firmware, and confirm that the W5500 is powered properly. Additionally, check the W5500's reset and interrupt pins to ensure they're functioning as expected. If you're using a library or HAL, ensure it's compatible with the STM32G4 series. Debugging with a logic analyzer or oscilloscope can help identify signal integrity issues. If you share more details about your setup, we can provide more targeted suggestions!