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

CAN Problem unter CODESYS Control auf BeagleBone Black

2017-02-20
2023-10-20
  • Numerik KMS - 2017-02-20

    Mein CAN-Bus läuft mit Codesys nur dann, wenn ich die Codesys-Runtime nach jedem Boot des BBB in system.d stoppe und wieder neu starte.

    Wohlgemerkt, das CAN läuft selbst schon! Ich kann aus Linux direkt vom Board aus CAN ohne Probleme verwenden.

    Mit Codesys geht es aber nur nach dem stoppen und neustarten der RTE. Ansonsten wird in der IDE unter Devices der CAN-BUS (und ggf. CANopen Manager / CANopen Remote Devices) nur rot angezeigt.
    Dabei macht es keinen Unterschied, ob ich CANopen, oder nur Layer 2 benutzen möchte.

    Kennt jemand eine Lösung?


    SW / HW aktuell:
    BeagleBone Black Rev. C;
    letztes Debian-Image: Linux beaglebone 4.4.30-ti-r64 #1 SMP Fri Nov 4 21:23:33 UTC 2016 armv7l GNU/Linux
    CPUFreq Governor: “performance”
    Codesys Control: 3.5.10.0
    CAN-Cape: http://www.waveshare.com/rs485-can-cape.htm;
    UART: DCAN1 mit den Pins P9 pin24 (Rx) und P9 pin26 (Tx)


    cat /sys/devices/platform/bone_capemgr/slots
    0: PF---- -1
    1: PF---- -1
    2: PF---- -1
    3: PF---- -1
    4: P-O-L- 0 Override Board Name,00A0,Override Manuf,BB-UART2
    5: P-O-L- 1 Override Board Name,00A0,Override Manuf,BB-UART4
    6: P-O-L- 2 Override Board Name,00A0,Override Manuf,BB-CAN1

    dmesg | grep cape
    [ 0.000000] Kernel command line: console=ttyO0,115200n8
    bone_capemgr.enable_partno=BB-UART2,BB-UART4,BB-CAN1
    root=UUID=3b6d2281-86d0-4fd8-a5de-cd9b1e0fe941 ro rootfstype=ext4 rootwait
    coherent_pool=1M quiet cape_universal=enable
    [ 2.371933] bone_capemgr bone_capemgr: Baseboard: 'A335BNLT,00C0,2716BBBK2612'
    [ 2.371966] bone_capemgr bone_capemgr: compatible-baseboard=ti,beaglebone-black - #slots=4
    [ 2.410139] bone_capemgr bone_capemgr: slot #0: No cape found
    [ 2.454134] bone_capemgr bone_capemgr: slot #1: No cape found
    [ 2.498128] bone_capemgr bone_capemgr: slot #2: No cape found
    [ 2.542129] bone_capemgr bone_capemgr: slot #3: No cape found
    [ 2.547942] bone_capemgr bone_capemgr: enabled_partno PARTNO 'BB-UART2' VER 'N/A' PR '0'
    [ 2.547955] bone_capemgr bone_capemgr: slot #4: override
    [ 2.547969] bone_capemgr bone_capemgr: Using override eeprom data at slot 4
    [ 2.547984] bone_capemgr bone_capemgr: slot #4: 'Override Board Name,00A0,Override
    Manuf,BB-UART2'
    [ 2.548101] bone_capemgr bone_capemgr: enabled_partno PARTNO 'BB-UART4' VER 'N/A' PR '0'
    [ 2.548113] bone_capemgr bone_capemgr: slot #5: override
    [ 2.548123] bone_capemgr bone_capemgr: Using override eeprom data at slot 5
    [ 2.548137] bone_capemgr bone_capemgr: slot #5: 'Override Board Name,00A0,Override
    Manuf,BB-UART4'
    [ 2.548220] bone_capemgr bone_capemgr: enabled_partno PARTNO 'BB-CAN1' VER 'N/A' PR '0'
    [ 2.548231] bone_capemgr bone_capemgr: slot #6: override
    [ 2.548241] bone_capemgr bone_capemgr: Using override eeprom data at slot 6
    [ 2.548254] bone_capemgr bone_capemgr: slot #6: 'Override Board Name,00A0,Override
    Manuf,BB-CAN1'
    [ 2.548764] bone_capemgr bone_capemgr: initialized OK.
    [ 2.561109] bone_capemgr bone_capemgr: slot #4: dtbo 'BB-UART2-00A0.dtbo' loaded; overlay id
    #0
    [ 2.563326] bone_capemgr bone_capemgr: slot #5: dtbo 'BB-UART4-00A0.dtbo' loaded; overlay id
    #1
    [ 2.564299] bone_capemgr bone_capemgr: slot #6: dtbo 'BB-CAN1-00A0.dtbo' loaded; overlay id
    #2

    ifconfig
    can0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
    UP RUNNING NOARP MTU:16 Metric:1
    RX packets:0 errors:0 dropped:0 overruns:0 frame:0
    TX packets:4 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:10
    RX bytes:0 (0.0 B) TX bytes:16 (16.0 B)
    Interrupt:189
    [...]

     
  • eschwellinger

    eschwellinger - 2017-03-25

    Hi,

    bitte folgende Kernel-Module eintragen in „/etc/modules“:
    can
    can-dev
    can-raw
    c_can_platform

    Dann müsste das behoben sein.

    Grüße
    Edwin

     
  • oetti133 - 2017-04-11

    Bei mir das gleiche Problem, allerdings hilft auch das Hinzufügen der Kernel-Module nicht..

     
  • eschwellinger

    eschwellinger - 2017-04-15

    Hi,
    sollte schon gehen kannst du auch mal die Outputs posten von oben?
    dmesg | grep cape
    ifconfig
    lsmod
    damit man was sieht...?
    Grüße
    Edwin

     
  • cooly - 2017-05-01

    Hallo,
    ich bekomme mein can-bus nicht zum laufen. ich verwende das can cape von waveshare. Muß ich noch einen can-bus Treiber auf dem BBB installieren ? Auf dem BBB befindet sich DEBIAN 12.11.2015, in der Beschreibung des can cape bezieht sich alles auf Angstrom, muss ich Angstrom auf den BBB machen oder funktioniert das can cape auch mit Debian ? woher bekomme ich den Treiber für Debian und wie installiere ich diesen ? ich kenne mich nicht sonderlich in Linux aus.

     
  • eschwellinger

    eschwellinger - 2017-05-02

    Hi,
    das aktuelle Debian verwenden das es auf den BBB Seiten zum downloaden gibt,
    dann einloggen auf dem BBB per ssh und

    in folgender Datei:
    /boot/uEnv.txt
    cape_enable=bone_capemgr.enable_partno=BB-CAN1

    angeben das du diese Waveshare CANcape drauf hast.

    Dann mal neu booten und prüfen ob das caper erkannt wird:

    cat /sys/devices/platform/bone_capemgr/Slots
    da müsste dann folgendes kommen:
    0: PF---- -1
    1: PF---- -1
    2: PF---- -1
    3: PF---- -1
    4: P-O-L- 0 Override Board Name,00A0,Override Manuf,BB-CAN1

    folgende Kernel-Module in „/etc/modules“ eintragen:

    can
    can-dev
    can-raw
    c_can_platform

    (auch nach dieser Änderung booten)
    dann müsste es in CODESYS gehen!

    Grüße
    Edwin

     
  • cooly - 2017-05-05

    Hi

    kannst du mir sage wie ich die Kerner-Module eintragen kann?
    login as: debian
    Debian GNU/Linux 8

    BeagleBoard.org Debian Image 2017-03-19

    Support/FAQ: http://elinux.org/Beagleboard:BeagleBoneBlack_Debian

    default username:password is [debian:temppwd]

    e debian@192.168.2.103 e 's password:

    The programs included with the Debian GNU/Linux system are free software;
    the exact distribution terms for each program are described in the
    individual files in /usr/share/doc/*/copyright.

    Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
    permitted by applicable law.
    Last login: Fri May 5 13:55:00 2017 from 192.168.2.107
    debian@beaglebone:~$ su
    Password:
    root@beaglebone:/home/debian# cd
    root@beaglebone:~# dmesg |grep cape
    [ 0.000000] Kernel command line: console=ttyO0,115200n8 root=/dev/mmcblk0p1 ro rootfstype=ext4 rootwait coherent_pool=1M net.ifnames=0 quiet cape_universal=enable
    [ 2.355434] bone_capemgr bone_capemgr: Baseboard: 'A335BNLT,00C0,3516BBBK1B21'
    [ 2.355468] bone_capemgr bone_capemgr: compatible-baseboard=ti,beaglebone-black - #slots=4
    [ 2.394027] bone_capemgr bone_capemgr: slot #0: No cape found
    [ 2.434053] bone_capemgr bone_capemgr: slot #1: No cape found
    [ 2.474015] bone_capemgr bone_capemgr: slot #2: No cape found
    [ 2.514017] bone_capemgr bone_capemgr: slot #3: No cape found
    [ 2.514147] bone_capemgr bone_capemgr: initialized OK.
    [ 46.765169] bone_capemgr bone_capemgr: part_number 'cape-universaln', version 'N/A'
    [ 46.765213] bone_capemgr bone_capemgr: slot #4: override
    [ 46.765229] bone_capemgr bone_capemgr: Using override eeprom data at slot 4
    [ 46.765247] bone_capemgr bone_capemgr: slot #4: 'Override Board Name,00A0,Override Manuf,cape-universaln'
    [ 47.242085] gpio-of-helper ocp:cape-universal: Allocated GPIO id=0
    [ 47.242308] gpio-of-helper ocp:cape-universal: Allocated GPIO id=1
    [ 47.242474] gpio-of-helper ocp:cape-universal: Allocated GPIO id=2
    [ 47.242638] gpio-of-helper ocp:cape-universal: Allocated GPIO id=3
    [ 47.242798] gpio-of-helper ocp:cape-universal: Allocated GPIO id=4
    [ 47.262741] gpio-of-helper ocp:cape-universal: Allocated GPIO id=5
    [ 47.263025] gpio-of-helper ocp:cape-universal: Allocated GPIO id=6
    [ 47.263211] gpio-of-helper ocp:cape-universal: Allocated GPIO id=7
    [ 47.263380] gpio-of-helper ocp:cape-universal: Allocated GPIO id=8
    [ 47.263552] gpio-of-helper ocp:cape-universal: Allocated GPIO id=9
    [ 47.263713] gpio-of-helper ocp:cape-universal: Allocated GPIO id=10
    [ 47.263887] gpio-of-helper ocp:cape-universal: Allocated GPIO id=11
    [ 47.264052] gpio-of-helper ocp:cape-universal: Allocated GPIO id=12
    [ 47.264214] gpio-of-helper ocp:cape-universal: Allocated GPIO id=13
    [ 47.264383] gpio-of-helper ocp:cape-universal: Allocated GPIO id=14
    [ 47.264542] gpio-of-helper ocp:cape-universal: Allocated GPIO id=15
    [ 47.264704] gpio-of-helper ocp:cape-universal: Allocated GPIO id=16
    [ 47.264878] gpio-of-helper ocp:cape-universal: Allocated GPIO id=17
    [ 47.265044] gpio-of-helper ocp:cape-universal: Allocated GPIO id=18
    [ 47.265215] gpio-of-helper ocp:cape-universal: Allocated GPIO id=19
    [ 47.265378] gpio-of-helper ocp:cape-universal: Allocated GPIO id=20
    [ 47.265632] gpio-of-helper ocp:cape-universal: Allocated GPIO id=21
    [ 47.265815] gpio-of-helper ocp:cape-universal: Allocated GPIO id=22
    [ 47.265988] gpio-of-helper ocp:cape-universal: Allocated GPIO id=23
    [ 47.266155] gpio-of-helper ocp:cape-universal: Allocated GPIO id=24
    [ 47.266331] gpio-of-helper ocp:cape-universal: Allocated GPIO id=25
    [ 47.281622] gpio-of-helper ocp:cape-universal: Allocated GPIO id=26
    [ 47.281862] gpio-of-helper ocp:cape-universal: Allocated GPIO id=27
    [ 47.286404] gpio-of-helper ocp:cape-universal: Allocated GPIO id=28
    [ 47.286654] gpio-of-helper ocp:cape-universal: Allocated GPIO id=29
    [ 47.286849] gpio-of-helper ocp:cape-universal: Allocated GPIO id=30
    [ 47.287027] gpio-of-helper ocp:cape-universal: Allocated GPIO id=31
    [ 47.287206] gpio-of-helper ocp:cape-universal: Allocated GPIO id=32
    [ 47.287217] gpio-of-helper ocp:cape-universal: ready
    [ 47.435785] bone_capemgr bone_capemgr: slot #4: dtbo 'cape-universaln-00A0.dtbo' loaded; overlay id #0

    root@beaglebone:~# ifconfig
    eth0 Link encap:Ethernet HWaddr 04:a3:16:af:53:33
    inet addr:192.168.2.103 Bcast:192.168.2.255 Mask:255.255.255.0
    inet6 addr: 2003:d5:fbc0:f034:6a3:16ff:feaf:5333/64 Scope:Global
    inet6 addr: fe80::6a3:16ff:feaf:5333/64 Scope:Link
    inet6 addr: 2003:d5:fbc0:f08c:6a3:16ff:feaf:5333/64 Scope:Global
    UP BROADCAST RUNNING MULTICAST DYNAMIC MTU:1500 Metric:1
    RX packets:34548 errors:0 dropped:16720 overruns:0 frame:0
    TX packets:3657 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000
    RX bytes:14918236 (14.2 MiB) TX bytes:363989 (355.4 KiB)
    Interrupt:173

    lo Link encap:Local Loopback
    inet addr:127.0.0.1 Mask:255.0.0.0
    inet6 addr: ::1/128 Scope:Host
    UP LOOPBACK RUNNING MTU:65536 Metric:1
    RX packets:160 errors:0 dropped:0 overruns:0 frame:0
    TX packets:160 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1
    RX bytes:12960 (12.6 KiB) TX bytes:12960 (12.6 KiB)

    usb0 Link encap:Ethernet HWaddr 04:a3:16:af:53:35
    inet addr:192.168.7.2 Bcast:192.168.7.3 Mask:255.255.255.252
    UP BROADCAST MULTICAST MTU:1500 Metric:1
    RX packets:0 errors:0 dropped:0 overruns:0 frame:0
    TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000
    RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

    usb1 Link encap:Ethernet HWaddr 04:a3:16:af:53:38
    inet addr:192.168.6.2 Bcast:192.168.6.3 Mask:255.255.255.252
    UP BROADCAST MULTICAST MTU:1500 Metric:1
    RX packets:0 errors:0 dropped:0 overruns:0 frame:0
    TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000
    RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

    root@beaglebone:~# lsmod
    Module Size Used by
    c_can_platform 7581 0
    c_can 12220 1 c_can_platform
    can_dev 14358 1 c_can
    spi_omap2_mcspi 12952 0
    pwm_tiecap 4571 0
    snd_soc_hdmi_codec 6738 1
    snd_soc_simple_card 9812 0
    omap_sham 26513 0
    omap_aes_driver 23912 0
    omap_rng 5544 0
    rng_core 9066 1 omap_rng
    tilcdc 31597 0
    snd_soc_davinci_mcasp 20606 2
    snd_soc_edma 1290 1 snd_soc_davinci_mcasp
    snd_soc_omap 3762 1 snd_soc_davinci_mcasp
    snd_soc_core 190453 5 snd_soc_hdmi_codec,snd_soc_davinci_mcasp,snd_soc_edma,snd_soc_omap,snd_soc_simple_card
    snd_pcm_dmaengine 5894 2 snd_soc_core,snd_soc_omap
    snd_pcm 104314 5 snd_soc_hdmi_codec,snd_soc_davinci_mcasp,snd_soc_core,snd_soc_omap,snd_pcm_dmaengine
    snd_timer 24761 1 snd_pcm
    snd 72473 3 snd_soc_core,snd_timer,snd_pcm
    soundcore 8661 1 snd
    evdev 13511 2
    tda998x 15704 0
    uio_pdrv_genirq 3923 0
    uio 10524 1 uio_pdrv_genirq
    8021q 23043 0
    garp 7049 1 8021q
    mrp 8967 1 8021q
    stp 2430 1 garp
    llc 5903 2 stp,garp
    usb_f_mass_storage 49849 2
    usb_f_acm 8361 2
    u_serial 13753 3 usb_f_acm
    usb_f_ecm 11064 2
    usb_f_rndis 25865 2
    u_ether 14349 2 usb_f_ecm,usb_f_rndis
    libcomposite 53618 16 usb_f_acm,usb_f_ecm,usb_f_rndis,usb_f_mass_storage
    spidev 8860 0
    tieqep 9981 0
    pwm_tiehrpwm 5883 0
    pru_rproc 15431 0
    pruss_intc 8603 1 pru_rproc
    pruss 12026 1 pru_rproc
    root@beaglebone:~# /etc/moduls: c_can_platform
    bash: /etc/moduls:: No such file or directory

    Gruß
    Cooly

     
  • cooly - 2017-05-14

    Hi,

    ich komme einfach nicht weiter ich mein bbb erkennt nicht das waveshare can cape, kann mir jemand helfen

    login as: root
    Debian GNU/Linux 7

    BeagleBoard.org Debian Image 2015-11-12

    Support/FAQ: http://elinux.org/Beagleboard:BeagleBoneBlack_Debian

    default username:password is [debian:temppwd]

    Last login: Sun May 14 14:59:38 2017 from 192.168.2.107
    root@beaglebone:~# cat /sys/devices/platform/bone_capemgr/Slots
    cat: /sys/devices/platform/bone_capemgr/Slots: No such file or directory
    root@beaglebone:~#

    Gruß Jürgen

     
  • eschwellinger

    eschwellinger - 2017-05-14

    Hi,
    hast du in /boot/uEnv.txt folgene Zeile drin?
    cape_enable=bone_capemgr.enable_partno=BB-CAN1

    Grüße
    Edwin

     
  • cooly - 2017-05-14

    Hi,

    ja, habe ich :

    login as: root
    Debian GNU/Linux 7

    BeagleBoard.org Debian Image 2015-11-12

    Support/FAQ: http://elinux.org/Beagleboard:BeagleBoneBlack_Debian

    default username:password is [debian:temppwd]

    Last login: Sun May 14 16:13:38 2017 from 192.168.2.107
    root@beaglebone:~# nano /boot/uEnc.txt
    root@beaglebone:~# nano /boot/uEnv.txt
    GNU nano 2.2.6 File: /boot/uEnv.txt

    #cape_disable=capemgr.disable_partno=BB-BONELT-HDMI
    #cape_enable=capemgr.enable_partno=BB-BONE-AUDI-02

    ##enable Generic eMMC Flasher:
    ##make sure, these tools are installed: dosfstools rsync
    #cmdline=init=/opt/scripts/tools/eMMC/init-eMMC-flasher-v3.sh

    #cape_enable=bone_capemgr.enable_partno=BB-CAN1[/b]

    uuid=5fd4e745-0c4c-48d2-b64c-4ee64f8a7a3e

                               [ Read 63 lines ]
    

    ^G Get Help ^O WriteOut ^R Read File ^Y Prev Page ^K Cut Text ^C Cur Pos
    ^X Exit ^J Justify ^W Where Is ^V Next Page ^U UnCut Text^T To Spell

    habs mit # mit ## und ohne # schon eigetragen, funktioniert alles nicht

    Grüße cooly

     
  • cooly - 2017-05-18

    Hallo Edwin,

    ich glaube du bist der einzige der mir helfen will oder kann, ich habe das can cape in die uEnv.txt eingetragen wir du mir es geschrieben hast:

    root@beaglebone:~# cat /sys/devices/platform/bone_capemgr/slots
    0: PF---- -1
    1: PF---- -1
    2: PF---- -1
    3: PF---- -1
    4: P-O-L- 0 Override Board Name,00A0,Override Manuf,cape-universaln
    root@beaglebone:~#

    der Port4 sieht anders aus wie bei dir, ich vermute bbb erkennt nicht mein can-cape, müsste doch
    BB-CAN1 stehen, oder?
    Ich bekomme einfach mein CAN nicht zum laufen. Kannst du mir bitte nochmal helfen

    Grüße cooly

     

Log in to post a comment.