Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

Omron R88D-KN08H-ETC with a raspberry on top... (over ethercat)

1 2 > >> (Page 1 of 2)
  • patrickrjbrown

    patrickrjbrown - 2020-07-06

    the troubles and tribulations of dealing with Omron and Codesys so far has been one of much head scratching..

    but this will be something that I'm sure is quick and easy for thems in the know...

    so far I'm looking get to a point where i can establish the commissioning control, and get the drive running..

    now I've done all the tuning through the Omron CX drive app, which uses USB... (which was a whole different set of fun and games)

    I've set the device ID on the drive to be ID 10, (using the switch on the front of the drive)

    and I've added the Omron device files for the G5 drives.. downloaded from Myomron

    and you can see from this screenshot that I've got the Omron devices all setup,

    but I don't seem to be able to get the project to allow the drive to be enabled... I've tried a whole host of ideas, with the clock.. and this is the best (the most green arrows) i can get...

    but i'm just going round in circles..

    now please be kind and if I've fallen down Newby hole 101, then please pick me up and help me ... before I get sacked as head of automation for large business corp inc

    clearly if you need more info to even have a chance of yelling you idiot at your screen then please feel free..



  • patrickrjbrown

    patrickrjbrown - 2020-07-06

    Another thing that you might already be thinking it ... urrm the address on the device is 1001 and the log tells me that it has disabled the device as it cant find it... but oddly i cant seem to have a way of setting the address, when i change it it just changes back.. :-(

    but anyway ... any advice greatly received...


  • eschwellinger

    eschwellinger - 2020-07-06

    just download an project which has only the ethercat master in the device tree,
    then rightclick on the master and scan the slave and add it that way to the project.
    Don't care on addresses on ethercat.

    You need to call the PLC_PRG ( Motion fb's) in the Ethercat Master context...

    Then check the logger- for more details if the drive does not go up operational.


  • patrickrjbrown

    patrickrjbrown - 2020-07-07

    Morning Edwin...

    I've been through the process of using the scan, add the device to the project, to get the servo drive into the device tree... it has always detected the servo drive.. so you would think that would help.. but doing it that way seems to differ to going and selecting the Omron drive from the list...

    now the next part of your message where you say I need to call the Motion function block in the Ethercat Master context sounds like something I should definitely be doing.. if I knew what that actually was...

    i will carry on tinkering today ...



  • patrickrjbrown

    patrickrjbrown - 2020-07-07

    Good afternoon Codesys people of the World...

    so .. as maybe an update for someone who is looking at this posting for help using Omron G5 servo Hardware with a raspberry pi,

    also in a funny way by me writing up what I've done... it gives me some clarity and helps prevent me from falling down the "got-ya" holes that seem to litter the landscape (and that's not just Codesys.. its anything.. )

    ok.. so in line with the advice from Edwin,

    in the picture, you can see I use a device tree which only has the Ethercat Master in it,

    i then do a search .. and it finds the Omron Drive...

    and I add that to the Project... :-)

    then that shows up in the device tree...

    then if I right-click on the Omron drive, I get an option to add a soft motion axis.. which I do.. then..... well... here is where the fun happens...

    if I just try and download and check that the EtherCat is happy, and after downloading the config, logging and starting the plc/(Pi) the runtime starts up... and then I get an exception, and in the main device log, there is the error about the processor load watchdog plcload=96 maxload =95

    now if I play about with the dc clock settings... I can get it to not go into an exception, but then I get a synchronisation not supported, error

    now my Omron Contacts have been very helpful and have given me all the manuals and the Etehrcat Protocol looks to be well documented

    and oddly I can see some data coming in from the drive... so there does seem to be, comms...

    if this is no help then I'm sorry .. but its how I learn..

  • eschwellinger

    eschwellinger - 2020-07-08

    go back to the working project with G5 driver not adding DS402 below thge Omron slave.
    You need to call your motion fb's in the Ethercat task.
    (Just drag the PLC_PRG in the taskkonfig below the Ethercat task. see red arrow)


    Last edit: eschwellinger 2020-07-08
  • patrickrjbrown

    patrickrjbrown - 2020-07-09

    Ahhhhhhhhhhhhhhh..... Now it is all starting to become clear. it's not working yet.. but I'm working out how little I know..
    So now in the past, I've had a setup working.. and when I achieved that I realized that the green circular arrows are the key to the comms working correctly... so I've always been mindful that if you have orange or red arrow.. you're doomed...

    now when I did the previous project (which is all in ladder) I was just adding a little servo to do a feed down on one axis of a grinding machine I was CNC'ing and all I need to do is do a count... and then feed a certain amount.. (in one direction ) and then disengage the servo so the operator can still manually adjust the handle if needed...

    now I have a Set of Beckhoff EtherCAT IO and that works lovely... and I had a Savch Drive from china.. which also I managed to get working.. but I did have an issue where the drive would stay enabled.. and I couldn't stop the servo trying to hold position .. and after a while, it could error out... but all of this was done just by me poking numbers into the functions in the ladder... incremental move, etc..

    but now I seem to be into a different way of working...

    so please believe me when I say I'd love to say I've been studying this for years.. but the way life is, I have to figure things out.. and then if it's working.. it gets no more attention...

    sorry ... if that's the wrong way .. but its how it's gone...


  • patrickrjbrown

    patrickrjbrown - 2020-07-14

    afternoon Codesys'ers

    so a few days have passed.. and I've gotten brave enough to move my testing over to the actual machine that this drive is needed for.. and I think I've made some progress.. one is that this Pi is a Multicore one.. and I think it handles the distributed clock better.. as I've got a green tick on the Omron R88D_KN08H_ETC (which was not something I could get to happen on the other setup,

    so now the bit I need to get my head around is how I actually use this drive.... in the past I was able to get the drive (savch from china) to respond to the MC_POWER function and get the drive to go on line..

    now I can see the drive feeding back its position .. and when I move the drive, I get a speed, and the encoder value update, so I'm feeling good things..

    and I've got some code from my last setup where I used to take the actual position from the drive.. and add a number on ... and pass that into the move absolute function block, all done using the axis which was defined under the Savch servo drive...

    this feels so close... but I can't quite see what part of the puzzle is missing.. :-(

    now also I can't get the image upload thingy too work when adding a reply.. .so that's a pain as I would like to share with you the way my project looks,,

    I have other EtherCAT devices in the project .. and they are all good.. which had been a worry ...

    also .. I need to be able to deactivate the drive. which I was never able to do in the past.. but it must be an option.

    please if anyone has any ideas that would be ace.. thanks


  • eschwellinger

    eschwellinger - 2020-07-14

    check the prios of the tasks ( see more than one prio 1??)
    and I would recommend to call all motion fb in the Ethercat Task kontext
    ( In our case the Main task with 4ms?


  • patrickrjbrown

    patrickrjbrown - 2020-07-14

    Hello Edwin.

    would the priority of the tasks have a bearing on the way they drive responds to the function block when I try and do a MC_Power... (to enable the drive.. ), do you have an example as too how you would set them ???

    I have been able to use the other make of servo drive with the exact program layout.. so I don't know if changing the names is important...

    I have a call logged a service ticket with codesys, so I will see how that goes, I have always found them to be very helpful in the past.. so I expect I will have a solution very soon



  • patrickrjbrown

    patrickrjbrown - 2020-07-16

    Hello sports fans....

    So after a bit of poking about and getting some official support i wanted to update the topic, so it keeps track of what I have learned

    So it wasnt obvbious too me but having two bus formats both on the ethernet interface is not recommended.. and as i have both ethercat and modbus over ethernet i’m going to add an extra device to the raspberry pi to give me another ethernet port to connect the single modbus device...

    Also i hadnt noticed but it was being reported back that there was a unresettable error on the omron drive...
    Now the error was error 40, when you read the manual is unhelpfully just listed as a fault with the absolute encoder, which as you can see it updating the position value, sort of makes you wonder what it could be related too...
    Well turns out you need too log into the drive setup app to get to the bottom of it... and what has happend is the motor and the drive have fallen out of sinc, and you need to use the encoder reset tool, where all the encoder falues get reset and you would loose your sync (but for me this is not a problem), but its not a hardware fault... its a reset required.. but the other thing thats not also apperent is that you need to power the drive on and off for the update too stick.. so once thats done..we are able to take the drive online and jog from the CX drive app... (which uses USB for comms)

    Now the support team took me through the process of making a new program with just the ethercat hardware , and i did some quick testing and ive got too the stage where the device tree has all green and one orange arrow...... so it feels like we are getting close....

    I wil add a usb ethernet device tomorrow, and then rejig the project so i only have 3 tasks... (which will take me a bit of doing...cut paste cut paste.. etc :-)
    But thats all for now.. await more updates soon...

  • patrickrjbrown

    patrickrjbrown - 2020-07-17

    so the days roll on ... and i try and try in the quest of a solution for filling in the voids in my knowlage, which in less words is i've been trying to solve this little hickup...

    so with doing a lot of tweeking and copying and pasting i've chopped a lot of the program down and now i have one main task...

    also i have got rid of the webvisulisation as i have a mod bus connected HMI

    and the last piece of the puzzle is splitting up the network so the modbus over ethernet and the ethercat are not on the same phisicial adapter. buy adding a USB to ethernet adapter... and then setting that up in a way so i can make it work..

    this is the stage where i'm at now.. and i'm hoping to get a bit more support from the powers that be, and hopefully we can hammer out a solution..

    one things that i did find was a that resetting the modbus on the new ethernet to usb adapter.. to work with the tcpip settings that are in the HMI seemed to be impossable..

    i tried to play about with the settings.. but i didnt want to delete the modbus device.. as i didnt want to loose the settings.. but mybe there is a good way to rebuild that device..

    anyway ... onwards and upwards


  • patrickrjbrown

    patrickrjbrown - 2020-07-26

    Morning codysysers

    So the updates have been a bit thin on the ground, and I doubt that anyone has missed them really.

    But the situation is i've spent a lot of time looking at it with the support team.. And we have got to a point where we have got the drive in the device tree.. And all green arrows.. (which is good) and not only being able to enable the drive, but we did at one point get it working with a test program .. but with the code that needs to run on the machine i’ve not been able to get the drive to play nicely and bring it into service.. (so i am running in the original mode.. )

    Now i do have a second problem that i need to solve which is getting the original Savch drive to work.. As i think it actually was better behaved than the Omron one…

    But i dont think it's omrons fault.. It's clearly my hamfisted code somewhere…

    Anyway.. Watch this space.. As soon as i get something working I'll update here..

  • patrickrjbrown

    patrickrjbrown - 2020-07-31

    Morning coders. so the path to somewhere is not always clear when you start out..

    but i think i can safely say that, if you want to get there... I'd not start from here..

    so what are my main learnings..

    so i've no doubt the omron drive works..

    but as i was not able to get any support from omron about there hardware using codesys and a raspberry pi, i was sort of stuck..

    now my Savch engineering friends in china were able to get it working with codesys on the pi and it was very easy for them... but at my end it was a lot more complex.. but here is why.. and maybe this is a lession that we call can learn from ..

    so the Ethercat hardware is a bit fussy about sharing.. sharing the network with other devices.. and for all the while i'd had my pi set up with a ethercat IO blovck from beckhoff... and a switch.. and a Modbus over tcpip HMI (from kinco) and a cable coming to my laptop..

    so when i added the servo i just ran a cable from the backhoff to the drive..

    now turns out that you can do that.. but expecting it too work is foolish...

    so after taking support it was deemed that i needed to add the USB to ethernet adapter to seperate the two networks..

    which i did.. and on initial setup it looked like it was an easy solution ..

    then like everything you get into the weeds.. and then its not so simple.. but then it is when you know what you need to know..

    so ok.. the USB adapter was good.. but not that good.. (maybe better ones exist.. but this is not a USB adapter review)
    and it worked just by plugging it in.. boom...

    i set a fixed ipaddress in the /etc/dhcpcd.conf file..

    and it wasnt quite right.. so more chatting with support.. and more figuring out.. and it turned out i needed to only use the USB to ethernet adapter for the ethernet / modbus over tcpip traffic.. and the ethercat needed to go over the onboard adapter..

    all of this is configurable.. and you change the adapter allocation in the device settings for the ethercat / ethernet device.. but could i get it to work how i wanted.. no way... all very odd..
    i would get the onboard with one address and the usb adapter with the same address, and all in all i'd end up having to boot the pi with a monitor and keyboard and mod the config to allow programming again ...

    so anyway ..the config finally figured out.. i have the onboard adapter set to auto configure ip... and the USB to ethernet on a fixed ip.. that sorted it.. so i can have the usb to ethernet connected into the switch and allow the Modbus over tcpcip to work.. and the onboard is just for the ethercat devices.. (which have a little quirk in my case.. i cant have the ethercat loop through my servo... it needs to end at the servo.... now i know.. its ok.. but that took a bit of figuring out.. )

    now in the future i've got a few things i'm going to do different..

    1) use the Pi with the wifi adapter on board so i can always use a hotspot on my laptop as a way of programming..
    2) use a pi shield for ethercat.. https://www.sg-electronic-systems.com/ecommerce/15-ethernet-shield , ive not had it arrive yet.. so cant tell you if its good or not.. but it looks like it should be a big help..

    3) try and remember all the things that happend.. so it takes less time, next time..

    please message me if you anything you want to know..


    • Morberis

      Morberis - 2020-07-31

      Do you think that this was because of the speed of the usb-ethernet adapter, because usb 2 vs usb 3, or something else with the usb-ethernet adapter like latency etc?

      I look forward to hearing about your experience with the Etherberry V1.6.1. I've seen them for awhile but haven't wanted to pay for 1 just to play with it.

      For those watching from home here is a good rundown of the etherberry including an example project for Codesys.


      Last edit: Morberis 2020-07-31
      • eschwellinger

        eschwellinger - 2020-08-01

        Usually this is mit a problem, USB or internal Ethernet Interface.
        Both work like charm as long you do not mix up ethercat and other TCP/ip ethernet devices.
        For Softmotion the important thing is to have a realtime Patch rt_prempt Patch applied to your Linux kernel. ( Sure this is not needed for Softmotion light)
        This etherberry is as far as i know only for making a ethercat Slave on your Raspberry Pi


        Last edit: eschwellinger 2020-08-01
        • patrickrjbrown

          patrickrjbrown - 2020-08-01

          I just saw that the device was a slave... So indeed that might not help...

          I think I will upgrade the pi at some point, but I do worry a little about
          how the codesys runtime licence transfer works... So I want to test that


          On Sat, 1 Aug 2020, 05:50 eschwellinger, forge@codesys.com wrote:

          Usually this is mit a problem, USB or internal Ethernet Interface.
          Both work like charm as long you do mit mix up ethercat and other TCP/ip
          ethernet devices.
          Die Softmotion the important thing is to have a realtime Patch rt_prempt
          Patch applied to your Linux kernel.
          This etherberry is as far as i know only for making a ethercat Slave of
          your Raspberry Pi

          Omron R88D-KN08H-ETC with a raspberry on top... (over ethercat)

          Sent from forge.codesys.com because you indicated interest in

          To unsubscribe from further messages, please visit

          • Morberis

            Morberis - 2020-08-05

            For the future a codemeter dongle is super helpful when working with a Pi or Beaglebone.

            Would the EthernetBerry Dual V 1.1 be configurable as an Ethercat Master since it presents as a standard LAN interface? Hopefully in the same way that usb ethernet adapters do?

            The Pi4 might also have better performance using usb adapters since it has a dedicated USB hub chip that connects to the processor using dedicated PCIE lanes rather than the previous Pi's which have had a combo ethernet/usb hub chip. In addition to the USB 3.0 ports.

            I'm not sure if usb bandwidth is an issue with what you have now. If it helps here is what I was able to find on bandwidth.

            4Gbps - total possible usb bandwidth available on the Pi4
            1000Mbps(1Gbps) - Ethernet adapter speed on the Pi4
            300Mbps - Total combined USB/ethernet bandwidth on the Pi3
            40MBps - Possible max SDcard read/write speed, super unsourced.
            10Mbps - Ethernet Berry Dual - based on the documentation for the SPI ethernet chip used ENC28J60
            10/100Mbps - random Usb2.0 ethernet adapter
            10/100/1000Mbps - random usb 3.0 ethernet adapter

            So we can see that even if the Ethernet Dual v1.1 can function as an Ethercat master your available bandwidth is down quite a bit. It is however a 'cleaner' solution than usb dongles. Perhaps it would be fine for your other ethernet needs. Maybe using a usb-ethernet adapter for programming.


            Last edit: Morberis 2020-08-05
  • Morberis

    Morberis - 2020-08-28

    This is just some ethercat stuff that I've read which explains why the Etherberry can not be an Ethercat master.

    But supposedly an Ethercat Master doesn't need any special hardware but an Ethercat Slave needs an Ethercat ASIC which is why if you want to make a Raspberry Pi and Ethercat slave you need something like the Etherberry Dual.

    Source Under implementation Costs

    Doing some light reading it seems that the Etherberry 1.1 and 1.6 both use a chip with an integrated Ethercat Slave ASIC. The LAN9252. The LAN9252 is capable of 100Mbps but that might be limited by your SPI speed.

    Reading the eeprom documentation on the LAN9252 will disconnect from the Ethercat network if 32 RX errors occur. You also can't get access to the programming software from Beckhoff without having an Ethercat vendor ID.

    Edit: I also ran across another module that you could connect up that is capable of supporting real time communication using profinet, ethernet, and in a future update ethercat. The different between the 001 and 002 parts seems to be that from the manufacturer the 002 part is individually packaged while the 001 is shipped in cases that contain 30.

    Manual for that
    Manufacturers product page
    Purchase link

    Also important to note that while this module has been certified if you're selling devices that contain it I believe the device as a whole still needs certification. Having a certified module just makes that cheaper and easier. You also shouldn't be getting this information from me.


    Last edit: Morberis 2020-08-28
  • patrickrjbrown

    patrickrjbrown - 2020-10-06

    many many moons ago.. I started this... and I've been super busy on trying to get it sorted.. and thats led me down the path of getting to know what I'm doing.. and how things should work.. and well.. like always.. time goes by.. and things get pushed in front of other things.. but anyway .. I took a look at it today .. but using the code from a much better coder than me.. (his youtube channel is called "black" https://www.youtube.com/channel/UCeOa8aEiV8CdAO9dCp7PATA (this should be the link to the channel ) so I've tweeked a bit of the code and changed it to use the Omron drive and the drive gives feedback.. and it looks all ok... but... I'm getting the feedback that the drive is stopping.. when i try and enable it.. now maybe I'm not understanding the POU setup, or something.. but maybe if i post this.. if nothing else I might alert people to the Black channel, as its very very helpful in relation to codesys motion ..

    see a little project attached.. :-)

  • eschwellinger

    eschwellinger - 2020-10-07

    you need to use the Omron device not DS402 generic-
    please use the SoftMotion driver which come with the CODESYS setup.
    Just add it or select on scan (use the '...' - which driver you want to add. ( use not the proposed plain slave which comes from the installed Omron ESI file)


    Last edit: eschwellinger 2020-10-07
  • patrickrjbrown

    patrickrjbrown - 2020-10-08

    and as if by magic.. Eschwellinger has the answer..

    so ... from what i can tell its not as simple as just doing what i did.. which was do a scan on the ethercat bus, add it to the project, and then add a generic DS402 softmotion device..
    oh no...

    so .. i needed to pay attention to the icons.. there is one that looks like a grey computer box.. and when i searched down in the list i found one that matched the servo drive.. so if you do an "update device" to that.. you get grey computer box icon.. (which had always been a black funny looking Omron drive icon before) and underneath you get a icon i've not seen before.. which is a black thing and a little motor..

    so once i got them .. did a bit of renaming.. I was off and 2 the races...

    attached is the project..

    and if you find this helpful please go and visit the black channel on Youtube and subscribe.. as that was a big help.. as well as Eschwellinger..

    thanks to everyone..


  • patrickrjbrown

    patrickrjbrown - 2020-10-08

    now if i was smart.. i'd look at what i was doing when i started... so looking at the early pictures of the project you can see i'd actualy started with it right.. but managed to get it more wrong.. anyway .. i've just had a issue with the comms loosing sync.. so i might need to tweek the settings a bit, before its perfect..


  • patrickrjbrown

    patrickrjbrown - 2022-01-17

    some time later... (in the words of sponge bob)

    i'm back ... its all been sort of working.. and like all good projects that are 80% done.. you start using them ..... and thats been the case....

    so untill the shaft that connected the machine to the servo broke... it was all good...

    so now... here we are... and i'm not even sure if this is a good idea tagging this onto an existing thread... but does anyone have any more experience of using a Ethercat drive with a raspberry pi... as there is one little problem i'd like to solve...

    when the drive is enabled, it holds position.. and i have some code which looks to see if the operator applys torque to the handwheel and if so .. it disables the drive.... now many moons ago, i had a servo working where when you disabled the drive it would spin with almost zero friction.. the omron seems to have alot more,(as if the motor windings are all shorted together almost) now if you power down the servo amp, it spins nice.. so thats what i'm trying to address.... any ideas...


1 2 > >> (Page 1 of 2)

Log in to post a comment.