Author Topic: standalone Modbus  (Read 1136 times)

Offline Felix

  • Newbie
  • *
  • Posts: 18
    • View Profile
standalone Modbus
« on: January 21, 2018, 10:27:16 AM »
Hey Mark,

in the Modbus User´s Guide you wrote, that one can include the Modbus source files into any project. Is it easy to integrate it into own projects (without uTasker)? How do I need to prepare my project to add those files. Do I need aditional recources (Timers etc.)?
Do you have example code for using modbus without uTasker for Kinetis?

Thanks for your help and regards
Felix
« Last Edit: January 21, 2018, 11:00:22 AM by Felix »

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2940
    • View Profile
    • uTasker
Re: standalone Modbus
« Reply #1 on: January 21, 2018, 03:09:48 PM »
Hello Felix

I think that the Modbus guide means that Modbus can be added to any "uTasker" project because it just needs the Modbus directory to be added to the framework (when not yet there) and the MODBSU defie(s) to be enabled. It is not necessarily easy to add it to other environments since Modbus requires other services to work. Depending on mode:
- TCP/IP stack
- UART driver
- UART driver with RTS control if RS485 is used
- UART driver which allows RTU mode operation
- SW timers for master mode
- HW timers for RTU mode
- Queue drivers for some advanced modes (gateway, router)

It is possible, but not necessarily without a certain amount of work if the resource capabilities aren't available or need to be adapted to the API.

The exception is FreeRTOS based projects where it is possible (with developer's version) to include uTasker and Modbus as a FreeRTOS task. This option was added to allow FreeRTOS projects to be able to use uTasker resources and Modbus (which inherits all necessary uTasker drivers/resources for the task without causing conflicts with the HW library used by the FreeRTOS  part).

Regards

Mark


Offline Felix

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: standalone Modbus
« Reply #2 on: March 10, 2018, 03:57:24 PM »
Hi Mark,

including the Modbus driver into FreeRTOS could be a good opportunity for us.
Can you explain that in more detail?
What is the "developer´s version"?
Is there any documentation about including utasker´s Modbus driver into an existing FreeRTOS project?

Best regards
Felix

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2940
    • View Profile
    • uTasker
Re: standalone Modbus
« Reply #3 on: March 10, 2018, 05:13:36 PM »
Felix

The developer's version is the "licensed" version, rather than the Open Source one. Presently, the Open Source one doesn't include Modbus, FreeRTOS or security - it is also generally about 2..3 years behind peripheral developments in order to give project funders an advantage over non-funders.

The developer's version has the option "RUN_IN_FREE_RTOS" which sets up a FreeRTOS V9.0.0 environment with uTasker operating in one of its tasks.
The option FREE_RTOS_BLINKY adds a FreeRTOS task that flashes an LED, whilst the uTasker Watchdog task flashes another.
A further option is FREE_RTOS_UART which shows how a FreeRTOS task can use free-running UART DMA reception (handled by the uTasker side and a uTasker task) to easily and efficiently enable UART DMA which is something that FreeRTOS users have otherwise great difficulties with (mainly due to missing low level support and complicated implementation).

If Modbus is enabled (also valid for all other such things in the uTasker part) it will operate the same as in a pure uTasker environment so this means that FreeRTOS uses can just add their original tasks and make use of the uTasker parts where needed. The result is that existing FreeRTOS projects can easily make use of uTasker resources (protocols, HW libraries) without needing to redesign their original project or conflict with HW libraries - they just add their existing tasks to the application file FreeRTOSapplication.c and share any prototypes and defines in the application header FreeRTOSConfig.h and the two "worlds" can happily operate together.

Regards

Mark

P.S. The (minor) disadvantage of using FreeRTOS at present is that it can't be fully simulated. Some work has been started to overcome this (including real-task switching following the Cortex code on the PC) but it is not yet complete.