MODBUS communication using STM32F730
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2023-01-01 7:25 PM
I'm trying to use STM32F730 for MODBUS communication. The datasheet and reference manual both shows support for MODBUS. However the problem is :
- when i use cubemx for configuration purpose it generated following message "This peripheral has no parameters to be configured".
- 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
Solved! Go to Solution.
- Labels:
-
STM32CubeMX
-
STM32F7 Series
-
UART-USART
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2023-01-03 4:22 AM
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:
- Purchase a solution from one of our partners in the partner programme, e.g. emModbus from Segger
- Using one of the examples from Github, e.g.
- STM32 Master MODBUS LL Library
- Simple MODBUS implementation for STM32 HAL & FreeRTOS
- nanoMODBUS - A compact MODBUS RTU/TCP C library
You can also find the topic Modbus here in the community.
Maybe that will help you?
Regards
/Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2023-01-03 4:22 AM
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:
- Purchase a solution from one of our partners in the partner programme, e.g. emModbus from Segger
- Using one of the examples from Github, e.g.
- STM32 Master MODBUS LL Library
- Simple MODBUS implementation for STM32 HAL & FreeRTOS
- nanoMODBUS - A compact MODBUS RTU/TCP C library
You can also find the topic Modbus here in the community.
Maybe that will help you?
Regards
/Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2023-01-05 12:26 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2023-01-05 12:27 AM
Correct.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2023-01-05 8:56 PM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2023-01-06 1:23 AM
This should not matter, as both USART and UART offer hardware flow control for RS232 as well as RS485.
Regards
/Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2023-01-06 1:35 AM
@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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2023-01-06 1:36 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2023-01-06 2:56 AM
So, use the UART driver (stm32f7xx_hal_uart.h, stm32f7xx_hal_uart.c).
Even for a USART.
