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.

TMS320F28335: CAN module not working - multiple questions

Part Number: TMS320F28335

Hi all, TI,

Posted a question about SCI a while ago and got very useful response! So here I am again after multiple days of struggling with the CAN module on our custom board with a TMS320F28335. I can not get the example code (ecan_a_to_b_xmit) to work. Some outlines:

- Custom board with proper termination and the TJA1040 CAN transceiver

- Other node in the network is just a Arduino with CAN shield for now

- This Arduino CAN shield is working fine at different baudrates (used with other CAN networks perfectly, including an NXP chip MCP5744 and motorcycle AIM dashlogger)

- The Arduino does not filter for receiver ID, so all messages will be shown on a serial monitor.

Questions thus far:

- What is the CAN clock frequency? The PDF (spru074f) states either 150 MHz or 100 MHz, but if it is linked to the standard peripheral clock (like SCI is), then 150 MHz would never be possible, and I will be running at 75 MHz peripheral clock

- Table 3-1 in the same PDF (spru074f): what exactly says the CAN Module clock column?

- Are there any known issues using the example code? Problem: it hangs at the while loop waiting for an acknowledge (the other node, Arduino in this case, should send the acknowledge; am I right?). Removing the while loop does not help. I see no activity at the CAN bus at all using an oscilloscope. After InitECan() the voltage difference between CAN-high and CAN-low moves to 3.3V.

I appreciate any input! Any suggestions what steps to take? Thanks in advance :)

  • Quick addition regarding the CAN clock, the BTC timing registers and the Baudrate:
    - The example code used to following values:
    * ECanaShadow.CANBTC.bit.BRPREG = 4;
    * ECanaShadow.CANBTC.bit.TSEG2REG = 2;
    * ECanaShadow.CANBTC.bit.TSEG1REG = 10;

    - Using table 3-1 in spru074f, this would result in a very high baudrate. So I adjusted BRPREG to 9 and 19 (tried both), to no effect. Seems like the values of the example code do not add up. Am I right?
  • Have you tried the self-test example (ecan_back2back)? This does not need the presence of any external CAN node.

     

    There is also a simple transmit example in my app.note (SPRA876) that you could download from www.ti.com. You could check for activity on the CANTX pin by running this code. This will be useful to verify if the bit-rate is correct based on the SYSCLKOUT frequency.

     

    You say that "Other node in the network is just a Arduino with CAN shield for now", but you have not mentioned if CAN-A & CAN-B are connected to each other, which is important for the example code to work. If the Arduino is configured for the correct bit-rate, I agree it should send the ACK.

     

    On this device, the CAN clock frequency is SYSCLKOUT/2. So, if you are running the device at 150 MHz, the CAN clock frequency is 75 MHz. Please see Fig 6-29 on page 173 of SPRS439N. For F28335, you should be using SPRUEU1, not SPRU074F. Table 3-1 of SPRU074F refers to the TMS320F281x device, where the CAN clock is the same as SYSCLKOUT. Please refer to Table 3-1 in SPRUEU1, which gives the parameters for 75 MHz CAN clock.

     

    There are no known issues with the example code. It should work "as is". Ditto with the example codes in my app.note. The only condition (for codes other than the ones that use the self-test mode) is that there is at least one another node to provide the ACK. If CAN-B and CAN-A are connected with each other, this is automatically taken care of. In your case, you have to ensure Arduino is properly configured.

     

    You mention you see no activity on the CAN bus, which is puzzling. Even if ACK is not coming from the other node, you must see repeated transmits from CAN-A. Would you be willing to share the CAN portion of your schematics? You could send it to me privately.

     

    The CANBTC values used in the example is correct

     

    75 MHz/[(4+1) * (2+10+3)] = 75 MHz/(5 * 15) = 1 Mbps. Do not change those values.

  • Hi Hareesh,

    Thank you very much for your extensive reply! I spend another 1,5 day puzzling with your TX transmit loop on our board and the development board. Having the correct eCAN pdf is very helpful, thank you for noticing that!

    What turned out to be the problem: our CAN module is located on the HV side of out PCB, with an isolation barrier in between. The power supply in the HV area was apparently not working properly. This also influenced the signal on the TX line, which was pulled high all the time. But I am very happy that the example code now works perfectly for our board!

    Thank you for your time and response.

    Jeroen

  • Jeroen,

         Glad the problem got resolved. And thank you for closing the post promptly.