rikka0w0 / litemodbus

A light-weight Modbus RTU library for C2000, STM32, GD32 and more...
8 stars 0 forks source link

Run the stack on TI Launchxl-F28379D #1

Open sumitbilam opened 5 months ago

sumitbilam commented 5 months ago

Hello @rikka0w0

I was wondering if you could mentioned the steps you took to make this stack run on TI Launchxl-F28379D.

Thanks,

rikka0w0 commented 5 months ago

This project is meant to be platform-neutral. It consists of a protocol layer and a hardware abstraction layer (HAL). The HAL is hardware-dependent (e.g., C2000/ARM STM32/ARM GD32/RISCV/8051) whereas the protocol layer is not.

First, you need to add all files in this project to your C2000 project, either by git submodule add, or simply copy the files if you are not using git for that project. At the end, it would look like: YOUR PROJECT ROOT/litemodbus/modbus_protocol.c. You may need to delete the stm32 folder.

Then, rename and move YOUR PROJECT ROOT/litemodbus/template/modbus_config_h.txt to modbus_config.h, and place it in any of your header folders. In this header file, you will find all options of this library. To select the hardware platform, you need to comment out #define MODBUS_PLATFORM_STM32F3 and uncomment #define MODBUS_PLATFORM_TMS320F2837x.

Finally, in your main.c, include modbus_c2000.h. Declare a modbus_c2000 struct for each of your Modbus server instances, then call modbus_sci_init() for each of them. In your main loop, call modbus_sci_loop for each of them. The const modbus_dev_def_t modbus_dev_def; field in the modbus_c2000 struct defines the register layout. At this moment, only holding and input registers are supported.

sumitbilam commented 5 months ago

@rikka0w0

Thanks for your response. I followed the steps you mentioned above and there is build error regarding "timestamp_get()". I can see its implementation for stm32 but not for c2000.

see the the screenshot attached. timestamp_get

sumitbilam commented 5 months ago

Hello @rikka0w0

Did you get time to look into this?

Thanks,

bharatbohara commented 2 months ago

Hi @sumitbilam,

Are you able to use run this repository successfully on TI Launchxl-F28379D? If you are able to do, how did you do it? I am getting some errors as well on TI board.

Thank you in advance for your help.

Thanks

sumitbilam commented 2 months ago

Hi @bharatbohara

I was not able to integrate this in my project. I just decided to write a simple modbus slave stack myself

Thanks