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.

CAN-BUS Problems (LaunchPad RM42x)

Other Parts Discussed in Thread: HALCOGEN

Hi,

I'm trying to get the CAN-bus up running on a Hercules development board (LaunchPad RM42x). I only want to transmit data via CAN1 to a Tranceiver.


For INIT in Halogen:

  a. CAN1 Driver is enabled in  Driver Enable

  b. CAN interrupt ISR is mapped correct in VIM RAM

  c.  Enabled CAN high or low INT in VIM channel 0-31 and 31-62

Code Composer Studio:

#include "sys_common.h"
#include "system.h"


/* USER CODE BEGIN (1) */
#include "can.h"
/* Include ESM header file - types, definitions and function declarations for system driver */
#include "esm.h"

#define  D_SIZE 1

uint8  tx_data[D_SIZE]  = {0x11};


/* USER CODE BEGIN (2) */
/* USER CODE END */

void main(void)
{
    /* initialize can 1 */
    canInit();

    /* transmit on can1 */
    canTransmit(canREG1, canMESSAGE_BOX1, tx_data);

    /* ... run forever */
    while(1);
/* USER CODE END */
}

/* USER CODE BEGIN (4) */
/* USER CODE END */

It seems like the data is never send from CAN1. I'am new in this forum and need help.

Best regards

Dennis

  • Hi,

    have you tried to run the example HALCoGen's Help -> Help Topics -> example_canCommunication (or if you want to use interrupts, example_canIntCommunication)?

    These two examples help you to get started with can, with step by step config in HALCoGen.

    You will need to wire up the two can busses of your launchpad to run these examples. I'm explaining a simple how-to here, using only a resistor, 2 diodes and some wire.

  • Hi Dennis,

     

    I agree with Jan. You should try the examples in HALCoGen to ramp up. I see the following possibilities could be the problem.

    1)      Message boxes are not configured correctly in the “CAN1” tab.

    2)      The CAN hardware is not connected to a bus which causes the CAN controllers to go to bus-off state (and stop transmitting)

     

    Try to make the HALCoGen example work first. Then you can build on it.

     

    Thanks and Regards,

    Vineeth

  • Hi,

    I haven' t tried the example, because it s emulates a data transfer from CAN1 to CAN2. I only want to transmit (tx) data via CAN1. The board is correctly configured in Halogen like the example (canCommunication)

    1. Enable CAN1 Driver and DCC Drive in tab Driver Enable.

    2. CAN1-Level in tab VIM Channel 0-31.

    3. Message Configuration in tab CAN Msg 1-8

    Board:

    PiN J10.25 from Board to oscilloscope

    PIN J2.1 (Ground) to  oscilloscope

    oscilloscope pic:

    Code:

    /* USER CODE BEGIN (0) */
    
    /* USER CODE END */
    
    /* Include Files */
    
    #include "sys_common.h"
    
    #include "system.h"
    
    /* USER CODE BEGIN (1) */
    
    #include "can.h"
    
    #include "esm.h"
    
    #include "sys_core.h"
    
    uint8 tx_data[8] = {0x11};
    
    uint8 *tx_ptr = &tx_data[0];
    
    void main(void)
    
    {
    
    canInit();
    
    canTransmit(canREG1, canMESSAGE_BOX1, tx_ptr);
    
    while(1);
    
    }

    Best regards

    Dennis