cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H563ZIT6 cannot receive RS485 at high baud rates (e.g. 12 Mbaud)

MES98
Associate III

TX works but RX interrupt not triggered

 

Hello,

I am currently using a custom board based on STM32H563ZIT6. My goal is to establish communication over RS485 between the STM32 and a PC (using Hterm). The system is designed to receive a command and send a response.


Communication Details:

  • Interface: RS485 (half-duplex)
  • PC Tool: Hterm
  • Converter: USB COM 485 PLUS 4
  • Packet size: Very small (typically 4 bytes)
  • Transmission interval: ≥ 300 ms

Current Situation:

  • Communication works perfectly between 115200 and 2,000,000 baud
  • I am trying to increase the baud rate up to 12 Mbaud

Problem:

At 12 Mbaud:

  • STM32 → PC communication works correctly
    (I can see transmitted data on Hterm)
  • PC → STM32 communication does NOT work
    • STM32 does not receive any data
    • RX interrupt is not triggered at all
    • It behaves as if no data is arriving

Additional Notes:

  • I have checked the termination resistor, and it seems correct
  • The data sent from PC is valid (verified from Hterm)
  • UART baud rate is configured up to 12.5 Mbaud in CubeMX
  • The issue only appears at very high baud rates

What I Suspect:

  • Possible limitation of RS485 converter at high baud rates
  • UART sampling/timing issues at 12 Mbaud
  • Interrupt-based reception may not be sufficient at such speeds
  • Hardware limitations (signal integrity, cable, etc.)

Questions:

  1. Is it realistic to achieve 12 Mbaud over RS485 in this setup?
  2. Could this be a limitation of the USB-RS485 converter?
  3. Are there any specific STM32 UART settings required for such high speeds?
  4. Should DMA be used instead of interrupt for reliable reception?
  5. Are there known limitations for STM32H5 series UART at these speeds?

Any insights or similar experiences would be very helpful.

Thanks in advance!

1 ACCEPTED SOLUTION

Accepted Solutions
MES98
Associate III

Thank you all for your support and valuable suggestions.

I would like to briefly summarize the issue and the solution, in case it helps others in the future.

Initially, when using interrupt-based reception, I was able to reach up to around 4 Mbaud reliably.
After switching to DMA, I was able to increase this up to 8 Mbaud.

However, I could never reach the 10 Mbaud value stated in the datasheet — at that speed, I was neither able to receive nor transmit data reliably.

While going through the datasheets more carefully, I noticed that the UART clock is 24 MHz, and in simple terms, the achievable baud rates follow a relation like 24 / n (Mbaud).

Based on this, I tested different baud rates again:

  • My device still cannot reliably communicate at 10 Mbaud
  • But interestingly, it works perfectly at 12 Mbaud

So it seems that certain baud rates are more “naturally aligned” with the clock configuration, while others are not achievable due to divider limitations.


Thanks again to everyone for the help.
Have a great day!

View solution in original post

41 REPLIES 41
mƎALLEm
ST Employee

Hello @MES98 and welcome to the ST community,

You said the Rx interrupt is not triggering at all at 12 Mbaud but it does at lower baud rates.

Are you sure there is no interrupt triggered at all? did you set a breakpoint in the Rx interrupt callback?

Try also to use DMA for the reception.

 


@MES98 wrote:
  1. Could this be a limitation of the USB-RS485 converter?

It could be.

What about the RS485 transceiver you are using from STM32 side? does it support a communication up to 12MBaud?

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.

I put a breakpoint in the UART Rx callback, and no interrupt is triggered at all.

Also, I discovered something interesting: when I connect two RS485 lines directly to each other, the STM32 is able to send and receive data at 12 Mbaud without any issues.

Based on this, I suspect that the problem is related to Windows, Hterm, or the USB COM485 PLUS 4 converter, rather than the STM32 or my code.


@MES98 wrote:

Based on this, I suspect that the problem is related to Windows, Hterm, or the USB COM485 PLUS 4 converter, rather than the STM32 or my code.


Indeed! 

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.

Just to give another update

When I connect the two RS485 lines together on the USB COM485 PLUS4, communication still works at 12 Mbaud.

So in this scenario, everything works fine, which makes me think that Windows, Hterm, or the converter may not be the problem after all.

Honestly, this is really confusing me.

Ozone
Principal III

I put a breakpoint in the UART Rx callback, and no interrupt is triggered at all..

This is just a callback for a specific flag.
Enable the UART error interrupts, and see if one of those gets triggered.

And in my experience, 12MBits is quite a bit beyond the capabilities of most Windows-PC / USB-adapter combinations. But you can experiment with the extended settings for your specific adapter in the Windows device manager, like packet sizes and poll rates.

Andrew Neil
Super User

@MES98 wrote:
  • Possible limitation of RS485 converter at high baud rates

 

2. Could this be a limitation of the USB-RS485 converter?


Have you tried using an oscilloscope to see what's actually happening on the wires - particularly at the STM32's RX pin?

That would soon show you if there's a hardware/connectivity issue ...

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.

At such high baudrates I recommend using the DMA to receive. An interrupt for each character is not fast enough. Though you should be getting interrupts.


Aside from the termination resistor have you checked the bias network?


Check the drive enable delay. I needed to set it to maximum to avoid corrupting the last bit. Disabling the drive too soon or too late can cause corrupted bits.

 

Have you used a logic analyzer to check the signal integrity at the MCU pins?

Kudo posts if you have the same problem and kudo replies if the solution works.
Click "Accept as Solution" if a reply solved your problem. If no solution was posted please answer with your own.

 I suspect that the problem is related to Windows, Hterm, or the USB COM485 PLUS 4 converter,

The converter indeed can have limit of the baud rate. Check with the vendor.

 

MES98
Associate III

Thank you for your suggestion.

I enabled the UART error interrupts, but no error flags are triggered.

I also checked the Windows adapter settings. The latency timer was set to 16 ms by default, and I reduced it to 1 ms, but this did not make any difference.

For clarification, my communication is very light:

  • Packet size: 4 bytes
  • Communication rate: once per second
  • Operation: PC sends a 4-byte command → STM32 sends a 4-byte response

For testing:

  • When STM32 transmits data periodically (once per second), I can see it correctly on Hterm even at 12 Mbaud
  • However, when I send data from Hterm at 12 Mbaud, it seems that STM32 does not receive anything

I also verified with an oscilloscope that the data is physically coming out of the converter, so the signal is present on the line.

At this point, it looks like the data reaches the STM32 pin, but it is not being captured or processed by the UART peripheral.