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

CANBUS PDO I/O Mapping problem

bmunsil
2016-11-15
2017-02-10
  • bmunsil - 2016-11-15

    Raspberry Pi 2 B
    Codesys V3.5 SP6 Patch 4+
    PiCAN V2

    I am having a problem with some PDO mappings to a Beckhoff (BK5120) Remote I/O. It is currently configured with a KL3162 (2x analog input), KL1862 (16 digital input), KL2872 (16 digital output) cards. I am having a problem getting the PDO setup correctly to make the IO functional. With my current configuration only 8 of the digital inputs, 8 of the digital outputs work, the analog is not functioning. When I check the CANopen I/O Mapping tab all of the nonworking digital I/O are greyed out but the analog I/O shows as if it should work but its state never changes. I know that everything actually works it just doesn't respond in Codesys. I have the KS2000 Beckhoff software for monitoring the unit directly form the port on the BK5120 bus coupler. I can apply a AA battery to the analog input and see analog levels get measured correctly.

    Please let me know if anyone can help me understand what I am doing wrong. I have tried multiple configurations including making sure the PDO is full, but I am open to ANY suggestions as this is for my own personal learning.

    IMG: PiCAN_PDO_configuration.JPG

     
  • eschwellinger

    eschwellinger - 2016-11-15

    Hi,
    i have two remarks:
    1.For these analog terminals do you enable the Interrupt Register (by SDO) otherwise no values come out of these terminals.
    2. CODESYS only update the values if they are mapped and used in the POU's.

    BR
    Edwin

     
  • bmunsil - 2016-11-15

    Edwin Schwellinger hat geschrieben:
    Hi,
    i have two remarks:
    1.For these analog terminals do you enable the Interrupt Register (by SDO) otherwise no values come out of these terminals.
    2. CODESYS only update the values if they are mapped and used in the POU's.
    BR
    Edwin

    yes they are mapped and used. the analog signals show up as if they are ready but they never update. I did have this working at one point but I lost my configuration and have not been able to recreate what worked. as for the interrupt register, I have nothing but default set.

    UPDATE: ok I apparently didn't have the higher 8 inputs and outputs being used. they are now working. the analog is still not functioning. thank you for your time.

     
  • eschwellinger

    eschwellinger - 2016-11-16

    Hi,
    I would add the global analogue Interrupt Register to the Startup SDO list,
    See screenshot.
    BR
    Edwin

    IMG: globalAnalogInterruptEnable.jpg

     
  • bmunsil - 2016-11-16

    thanks for the quick reply. adding the Analogue Input global interrupt enable worked. I have one question, do you need to set an index for each of the analog inputs? or will this handle all of the analog inputs? I apologize for my lack of knowledge on PDO/SDO, I am using Codesys as my learning platform.

     
  • eschwellinger

    eschwellinger - 2016-11-16

    Hi,
    which index do you mean.
    You need to add a mapping and use the varibales in the POU's.

    BR
    Edwin

    IMG: Mapping.jpg

     
  • bmunsil - 2016-11-16

    Edwin Schwellinger hat geschrieben:
    Hi,
    which index do you mean.
    You need to add a mapping and use the varibales in the POU's.
    BR
    Edwin

    no, I answered my own question. I wasn't sure if I needed to set an SDO analog interrupt for each of the analog inputs or not but after some testing I know that I do not. Thanks for your time. Everything is working as expected.

     
  • lemaitre - 2016-12-07

    Hello bmunsil,

    Seeing project is the same as me regarding CAN.
    RPI3+PICAN.

    Can you help me to start CAN on my project.

    thks

     
  • bmunsil - 2017-01-06

    I am currently using a Rpi2 + PiCan I would more than welcome helping you get started. to be honest there is a really good post that explains the methods that are used to get socket can compiled into the kernel. I do have an image of a working version that I would be willing to send you if you so choose.

     
  • jmrodriguez - 2017-01-10

    bmunsil hat geschrieben:
    I am currently using a Rpi2 + PiCan I would more than welcome helping you get started. to be honest there is a really good post that explains the methods that are used to get socket can compiled into the kernel. I do have an image of a working version that I would be willing to send you if you so choose.

    Hello bmunsil.

    I'm trying to have communication CAN between Codesys and my Raspberry Pi 3 with the instruction of this forum l viewtopic.php?t=5611 l but at the end my Can doesn't work. I think it could be because when I use the instruction 'modprobe spi-config...' it says “modprobe:FATAL: Module spi-config not found”.

    Could you help me please?

    CAN PROBLEM.pdf [151.24 KiB]

     
  • bmunsil - 2017-02-01

    jmrodriguez hat geschrieben:
    Hello bmunsil.
    I'm trying to have communication CAN between Codesys and my Raspberry Pi 3 with the instruction of this forum l viewtopic.php?t=5611 l but at the end my Can doesn't work. I think it could be because when I use the instruction 'modprobe spi-config...' it says “modprobe:FATAL: Module spi-config not found”.
    Could you help me please?

    could you extract and make an image out of what you are using? I would be able to better help if I can see what and how you have it configured.

     
  • jmrodriguez - 2017-02-10

    bmunsil hat geschrieben:
    could you extract and make an image out of what you are using? I would be able to better help if I can see what and how you have it configured.

    Hi bmunsil.

    The problem is solved now, it was because of the kernel version.

    Thank you so much.
    Best regards.

     

Log in to post a comment.