0

I'm using STM32H745. I would like to set the UART Mode field to "Modbus Communication", but when I do this the GUI erases all the Parameter Settings and gives a message in the Configuration section saying "Warning: This peripheral has no parameters to be configured". I would expect it to have similar parameters to the other modes. I'm running withe STMCubeIDE version 1.6.1 and CubeMX version 6.2.1-RC2.

CubeMX Screenshot showing USART config window

I can't find any online documentation about this and the only related details are in the ST reference manual RM0399 section 51.5.11 USART Modbus communication. Is this a feature that has not been implemented in CubeMX?

Tagli
  • 2,412
  • 2
  • 11
  • 14

1 Answers1

0

I'm not very experienced with CubeMX, but IMO, it seems to be a bug or unimplemented feature. Modbus support in HW is very limited - maybe because it doesn't need much HW support. HW only provides end of block detection feature. So, one must be able to configure other settings as usual.

This Modbus support in HW isn't unique to the H7 series. F0 series also have the same feature. But in F0 series, CubeMX doesn't even show a Modbus Communication Mode in the GUI.

I guess you can simply configure USART for Asynchronous Mode and modify the USART_RTOR register & enable the Receiver Timeout Interrupt manually using USART_CR1:RTOIE bit. Then you will need some kind of condition check & branching in your USART callback. There are no additional settings related with Modbus support.

Tagli
  • 2,412
  • 2
  • 11
  • 14
  • I found that the function HAL_UARTEx_ReceiveToIdle_DMA defined in stm32h7xx_hal_uart_ex.c to be an effective way to implement this capability. I suspect the CubeMX modbus mode is a placeholder that the developers intend to implement some time in the future. – Bryn Wolfe Jul 17 '21 at 21:06