Code Monkey home page Code Monkey logo

Comments (3)

michael-hillmann avatar michael-hillmann commented on July 24, 2024

Can you explain in more detail, what you are doing? Are you sending NMT commands twice, or accessing API functions multiple times? I need to investigate this in my environment to fix the software (or documentation) ;-)

from canopen-stack.

smavon avatar smavon commented on July 24, 2024

Hi, I found this issue during some tests.

So to give more details on the system : I got a node configured with a PDO in asynchronous mode, with a 1s event timer, working normally in operate state.
Then I send an NMT command to go to the operate state (which, we agree is useless because it is already in).
I was surprised to see the period of my PDO changing : twice more messages.
After this I repeated the send of NMT operate commands, each one adding one new PDO message periodically send by the device !

I did not kept the traces, but if you can't reproduce this easily, I can illustrate with some captures.
It's not a critical bug, just some curious behavior...

I noticed also that going to pre-operate works normally and after, a new command to go to operate results in a normal behavior.
From the code I imagine that some timers are created for PDOs on the Operate command, which is done even if the node is already in the Operate mode...

Best regards and thanks for this stack ! :)
Sylvain

from canopen-stack.

michael-hillmann avatar michael-hillmann commented on July 24, 2024

You are right, thank you for the investigation!

Analysis
This is a bug in function CONmtSetMode(). This function initializes the transmit and receive PDOs each time, this function is called.

The correct behavior is: initialize PDOs when entering the operational mode only.

Solution
No workaround is possible.
Change of the function for the next release. For example:

void CONmtSetMode(CO_NMT *nmt, CO_MODE mode)
{
    if (nmt == 0) {
        CONodeFatalError();
        return;
    }
    if (nmt->Mode != mode) {
        if (mode == CO_OPERATIONAL) {
            COTPdoInit(nmt->Node->TPdo, nmt->Node);
            CORPdoInit(nmt->Node->RPdo, nmt->Node);
        }
        CONmtModeChange(nmt, mode);
    }
    nmt->Mode    = mode;
    nmt->Allowed = CONmtModeObj[mode];
}

Testsuite
We need an additional test in the test suite:

  • changing NMT state from operational to operational

from canopen-stack.

Related Issues (20)

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.