AnsweredAssumed Answered

TWR-K40D100M / TWR-SER FlexCAN issues

Question asked by Efren Cabebe on Sep 28, 2016



I've been having some trouble with sending out a CAN message from the TWR-SER board using the TWR-K40100M module on an actual CAN network (not in loopback mode).


Kinetis Design Studio 3.2.0

Processor Expert

CAN_LDD bean




I am trying to achieve a successful CAN message transmission from the TWR-SER to an external CAN node.


The test network is terminated at both ends (at the TWR-SER board and at the CANbus monitor device)!



On the TWR-SER module


in main.c

in Events.c:

On the K40D100M

  • Followed the example FlexCAN initialization from the help document
    • Interrupt-driven TX transfer (using Events.c)


When I initiate a CAN transmit message, the function returns an error code of 0 (ERR_OK), but then the program would hang at the while loop checking DataFrameTxFlg. During debugging, CAN1_OnFreeTx_Buffer never triggers. The entire hardware configuration is correct (as far as I know). The FlexCAN software initialization seems to be correct, but the CAN1_OnFreeTx_Buffer not triggering I am still unsure about.

Here are pictures of the relevant registers' values before the CAN1_SendFrame call:



relevant registers' values after the CAN1_SendFrame call, stuck at waiting for the DataFrameTxFlg to be set inside CAN1_FreeTxBuffer within Events.c:



Update: I placed a scope probe on the CANTX header pin on the TWR-SER board (which connects to PTE_24 (configured as CAN_TX) on the TWR-K40D100 board.

  • The scope shows no signal activity when calling CAN1_SendTxFrame. I've verified from PTE_24 (CAN1_TX) / PTE_25 (CAN1_RX) on the TWR-K40D100M board to J5 pin  7 (CAN_TX) / J5 pin 5 (CAN_RX) the TWR-SER board.
  • I have good confidence that the TJA1050T CAN module does work, as I sent an artificial msg over CAN and see activity on J5 pin 6 (C_RXD). 


So it leads to a few possible scenarios:

  • The CAN1 peripheral is not configured correctly (even using Processor Expert.
  • Somewhere from the expansion contacts to the MCU itself there is a discontinuity.