daviddein Posted December 18, 2020 Posted December 18, 2020 Hey, So I am working with a CK3E running the Ethercat Acontis Stack, and I am trying to get my EK1100 with a EL1252 I/O slice data to be mapped correctly to the proper IOBuffer and IO.Data register so I can use it in my user program. As a specific example, PowerPMAC IDE maps my ethercat slave, and I have PDO's with data representing the status of the input (single bit) and the latched time events when the input goes high or low (64 bit ns time). I will focus in on the negative latch time PDO for input 2. From the ECATConfig.cfg file -------------------------------------------------- ECAT[0].IO[4103].BitLength=64 ECAT[0].IO[4103].Data=24 ECAT[0].IO[4103].Index=7433 ECAT[0].IO[4103].SubIndex=200 ECAT[0].IO[4103].Input=1 ECAT[0].IO[4103].Offset=43 ECAT[0].IO[4103].BitPosition=0 ECAT[0].IO[4103].Slave=1 From the ECATMap.pmh file -------------------------------------------------- #define Slave_1002_EL1252_1005_1D09_200_LatchNeg2 (x) ECAT[0].IOBuffer[24 + x] Initially, everything works when I right click on my Ethercat master -> Load Mapping to Power PMAC. ECAT[0].IO[4100].Data and then go view the cyclic PDO in "Watch Ethercat Mapped Variables". I download and save all program files, save, and then reset the controller. However, after a reset, my mapped variables no longer updates to a correct value, its just zero as if no data is being pumped into IOBuffer. Inspecting the manual, IOBuffer uses ECAT[x].IO[x].Data as a storage variable for the offset when looking for the start address of any data bigger than 32 bits. Reading ECAT[0].IO[4103].Data, the value is 0 which is wrong according to ECATConfig.cfg, it should be 24. Setting ECAT[0].IO[4103].Data=24, and ECAT[0].IOBuffer[24 + x] now returns the correct data (reverse ordered, but that is a separate issue than the current one). What I can't understand is why .data is not sticking to 24 and is being set to zero after a power cycle; and I am wondering if it possible to re-upload ECATConfig.cfg after a power cycle or reset? Any help is greatly appreciated, Regards, David
tecnico Posted December 18, 2020 Posted December 18, 2020 Hi, I got the very same problem with a Sick ECAT gateway that used IObuffer structure This is the answer from Brad @ DTCH that saved my day (and maybe yours) The file EcatConfig.cfg which is inside the configuration folder of the project contains the correct settings. When you build and download this file is also sent to the Pmac and pmac is properly configured. Ecat[].IO[].Data structures are not part of the saved data. So even if you save these values will not be put into pp_save.cfg. At $$$ it seems that EcatConfig.cfg is not loaded to the Pmac and the data is not in pp_save.cfg either. So all the offsets to the Ecat[].IOBuffer seem to get lost. I am surprised anything was working in the IOBuffer after this. As a quick test and hopefully fix I suggest you try the following. And a new .pmh file to the project. Copy the contents of EcatConfig.cfg into this new file. Now download and save and reset and verify the settings are correct and then hopefully it will also work. Hope this will help Andrea
daviddein Posted December 21, 2020 Author Posted December 21, 2020 As a quick test and hopefully fix I suggest you try the following. And a new .pmh file to the project. Copy the contents of EcatConfig.cfg into this new file. Now download and save and reset and verify the settings are correct and then hopefully it will also work. Andrea, I copied the contents of ECATConfig.cfg into ECATMap.pmh and it worked like a charm! Thank you! I just need to add it to my process now, so that I don't forget. Regards, David EDIT: As an added note, the modification to the *.pmh works just fine, however I encountered an error on the first ECAT[].IO[] definition when attempting to upload. De-activating ethercat network, and then uploading solves this problem. It appears that writing some ECAT[] params while the bus is active is not permissible.
Omron Forums Support Posted December 23, 2020 Posted December 23, 2020 Because ECAT[0].IO[4103].Data is not a saved variable, it is set to 0 when PMAC powers up. Since it's an output that means if no actions are taken PMAC will repeatedly send a value of 0. The easiest way to solve this problem is to set the value in a header file. I am referring to the files in the "Global Includes" folder that have a .pmh extension. These files are ran during the $$$/boot process. They are run after saved variable values are loaded so I like to say they "win" during startup.
Recommended Posts