AnsweredAssumed Answered

FRDM-KEAZ128 CAN Issues

Question asked by Michael Wilson on Jan 29, 2017

My Background with Kinetis: I have used Processor Expert in the past to setup the CAN component of the KE06Z controller and found it easy to use and customize (transmit buffers, ID filter masks, baud-rates, etc.). My current development is for the FRDM-KEAZ128 dev board. This board isn't preconfigured in any of KDS, CW, or S32 IDE's so I'm having a hard time setting it up for CAN.

 

My issue: I am having a real difficult time configuring the CAN component to send frames on this board. 

I have added the component and configured it as follows:

  • Rx Pin: PTC6
  • Tx Pin: PTC7
  • Msg Buffers: 2 (1 Rx, 1 Tx)
  • Bit-rate: 250kbit/s
  • Initialization: Auto-init, enabled
  • Interrupts: High Priority for Tx, Medium for Rx
  • Events: OnFreeTxBuffer & OnFullRxBuffer

 

I'm using CANAlyzer to monitor frames and configured it at the same bit-rate, no frames are seen on the bus. I tried with and without 120ohm terminating resistor. From reading this NXP thread https://community.nxp.com/thread/386975 , I learned that PE actually forgets to add the interrupt enable mask for transmitting frames. That explains why the debugger doesn't reach the event CAN1_OnFreeTxBuffer(). After adding the missing line to the end of the CAN1_Init() routine, the debugger shows that the MCU is stuck in the PE_ISR(CAN1_TxInterrupt) loop. This happens during PE_low_level_init() before any of my code is executed (actually setting up a data frame).

 

CAN_Init

 

I have tried disabling autoinitialize components--so I call the CAN1_Init() function myself and then CAN_Enable() to see what's going on. I tried adding the highlighted line just before setting up the CAN frame doesn't work either. I'm not sure what to do here, I have also tried removing the line (no frames sent, no OnFreeTxBuffer event triggered). When I use loop-back mode, the event gets triggered and the MCU doesn't get stuck in the ISR function.


Can someone take a look at my attached CodeWarrior 10.6 project and look at the PE code as to why it wont send CAN frames? I'm not exactly sure where to go from here.

 

PS. I have tried Kinetis Design studio and the new S32 design studio, to my luck, the MSCAN LDD component is not included!!

 

Any help is greatly appreciated!

Original Attachment has been moved to: frdm-keaz128-can-test.zip

Outcomes