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.

DCAN Tx Pin always high

Hi All,

What needs to be done to get data out on DCAN Tx Pin?

1. DCAN starterware code is used in uboot.

2. Used CRO to monitor Tx pin.

3. Used loopback mode, noticed Tx pin high.

But able to receive the data back.

4. Also tried normal mode, same response, Tx Pin high.

5. Pin mux used,

 {OFFSET(uart1_rtsn), (MODE(2) | PULLUP_EN | RXACTIVE)}, /* DCAN0_RXD */
 {OFFSET(uart1_ctsn), (MODE(2) | PULLUDEN)},             /* DCAN0_TXD */
 {OFFSET(mcasp0_ahclkr), (MODE(7) | PULLUP_EN)},         /* CANI_WAKE */
 {OFFSET(mcasp0_ahclkx), (MODE(7) | PULLUP_EN)},         /* CANI_EN */
 {-1},

6. Also for transceiver,

 #define CANI_WAKE_GPIO_EN       113
#define CANI_EN_GPIO_EN         117
        /*CAN*/
        gpio_request(CANI_WAKE_GPIO_EN, "cani_wake_en");
        gpio_direction_output(CANI_WAKE_GPIO_EN, 1);
        gpio_set_value(CANI_WAKE_GPIO_EN, 1);

        gpio_request(CANI_EN_GPIO_EN, "cani_en");
        gpio_direction_output(CANI_EN_GPIO_EN, 1);
        gpio_set_value(CANI_EN_GPIO_EN, 1);

Regards,

Gangadhar

  • Hi Gangadhar,

    Have you verified that the StarterWare code works correctly for your board?

    Best regards,
    Miroslav

  • Hi Miroslav,

    Using DCAN0. DCAN0 clock is enabled by function  DCANModuleClkConfig(). Probing done at processor pin.

    1. Loopback,

    a. on board with transceiver and tristate device(b/w processor and transceiver) removed , able to see some transactions on Tx pin using CRO.

    b.on board with transceiver and tristate device present, Tx pin is always high.


    To start the transaction these statements are used,

    /* Start the CAN transfer */
        DCANNormalModeSet(SOC_DCAN_0_REGS);
        DCANTestModeControl(SOC_DCAN_0_REGS, DCAN_TEST_MODE_ENABLE);
        DCANTestModesEnable(SOC_DCAN_0_REGS, DCAN_TST_LPBCK_MD );

    2. Normal mode,

    DCANNormalModeSet(SOC_DCAN_0_REGS);


     /* Enable the error interrupts */
        DCANIntEnable(SOC_DCAN_0_REGS, DCAN_ERROR_INT);


     /* Enable the interrupt line 0 of DCAN module */
     DCANIntLineEnable(SOC_DCAN_0_REGS, DCAN_INT_LINE0);

    a. on board with tristate devices and transceiver removed.

    TX - Some transaction noticed but with below error,

    Atleast one of the error counters have reached the error warning limit
    Atleast one of the error counters have reached the error warning limit
    **DCAN is in Bus-off state**

    b. on board with tristate devices and transceiver

    TX pin always high and no bus-off error.

    Regards,
    Gangadhar

  • Gangadhar,

    Per the AM335x TRM, you need to clear theGPIO_OE reg bit to configure the corresponding GPIO pin as output.

    You should try changing your code as follows:

    From: gpio_direction_output(CANI_WAKE_GPIO_EN, 1);

    To: gpio_direction_output(CANI_WAKE_GPIO_EN, 0);

     

    From: gpio_direction_output(CANI_EN_GPIO_EN, 1);

    To: gpio_direction_output(CANI_EN_GPIO_EN, 0);

    Regards,
    Mark

  • Miroslav,


    Also tried connecting two boards(CANH - CANH, CANL - CANL, GND-GND). Normal wires were used. Data was transmitted from one board and at the other board inside a loop
    DCANIsr0(); was used to receive data. No data was received at other end.

    Regards,

    Gangadhar

  • Got normal mode working by driving STRB pin of transceiver high.

    Regards,

    Gangadhar