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.

TMS320F28388D: using CM core for CAN Communication

Part Number: TMS320F28388D
Other Parts Discussed in Thread: C2000WARE

Hi,

I am having issues while trying to use CM core for standard CAN communication. 

I am using example projects from C2000ware to verify functionality first. I know my setup is working fine because when I ran the example for external CAN transmit on C28x core, it worked fine and I can see CAN messages on my external CAN logger. 

I have modified CAN_ex3_transmit example from c2000ware library to only transmit on CAN A and ignoring receiving part as I don't have 2nd CAN transceiver with me. 

However, when I use CM core, I get ack error code (from CAN_ES register)

Are there any suggestions or tips that I should look for? 

Thanks! any help is apperciated.

Swapnil 

  • Hi Swapnil,

    We'll have our DCAN expert to look into this in detail but wanted to check one quick thing - By default CANx modules are assigned to CPU1 and you need to configure PALLOCATE register bit (refer "Table 3-43. PALLOCATE0 Register Field Descriptions" in TRM) to assign this IP to CM. This need to be done by CPU1 code only. Please if you are doing this already.

    Regards,

    Vivek Singh

  • Hi Vivek,

    Thank you for reply. 

    yes, I am doing that already. 

        //
        // Allocate Shared Peripheral CAN A to the CM Side.
        //
        SysCtl_disablePeripheral(SYSCTL_PERIPH_CLK_CANA);
        SysCtl_allocateSharedPeripheral(SYSCTL_PALLOCATE_CAN_A,0x1U);
        SysCtl_enablePeripheral(SYSCTL_PERIPH_CLK_CANA);
    

    I have also looked at the CmConfgRegs to verify it the bit is set for CAN_A peripheral. 

    Swapnil

  • Good. Thank you. Our Can expert will get back to you.

    Regards,

    Vivek Singh

  • Hi Swapnil,

    I am assuming that you used the CAN_ex3_transmit in the cm example folder.  I think what is missing is the configuration of the CAN pins.  If you look at the c28 example, you have these lines of code:

        //
        // Initialize GPIO and configure GPIO pins for CANTX/CANRX
        // on module A and B
        //
        Device_initGPIO();
        GPIO_setPinConfig(DEVICE_GPIO_CFG_CANRXA);
        GPIO_setPinConfig(DEVICE_GPIO_CFG_CANTXA);
        GPIO_setPinConfig(DEVICE_GPIO_CFG_CANRXB);
        GPIO_setPinConfig(DEVICE_GPIO_CFG_CANTXB);
    

    For whatever DCAN module you are using, can you run this code in c28 first to ensure that the CAN pins are mapped before running the transmit pattern in cm?

    Regards,

    Joseph

     

  • Hi Joseph, 

    Thank you for your response! 

    This is my setup code on C28X side. 

        //
        // Configuring the GPIOs for CAN A.
        //
        GPIO_setPinConfig(DEVICE_GPIO_CFG_CANRXA);
        GPIO_setPinConfig(DEVICE_GPIO_CFG_CANTXA);
    
        //
        // Allocate Shared Peripheral CAN A to the CM Side.
        //
        SysCtl_disablePeripheral(SYSCTL_PERIPH_CLK_CANA);
        SysCtl_allocateSharedPeripheral(SYSCTL_PALLOCATE_CAN_A,0x1U);
        SysCtl_enablePeripheral(SYSCTL_PERIPH_CLK_CANA);

    and my pinmux is configured as, 

    //
    // CANA
    //
    #define DEVICE_GPIO_PIN_CANTXA      4U  // GPIO number for CANTXA
    #define DEVICE_GPIO_PIN_CANRXA      5U  // GPIO number for CANRXA
    
    #define DEVICE_GPIO_CFG_CANRXA      GPIO_5_CANRXA  // "pinConfig" for CANA RX
    #define DEVICE_GPIO_CFG_CANTXA      GPIO_4_CANTXA  // "pinConfig" for CANA TX

    Swapnil

  • Hi Swapnil,

    Ok, looks like you have taken care of this in your code.  What external CAN logger do you use, PCAN?  Does the logger display the CAN frame that was last transmitted?  Just trying to understand if the error status in CAN_ES is a result of missing ACKnowledge signal.  If you use PCAN, I think it has a feature to send an ACK signal to the transmitting node.

     Regards,

    Joseph

  • Hi,

    I am using Kvaser Memorator PRo 2xHS v2 which has feature to send same ACK signal. 

    When I ran the only C28x version from the example codes, I had no problem seeing it on CANLab. 

    I have exported CAN register information with CAN running on C28x and on CM core. I have attached that if that helps. 

    CAN_register_info.xlsx

  • Hi Swapnil,

    Yes, the CAN register dumps would help a lot.  Unfortunately, I may have to try this out on my setup to see if I can duplicate what you are seeing.  I do not have immediate access to a F2838x setup because of the prevailing conditions but I can work this out and may take me a day.  In the meantime, I will go through the register dumps you sent and see if there is any outstanding issues I see on the CM dumps...

    Regards,

    Joseph

  • Hi Joesph,

    Thank you for your help. I look forward to hearing from you.

    Swapnil

  • Hi Swapnil,

    I had a chance to do a quick validation on my setup, however i do not have an access to an external CAN logger similar to what you are using.  On the C28 side, I  enabled the CAN GPIO pins using exactly what you have (GPIO5 for RX and GPIO4 for TX), assigned CANA to CM and on the CM side, I ran the can_ex3 example without the receive and ISR functions.  I have an access to a scope that is able to decode DCAN frames so that is what I am using to observe the signals in the CANTX pin and the CAN bus.

    I am able to observe the correct CAN frame on the TX pin as well as on the CAN bus.  CANA is set to 500Kbps and payload is set to 4 bytes as in the example.  Here is the scope capture of the can transmit code initiated from CM side:

    Not sure why your CAN logger is not able to detect the CAN frames that are initiated on the CM side.  Do you have an access to a scope to see if you can observe the signals coming out of the CAN pins?

    Regards,

    Joseph

  • Hi Joseph,

    Unfortunately I do not have access to the scope right now because of current situation. I will check with a scope as soon as I can get back to the office and get back to you.

    Thank you for your help again.

    Swapnil