This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Pointers to implement/integrate Modbus TCP stack for TMS320F28335

Other Parts Discussed in Thread: TMS320F28335

Hello, 

I have to implement Modbus TCP stack for TMS320F28335 in C language.

Can anyone please provide pointers?

Does TI have a free library for Modbus ?

Are there any other resources online where I can find free library for this processor to integrate ?

Regards,

Shraddha M.

  • Hi Shraddha,

    Are you using TI-RTOS?

    Steve

  • Hi Steve,

    We're using SYS-BIOS in our current project configuration.

    Thanks & Regards,
    Shraddha
  • Ok.  SYS/BIOS doesn't have any support for Modbus; however, we do have a TCP/IP stack (NDK).

    I'm not sure on the details of Modbus ... do you just need to implement a driver for this, which any TCP/IP stack can sit on top of?  Or would the stack need to have upper layer protocols tailored specifically for Modbus?

    I'm wondering if you could write a Modbus driver for the TI-RTOS/SYS-BIOS TCP/IP stack.

    Steve

  • Hi Steve,

    We have UART driver up and running. On the other side of target board of TMS320F28335, there is PC from where commands will be sent to 28335 over Ethernet. 

    The idea is to send/receive command/data bytes over UART using Modbus TCP/IP driver implemented in 28335.

    The Modbus driver will sit on top of TCP/IP stack.

    Data Packet might look like this :

     <<   TCP/IP Header    <<Modbus Data Packet>>  TCP/IP EOF  >> 

    This data packet will travel over UART towards Serial to Ethernet Converter. Serial to Ethernet converter will relay all data to the PC over Ethernet.

    Modbus TCP/IP driver is already implemented in .NET on the PC side.

    Data flow should look like this:

    Modbus Data <--> TCP/IP encapsulated Modbus Data/Command <--> Byte by Byte UART transmission/reception <--> Serial to Ethernet Converter <--> PC

    As of now, having SYS/BIOS is not a mandate. It can just be a OS-less firmware on 28335. 

    Thanks & Regards

    Shraddha M

  • Sounds like your application would send the Modbus data using send() on a TCP socket then (?).

    If so, you would still need to implement a UART driver for the NDK, so that the NDK stack could send the TCP data over the UART.

    Steve
  • A simple byte-Rx-Tx UART driver is in place..
    Will there be any special additions required in UART driver if NDK stack is integrated?

    I assumed that Modbus-TCP-data-packets can be transferred byte by byte over UART.
  • Hi Shraddha,

    Yes, you would need to make it a "NIMU compliant driver."

    NIMU stands for Network Interface Management Unit, and is the layer that "glues" the driver to the stack.  In order for the driver to properly work with the stack, it must be NIMU compliant.  In short, this will consist of defining a set of APIs in the driver and properly registering them with the NIMU layer (among other things).

    You can find a guide on how to do this here (this can also be found in the NDK installation).

    Steve

  • Thanks Steve for the pointers...will study NIMU first.