Can not add antyhing to my software

Hello to you all,

First I want to apologize because I know that I will give a poor description of my problem but any idea to solve it (or things to check) would be greatly appreciated.
I am currently developping a software in QNX 6.6.0 in C++ to move several motors in real time using Ethercat and it was going great until recently.

Since a few days, each time I add anything to my soft, it compiles perfectly fine and does not show any problem during execution (the log file is perfect indicating that all the loops occur at the correct moment and all the threads are executing) but the motors do not move anymore. It seems to indicate that the part of the code where I send the data using Ethercat is not really executed but if I add a printf, it shows that the function is executed.

Which is even weirder is that the same thing happen regardless of what I add to my code and where.
I tried to use the tools to detect memory leak and trace the CPU usage and the threads but everything seems normal.

I am not sure my problem is very clear but I would appreciate any insight that could give me ideas to test because I am currently stuck.

Best regards,
Fabien

If your printf verifies that the code sending commands to Ethercat is working, but the motors are not turning, I would suggest the following are possible.

  1. The Ethercat software is not working
  2. The hardware is not working
  1. The commands you are sending over Ethercat are mangled / wrong.

Tim

P.S. You didn’t mention whether a prior build of your software still works (drives the motors). If a prior build still drives the motors it would indicate that my suggestion is probably the problem. If a prior build doesn’t drive the motors Maschoen’s suggestion is probably the problem.

Thank you both for your answers,

To answer to Tim, yes a prior build of the software works which indicates that the hardware is working properly and, as I do not modify the Ethercat part, it seems indeed that the commands are somehow wrong but the datalog shows that the variables have the correct values so I do not see how it could be wrong.

Besides, this appears regardless of the part where I add something to my software. For example, if I add anything to the interface or the part of the code which is in charge of an IMU module which both have a specific thread and therefore have no impact on the commands sent through Ethercat, I still see the same phenomenon that everything seems fine but my motors are not moving anymore.

I suspect something is mixed up in the memory or is not behaving as expected in terms of real time or multithreading but I have no idea where I should look or what I can do.

Fabien

Thank you both for your answers.

To answer to Tim, an old version of the software still works showing that the hardware is ok and, as nothing has changed in the Ethercat library, this part should be fine too.

So I guess something is wrong in the data i send to the Ethercat slaves but the variables are saved in a datalog file and they are ok there.

Besides, I do not understand how when I add anything to my code even in completely different threads (like the one in charge of the interface or the communication with an IMU module), I affect the commands that are sent to the various motors through Ethercat.

I suspect I am doing something wrong with the way I handle the memory or the multithreading and the scheduling of my tasks but I did not find anything yet and everything I can see from the tools of Momentics seems fine.

Please do not hesitate if you know any test I could perform that could help.

Fabien

Fabien,

A question about your ‘old’ version of software. Are you re-compiling this old version or simply using existing binaries? The reason I ask is that I wonder if you are somehow using a different compiler or linking to different libraries. That could explain why whenever you add anything to your code the Ethercat stops working. If you are simply using old binaries I would try recompiling the old source and make sure that newly build binaries from old source still works.

The next thing I would do would be to install tcpdump on your QNX machine. Then run tcpdump and capture packet data (both in/out) from the working version and the non-working version and confirm that they contain identical data. The answer to that will tell you if you have a timing issue or a data issue.

Tim

Hello Tim,

Thank you for your reply. I had the same problem indeed even when i recompiled the sources of the previous version.

I currently can not make my problem appear as I compiled a new QNX kernel as tcpdump was not available on the previous one and I do not have the same error on the new kernel.
I have not figured out what was wrong though.

Thank you anyway for your kind help,

Best regards,

Fabien