cancel
Showing results for 
Search instead for 
Did you mean: 

Energy Meter through RS485 port with MODBUS RTU protocol using stm32f427 mcu

NITIN RAWAL
Associate II
Posted on April 19, 2018 at 11:07

Hello,

I am want o read Energy Meter through RS485 port with MODBUS RTU protocol. I am using stm32f427 mcu. 

is there any one who can help me with this..

who to write cubemx code to read meter values..

3 REPLIES 3
Andrew Neil
Evangelist
Posted on April 19, 2018 at 18:58

So what 'help', exactly, do you need?

Both Modbus and RS485 are very well-established and widely-used technologies - you should have no difficulty finding information & support for them ...

https://en.wikipedia.org/wiki/RS-485

 

https://en.wikipedia.org/wiki/Modbus

 

http://modbus.org/

 

https://www.freemodbus.org/

 

https://www.schneider-electric.co.uk/en/faqs/FA168406/

 
AvaTar
Lead
Posted on April 20, 2018 at 07:31

I'd deem the modbus.org website the best source.

Get the standard description, and study it. At least it sufficed for me.

Start with the lowest level, and contemplate how you properly implement the inter-package timings.

The rest is a 'piece of cake', then.

who to write cubemx code to read meter values..

You, I guess.

There had been a idle time interrupt for several UART peripherals, which are quite useful for your case.

I bet Cube does not support it.

Farhan Khan
Associate II
Posted on April 20, 2018 at 07:46

First understand basics of Modbus

http://www.modbustools.com/modbus.html

 

http://www.simplymodbus.ca/FAQ.htm#Modbus

 

Get UART working on the MCU

Go through the document of that energy meter and obtain which register at what address you need to read

Then arrange your frame accordingly

SLAVE ADDR | FUNCTION CODE | DATA ADDR | NO OF DATA | CRC

and then wait for the response of the device.

I will suggest first start with polling, get a USB to UART connect to your energy meter send the request manually and if see if the device responds that would be the best way to start.