Hello All
First time posting, although a long term Arduino user and embedded developer.
I am working on a project where I am trying to use the Arduino Portenta Machine Control (PMC) to communicate with a Smart Stepper Servo from the company Nanotec (PD2-C).
I got the EDS file from the company, and I managed to set up the CAN bus in the resources tab (I think) and import the device from the EDS.
Now, as I am completely new to PLCs, Arduino PLC IDE and using CANopen, I don't really know how to continue from here.
What I do know is that:
- I want to command the servo motor to move to a new position
- I can do that by sending the Target Position command highlighted in the below screenshot
- I assume that I must start the CANopen bus and its connected devices somewhere in the code
- I assume that I must write a piece of code somewhere to execute the PDO command being sent, (for example once a second with an incrementing position target)
- I assume I do this with a Function Block? Not so familiar with the terms here, so this is a bit of a guess.
I have not been able to find any beginners tutorials on using CANopen in PLC IDE with PMC, except for setting up the bus.
I would really appreciate it if anyone has any links to tutorials for using a CANopen device with Arduino PMC, and how to set that up in PLC IDE.
Would also be thankful for tutorials in other IDEs that might shed light on how you "execute a device PDO" with a PLC. How do you code that.
An example could be reading the temperature value from a CANopen enabled digital thermometer, for example.
Background Research
@randy23 in this post references a wiki page for LogicLab. This reference unfortunately only gets me to the CAN bus setup step, not the "executing the PDO" step.
I have also looked at introduction to CANopen that the user references from CSS Electronics, which is a great intro, and pretty much some up my current understanding of CANopen.
I've looked at the youtube videos for the PLC IDE from Jakob Sagatowski and JugaadTech [will post links below], the latter which led me to look for similarities between the Arduino PLC IDE implementation and JugaadTech's IDE of choice: CODESYS.
I am currently digging through documentation from FESTO on using CANopen in CODESYS (link to PDF) to see if that will give me some hints, but so far without luck.
Any tips that could help me get a step further will be truly appreciated.
As information about this seems to be missing at the moment from the forum, I am determined to make my findings visible her as soon as I figure it out.
Thanks in advance!
Videos I started with from Jakob Sagatowski and JugaadTech. JugaadTech has a small series, but I was unable to find a specific discussion about using CANopen with devices.
Hello,
I have the same problem. Did you get it?
Hello Luca
Thanks for getting in here 
Unfortunately I still haven't found a solution.
I ended up going the Beckhoff PLC way after watching Jakob Sagatowski's intro to the same. I ordered a couple of their modules, and will test those. If that end up giving me clues on how to handle Arduino PLC IDE, then I'll report back here 
I would be happy just to read out some values from a CANopen slave.
I imported sucessfuly the EDS and did the mapping, the slave device beeped, so i know something is going on. But now? How to assign this PDO mappings to a variable? How to handle this variable in a sketch/code whatever? The only guide avaiable from Arduino is how to set up the CANopen bus.
Any hints, guides, whatever?
I ended up going full Beckhoff on my project, so unfortunately didn't get any further with using PMC and Arduino PLC IDE.
Hi @intstarep I fear I too have got to the same problem. I am on the starting blocks but don't know what to do next?!
Have you managed to get your project working? Would really appreciate and hints and tips you are able to pass on.
Thanks
Hello Rob
No, i was only able to bring the can client (a battery) to beep, meaning establish a CANOpen but then i wanted to access the variables with a sketch, lost some nerves and gave up - i don't wante waste time without proper documentation of the arduino part, examples etc.
It was a request from a battery dealer without a proper budget. I don't know what this IDE is about within Arduino, at the moment it seems to me like they buyed something without having the ressources to handle the project properly TBH.
Thank you, I think you might be right! I am in a similar position, I have a side project I am trying to develop, and frustrated not to be able to progress quickly without examples and documentation.
he,
are their any examples jet or any progress on this topic?
Hello,
I'm also trying to get the CANopen to work within the PLC IDE enviroment. I've looked through all of the links that were posted here. Thank you for those.
within the Library Tree (Project Libraries / AICOPM) i found some of the functions and status structs which i assume are used by the CANopen stack according to their description.
On the oscilloscope i can detect the bootmessage from both the master and slave. So i assume the CANbus is setup properly.
I tried calling the functions within the code directly eg. with the sysCopm_SlaveGetObjInteger function i found in the library tree
sysCopm_SlaveGetObjInteger_Inst1(
can := COPM_CHN_CAN0,
node := 7,
obji := 16#2201,
objs := 1,
tmo := 1000,
val => UserPara1
);
The status and error flag of the function say COPM_E_CFG_SLAVE_NOT_EXISTS "Slave does not exists in netlist"
But no matter what i tried the bus remains at idle after the initial boot message. From the status struct sysCopmStatus i can see the status of the master is COPM_STATE_NOT_KNOWN.
The only function i got to achieve a result is the
sysCopm_Reboot(can := COPM_CHN_CAN0);
which restarts the CANopen master and i can see the boot messages on the scope.
Did anyone get the CANopen master working? Maybe atleast the infos here help someone further.
edit: Changed the command to the correct CAN channel 0 and changed the corresponding error. I tried so many different things before i posted
Hi all,
for all the CANOpen tasks with the PLC IDE, the reference documentation is here Configuration: CANopen - Axel Public Wiki.
As long as you have the Catalog for your device, you just have to import it and the PLC IDE will take care of configuring everything and making all the resources available as shared variables as usual.
Bests,
Giampaolo
Hi Giampaolo
Thanks for the wiki link.
I set up a completly new project with all the infos form the wiki and still do get the same error behavior.
A bootmessage is sent by the master and slave after booting. Then the bus goes silent.
In the sysCopmStatus I can see the status fo the CANopen master is COPM_STATE_NOT_KNOW - Unknown, not present
Do you have any more ideas?