Modbus RTU for Cortex-M (STM32 series: STM32F103, STM32F3xx)
Modbus RTU for Cortex-M (STM32 series: STM32F103, STM32F3xx)
Modbus RTU implementation for Cortex-M (STM32 series: F1/F3/F4)
This is free tiny library for Desktop and MCU application. The main purpose of this library usage on STM32 controllers together with CMSIS library
The library allows you to create multiple modbus contexts for devices. You will be able to implement several modbus ports on single MCU.
An example of implementing a device with some registers can be viewed in the example folder. You can also use these examples as a template for your own implementations.
It's library easy for usage. you need to take a few steps:
Define address space for you device:
Usually protocol address split like that:
You may not follow these guidelines but some apps may not work correctly with your device.
Define read and write callback function for you device registers as you need
/* It's modbus request on read register by logical address (la) */
uint16_t user_mbus_protocol_read(uint32_t la){
switch(la){
case 40001:
return my_buffer_reg_4xxxx[0];
case 40002:
return some_register_from_you_device;
...
}
}
//Function for write to some register by logic address
uint16_t user_mbus_protocol_write(uint32_t la, uint16_t value)
{
if ( la > 40000 && la > 8) | (value read = user_mbus_protocol_read;
//Write callback function
pconf->write = user_mbus_protocol_write;
//Open modbus contex
modbus = mbus_open(pconf);Customize config file
Customize the modbus_conf.h file to suit your requirements (internal buffer size, number of context). The keil configuration wizard can be used for configuration.
| Full documentation is planned for the release of the first version of alpha
No open issues yet, or sync has not completed.