Giter Site home page Giter Site logo

brunoluiz / 28335modbusslave Goto Github PK

View Code? Open in Web Editor NEW
28.0 28.0 25.0 923 KB

⚡️ RAW Modbus Slave (server) implementation for F28335 DSP. May work with other DSP of Delfino family.

License: Apache License 2.0

Shell 0.85% C++ 16.86% C 71.51% Assembly 1.89% Objective-C 0.95% Batchfile 7.94%

28335modbusslave's People

Contributors

brunoluiz avatar rocksolidsr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

28335modbusslave's Issues

[Confirmed] Works on 28379D & Needs optimizations

This code works on 28379D with few modifications. However, the code seems to use polling instead of DMA and/or interrupts. I will try to make a more efficient implementation that utilizes DMD and/or SCI's built-in FIFO.

readDigitalData

I have been using this library for a couple of weeks now and it is working pretty well, I have one issue that I can not resolve and was wondering if you could give some help.

For the datahandler_readDigitalData in ModbusDataHandler.c, I'm having trouble reading just one value at a time. If I read more than one it is fine but if I try to just read one it does not seem to give me the correct value of the input register. I believe it is somewhere in this portion of the code but can't seem to pin point it. Any help would be much appreciated.

I was able to get it to work (kinda, for the first 16 variables anyways) with the following code

// MODIFIABLE: specified address values
for (idx = 0; idx < numberOfBytes; idx++) {
        Uint16 coilsNum = totalDataRequested - idx*8;
        Uint16 padding = idx + firstDataAddress - reg16ReturnIdx;
        Uint16 content = 0;
        content = *(dataPtr + padding) >> (reg16ReturnIdx*8);

    if(coilsNum >= 8) {
        slave->dataResponse.content[slave->dataResponse.contentIdx++] = content & 0x00FF;
    } else {
        Uint16 mask;
        mask = ~(0xFFFF << coilsNum);
        if(firstDataAddress<2)
            firstDataAddress = pow(2,firstDataAddress);
        else
            firstDataAddress = pow(2,firstDataAddress)+2;
        //slave->dataResponse.content[slave->dataResponse.contentIdx++] = content & mask;
        slave->dataResponse.content[slave->dataResponse.contentIdx++] = ((*(dataPtr) & (firstDataAddress))!=0);
    }

    if(reg16ReturnIdx == 0) reg16ReturnIdx = 1;
    else reg16ReturnIdx = 0;
}

Hi, Bruno here: this project is not active anymore 💔

I haven't touched this project in years and, not only, I don't work in the embedded systems field anymore. This project was implemented when I was a student research back in my university days, so it is quite cool to see so many people using it up to this day, but the time has come to archive this repository.

It might better if the TI community maintains a separate fork of this project, with support for more devices, better documentation and potentially bug fixes. I would say, this is the "wish list" of improvements:

  1. Formatting / linting: I didn't know the concept of this back then
  2. Probably refactor it in a less C++ way: don't ask me why, but young me wanted this C project to look like C++ / OOP... It could leverage some refactor to use static functions, have less heap allocation (all those structs) and others, which might make its memory footprint lower
  3. Write up-to-date guides/scripts: I implemented this when they just released CCS on Eclipse... pretty sure things changed since then
  4. Updating the 28335 libraries: not sure what sort of bugfixes are there, but there certainly are a few
  5. Use some sort of package manager: not sure if C has something like this, but at least it could help to keep track of which version is in use and potentially leverage automatic dependency upgrades (see dependabot)
  6. Support more platforms: would need some re-organisation of the project structure, but it is doable

Whoever is up for the task, please leave a comment with the fork below as I might add on the README in a later date. I will archive this repository in a few weeks, so hopefully someone will be up for the task.

This applies for both 28335ModbusSlave and 28335ModbusMaster

Obrigado 🙏

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.