cancel
Showing results for 
Search instead for 
Did you mean: 

MODBUS communication using STM32F730

NSing.5
Senior

I'm trying to use STM32F730 for MODBUS communication. The datasheet and reference manual both shows support for MODBUS. However the problem is :

  1. when i use cubemx for configuration purpose it generated following message "This peripheral has no parameters to be configured".
  2. Further i generated the code when i check code using IDE the USART initilization function has no code and it appears as follows:

static void MX_USART1_Init(void)

{

 /* USER CODE BEGIN USART1_Init 0 */

 /* USER CODE END USART1_Init 0 */

 /* USER CODE BEGIN USART1_Init 1 */

 /* USER CODE END USART1_Init 1 */

 /* USER CODE BEGIN USART1_Init 2 */

 /* USER CODE END USART1_Init 2 */

}

As per my understanding this initialization function is not correct.

So all of you are requested to help me to understand what is the issue.

Regards

1 ACCEPTED SOLUTION

Accepted Solutions
Peter BENSCH
ST Employee

Data sheet and RM mention "basic support for the implementation of Modbus/RTU and Modbus/ASCII

protocols".

It further states "The control part of the protocol (address recognition, block integrity control and command interpretation) must be implemented in software."

There are now several possibilities:

You can also find the topic Modbus here in the community.

Maybe that will help you?

Regards

/Peter

In order 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.

View solution in original post

8 REPLIES 8
Peter BENSCH
ST Employee

Data sheet and RM mention "basic support for the implementation of Modbus/RTU and Modbus/ASCII

protocols".

It further states "The control part of the protocol (address recognition, block integrity control and command interpretation) must be implemented in software."

There are now several possibilities:

You can also find the topic Modbus here in the community.

Maybe that will help you?

Regards

/Peter

In order 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.

thanks sir

It further states "The control part of the protocol (address recognition, block integrity control and command interpretation) must be implemented in software."

sir, does it mean mean that everything related to USART initialization (such as baud rate, DMA utilization etc.) will be implemented in program

Correct.

In order 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.

Dear sir,

i've one more question

whether it will be better to use USART or UART initialization functions.

i'm asking because UART driver has directly RS485 function which has feature to activate the hardware flow control

This should not matter, as both USART and UART offer hardware flow control for RS232 as well as RS485.

Regards

/Peter

In order 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.

@NSing.5​ A STM32 MCU can have three kinds of UART-like modules (IPs) called UART, USART or LPUART. They behave mainly same for usual applications, including RS422/485/232. So it indeed is confusing which HAL driver to use: UART or USART.

Recent Cube versions generate code with the "UART" HAL driver, for both UARTs and USARTs.

bit sir i'm unable to locate the hardware flow control enable element in USART initialization structure definition.

plz guide me how to do it.

regards

So, use the UART driver (stm32f7xx_hal_uart.h, stm32f7xx_hal_uart.c).

Even for a USART.