This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Accessing D_CAN on Beaglebone

Hello

I'm trying to access the D_CAN registers on the Beaglebone running Linux 3.8.13. I think I have all done right but the first time accessing the CAN1 registers at  CAN1_BASE_ADDR    0x481D0000 results in:

Feb 22 00:00:17 beaglebone kernel: can4linux:  0x481d0000 remapped to 0xfa1d0000
Feb 22 00:00:17 beaglebone kernel: can4linux: Can[1]: - : out can_vendor_init()
Feb 22 00:00:17 beaglebone kernel: can4linux: Cin: (fa1d0000)
Feb 22 00:00:17 beaglebone kernel: Unhandled fault: external abort on non-linefetch (0x1028) at 0xfa1d0000
Feb 22 00:00:17 beaglebone kernel: Internal error: : 1028 [#1] SMP THUMB2

After searching a while I found that it could be that not all clocks are enabled. Can someone please point me how I can enable the CAN module clocks. What are the clocks I have to enable and how?

Thanks

   Heinz

  • Hi Heinz,

    After searching a while I found that it could be that not all clocks are enabled. Can someone please point me how I can enable the CAN module clocks. What are the clocks I have to enable and how?

    You can find all the module clock definitions & declarations at    arch/arm/mach-omap2/clock3xxx_data.c

    Please refer the following TI wiki links for enabling D_CAN driver in linux kernel with debugging.

    http://e2e.ti.com/cfs-file.ashx/__key/telligent-evolution-components-attachments/00-791-01-00-00-83-15-24/d_5F00_can_5F00_on_5F00_Beaglebone.pptx

    http://processors.wiki.ti.com/index.php/AM335X_DCAN_Driver_Guide

     

  • Titusrathinaraj Stalin said:

    You can find all the module clock definitions & declarations at    arch/arm/mach-omap2/clock3xxx_data.c

    Please refer the following TI wiki links for enabling D_CAN driver in linux kernel with debugging.

    http://e2e.ti.com/cfs-file.ashx/__key/telligent-evolution-components-attachments/00-791-01-00-00-83-15-24/d_5F00_can_5F00_on_5F00_Beaglebone.pptx

    http://processors.wiki.ti.com/index.php/AM335X_DCAN_Driver_Guide

    Thanks,

     arch/arm/mach-omap2/clock3xxx_data.c seems to be
    arch/arm/mach-omap2/ccock3xxx_data.c in may case, the Beaglebone Black and kernel 3.8.

    The number of clocks defined in this file confuses me. I can not see which one is related to the DCAN module.
    There is only:

       CLK(NULL,    "hecc_ck",    &hecc_ck,    CK_AM35XX),
    But the 335 has DCAN and not HECC.

    The other documents describe the SocketCAN driver and it's initialization. Thats a level above what I like to do, getting CAN working with the can4linux driver.

    It would help getting some lines of code showing what a kernel module has to doe to get access to the CAN registers. May be thats only three to 4 calls. But I'm not able to get it correct and hope someone else can help. Hopefilly with some lines of code.

    Thanks

     Heinz

     

     

  • Hi Heinz,

    Heinz said:

     arch/arm/mach-omap2/clock3xxx_data.c seems to be
    arch/arm/mach-omap2/ccock3xxx_data.c in may case, the Beaglebone Black and kernel 3.8.

    Sorry for the mis-interpretation,

    1) Please refer the below location for your clock declarations, 

    arch/arm/mach-omap2/clock33xx_data.c

        CLK("d_can.0",    "fck",            &dcan0_fck,    CK_AM33XX),
        CLK("d_can.1",    "fck",            &dcan1_fck,    CK_AM33XX),
        CLK("d_can.0",    "ick",            &dcan0_ick,    CK_AM33XX),
        CLK("d_can.1",    "ick",            &dcan1_ick,    CK_AM33XX),

    2) D_CAN pinmuxing done at board file at "arch/arm/mach-omap2/board-am335xevm.c"

    static struct pinmux_config d_can_gp_pin_mux[] = {
        {"uart0_ctsn.d_can1_tx", OMAP_MUX_MODE2 | AM33XX_PULL_ENBL},
        {"uart0_rtsn.d_can1_rx", OMAP_MUX_MODE2 | AM33XX_PIN_INPUT_PULLUP},
        {NULL, 0},
    };

    static struct pinmux_config d_can_ia_pin_mux[] = {
        {"uart0_rxd.d_can0_tx", OMAP_MUX_MODE2 | AM33XX_PULL_ENBL},
        {"uart0_txd.d_can0_rx", OMAP_MUX_MODE2 | AM33XX_PIN_INPUT_PULLUP},
        {NULL, 0},
    };

    3) You can see the pin mux entry for AM33xx (for 8 types of modes) at at "arch/arm/mach-omap2/mux33xx.c" ,

        _AM33XX_MUXENTRY(UART0_CTSN, 0,
            "uart0_ctsn", NULL, "d_can1_tx", "i2c1_sda",
            "spi1_d0", NULL, NULL, "gpio1_8"),
        _AM33XX_MUXENTRY(UART0_RTSN, 0,
            "uart0_rtsn", NULL, "d_can1_rx", "i2c1_scl",
            "spi1_d1", "spi1_cs0", NULL, "gpio1_9"),
        _AM33XX_MUXENTRY(UART0_RXD, 0,
            "uart0_rxd", "spi1_cs0", "d_can0_tx", "i2c2_sda",
            NULL, NULL, NULL, "gpio1_10"),
        _AM33XX_MUXENTRY(UART0_TXD, 0,
            "uart0_txd", "spi1_cs1", "d_can0_rx", "i2c2_scl",
            NULL, NULL, NULL, "gpio1_11"),

    Q1) Which SDK version are you using ?

    TI provided ?

    As per the TI release, kernel version should be linux_v3.2.

    Download AM335x SDK from following link for beagle bone black(AM335x) .

    http://software-dl.ti.com/sitara_linux/esd/AM335xSDK/latest/index_FDS.html

    http://www.ti.com/tool/linuxezsdk-sitara

    http://www.elinux.org/Beagleboard:BeagleBoneBlack#TI_EZSDK

    http://www.elinux.org/Beagleboard:3.2_SDK_On_BeagleBone_Black

  • Titusrathinaraj

    I'm working with the 3.8 kernel with a patch for The BBB applied.
    I don't know where to search but can not find the clock definitions you have mentioned

    File arch/arm/mach-omap2/clock33xx_data.c is not in place. instead I have
    kernel/arch/arm/mach-omap2/cclock33xx_data.c

     * AM33XX Clock data
     *
     * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
     * Vaibhav Hiremath <hvaibhav@ti.com>
     ....
    Interestingly SocketCAN compiles and works.

     Heinz

  • Hello,

    I have a similar problem  with non-linefetch unhandled faults:

    Unhandled fault: external abort on non-linefetch (0x1028) at 0xfa1d0008

    But in my case the problem is quite undetermined, we have a custom hardware based on the BBB and on one prototypes we face this problems with a certain probability. We use the CAN as socket CAN. and what I am seeing is the following:

    1) The kernel is booting, during driver probing the CAN driver is accessing a CAN register without problems

    2) Before the CAN driver is configured via canconfig "something" (I guess a socket daemon) is addressing the CAN hardware to read a CAN hardware register.

    3) This operation could lead in seldom, undetermined cases to the above mentioned kernel crash.

    4) When I suppress the first access to the CAN register the problem is gone. 

    So my best guess is also the clock configuration of the CAN hardware module. But I am very confused why this problem is only occurring during bootup and not in normal CAN operation mode.

    best

    Matthias