alejoseb / Modbus-STM32-HAL-FreeRTOS

Modbus TCP and RTU, Master and Slave for STM32 using Cube HAL and FreeRTOS
GNU Lesser General Public License v2.1
519 stars 182 forks source link

Documentation #86

Closed vishnu-illikkal closed 10 months ago

vishnu-illikkal commented 11 months ago

I need more documentation on how to set up and run this library in STM32. I am trying to work with a modbus peacefair pzem-016 energy meter. Anyhow I need to create a documentation for how to do this. But I can't find any on the internet. So if you can explain how the library works I can create a HTML page and share in this repo.

1 : Give me details on how this library works 2 : I will write a documentation on HOW-TO in HTML

Thank you for your time.

alejoseb commented 11 months ago

Hi all the documentation is in the readme file of this repository. If you are willing to extend the documentation it has to be written in markdown, and posted in this repository. Let me know if you have any specific question regarding the content of the readme file

j-broome commented 10 months ago

I was able to use your Pico RTU repo and get a really good understanding. Could you give some guidance on using this library to work with an RP2040 with on on board dedicated ethernet chip? https://www.waveshare.com/wiki/RP2040-ETH#Introduction - I was able to make a connection to this and send some data and catch it, just struggling a bit to understand how to incorporate the TCP version.

alejoseb commented 10 months ago

hi @j-broome , that is not an easy question since the TCP stack can be implemented in different. In this library ,in particular, I took advantage of the STM32 HAL library, which uses the LWIP stack. In your case, the TCP stack is implemented by hardware, which is quite different. In summary, you should take a look to the function implemented here: https://github.com/alejoseb/Modbus-STM32-HAL-FreeRTOS/blob/861d511588915796447184e1e384c11becfb1466/MODBUS-LIB/Src/Modbus.c#L486 . That function implements the main logic to handle TCP connections and an aging algorithm that I designed to close connections. Besides that I cannot help much here, since that is outside the scope of this library.

j-broome commented 10 months ago

I am using your Pico specific repo and I believe the TCP functionality portion of the Modbus library is left out. Is there anything else missing that would stop this from working? Sorry, I know this isn't the best place to discuss.

alejoseb commented 10 months ago

Modbus over TCP is not exactly the same, frames have small differences. This version of the library cope with those differences, when TCP is activated. So better you check Modbus documentation and implement accordingly. Besides that, the library in this repo is equivalent to the Pico port. And yes TCP was left out on purpose since the original Pico does not support TCP natively.