Skip to main content
Hghas
Associate
July 14, 2019
Solved

Modbus slave RTU/ASCII

  • July 14, 2019
  • 4 replies
  • 4255 views

Hi

I want to implement Modbus slave RTU/ASCII protocol on STM32F103VET6. I have read many forums about Modbus and examined several libraries, but unfortunately I couldn’t do it and I’m disappointed. 

In this blog: https://blog.naver.com/eziya76/220970378890 (this is Korean, I translated it with google) there is a full explanation of running Modbus, but when I test with ‘Modbus poll’, the error ‘Time out’ occurs. The library is here: https://github.com/cwalter-at/freemodbus 

Maybe I’m missing something or doing something wrong. I uploaded my project and schematic of my discovery board. I’m using Usart1 (PA9 , PA10 pins) for Modbus and connect it with Usb cable to PC. 

After all, if you have a good manual or know a better library, please let me know.

I really appreciate if someone helps me. This is very important for me.

Thank you very much…

This topic has been closed for replies.
Best answer by Pavel A.

IMHO, the Modbus serial protocol cannot be expected to work well over USB CDC emulated serial connection on either side. All timing will be distorted.

-- pa

4 replies

Pavel A.
Pavel A.Best answer
July 14, 2019

IMHO, the Modbus serial protocol cannot be expected to work well over USB CDC emulated serial connection on either side. All timing will be distorted.

-- pa

Hghas
HghasAuthor
Associate
July 15, 2019

Thank you.

Yes, at first I guessed so, but in the blog, he used usb serial for modbus protocol. I don't know how that works.

So, if I run the library and use a RS485 IC like SP3485 (in the pdf above) will this work? 

Pavel A.
July 16, 2019

It could be other problem as well. Have you tested that the serial TX/RX work, with some terminal program?

-- pa

Hghas
HghasAuthor
Associate
July 18, 2019

​

Ok, I'll check it. 

My discovery board has a RS485 module (SP3485 IC). I want to use this instead of serial port. This IC has two states, driver enable and reciever enable. When should I enable driver mode and when I should enable reciever mode?

Thanks for your help...​