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.

LAUNCHXL-F28377S CAN Communication Examples

Other Parts Discussed in Thread: CONTROLSUITE

Dear All,

I have the LAUNCHXL-F28377S and tried unsuccessfully to get the CAN loopback and CAN loopback with interrupts examples (from ControlSuite) working. 

The first thing I noticed was the pins in the code reference GPIO 30 (CAN Rx_A) / GPIO 31 (CAN Tx_A), but according to the electrical schematic they should be GPIO 70 / GPIO 71 respectively. 

I tried both cases, connected to Canalyzer and nothing. I don't have a scope but I checked with a DVM and there was no activity on the J12 CAN_H and CAN_L pins.

Has anyone else been able to get this working?  Are there any more discrepancies?  Is there another example I should use?

Thank you for your help,

Thomas B.

  • Thomas,

    The controlSUITE examples are generic examples for the F28377S. They're not specifically written for the LAUNCHXL. (That being said, we probably should have used GPIO70 and GPIO71 for those examples.)

    In the example's GPIO setup code, you need to change both the GPIO number and the mux channel. The code should look like this:

    // Step 2. Initialize GPIO:
    // This example function is found in the F2837xS_Gpio.c file and
    // illustrates how to set the GPIO to its default state.
    InitGpio();
    //GPIO70 - CANRXA
    GPIO_SetupPinMux(70, GPIO_MUX_CPU1, 5);
    //GPIO71 - CANTXA
    GPIO_SetupPinMux(71, GPIO_MUX_CPU1, 5);
    GPIO_SetupPinOptions(70, GPIO_INPUT, GPIO_ASYNC);
    GPIO_SetupPinOptions(71, GPIO_OUTPUT, GPIO_PUSHPULL);

    Please let me know if that works for you.

    Thanks,
  • Hi Adam,

    Thank you for your reply.

    I went back to the original ControlSuite file and then modified the code with the described GPIO and mux changes. The results are as follows...

    1) Internal loopback test

    The CanMessageSet and CanMessageGet routines don't seem to be passing the data properly. The comparison if((*(unsigned long *)ucTXMsgData) != (*(unsigned long *)ucRXMsgData)) never fails because the data is empty.

    2) Canalyzer test

    After attempting the above, I disabled the following lines:

    // Enable test mode and select external loopback

    // HWREG(CANA_BASE + CAN_O_CTL) |= CAN_CTL_TEST;

    // HWREG(CANA_BASE + CAN_O_TEST) = CAN_TEST_EXL;

    which resuled in partial success because it was then possible to transmit and receive messages to an external CAN transceiver without error frames. However, the baud rate had to be reduced to 250kbps (should be 500kpbs) and the delay time calculated by

    // Now wait 1 second before continuing

    DELAY_US(1000*1000);

    results in 2 seconds (measured), so I think there is still something not right with clocking.

    Thank you very much for your support, I appreciate your help.

    TB.

  • Thomas,

    The example code calls InitSysCtrl(), which sets up the PLL for a 200 MHz system clock assuming a 20 MHz crystal. If you don't have a 20 MHz crystal, you'll need to use different initialization code. Try modifying the call to InitSysPll() in InitSysCtrl().

    Not sure what's going on with external loopback. Please let me know if you're still having trouble after you fix the clocking.
  • Hi Adam,

    Just wanted to check in with you regarding the PLL initialisation.

    Since we are running at 200MHz, internal oscillators are not recommended, so the clock source has to be "crystal oscillator". In the F28377s example, the oscillator frequency is 10MHz, which means that IMult needs to be increased to 40 to match the CPU frequency. Is this correct? I tried this setting and it produced CAN messages at 500kbps with no errors, at accurate timing.

    In addition, the internal loopback function works fine, it was my variable watch which was not set up properly.

    Thank you very much for your help,

    TB
  • Sure, that works. 10 MHz * 40 = 400 MHz, which is within the 110 - 550 MHz range for the PLL VCO. A /2 SYSCLK divider will then give the 200 MHz frequency you want. Section 2.7.6 of the F2837xS TRM has more details on clock configuration if you need it.