Abhinav or others... Did you ever get a specific solution to this problem? I've been playing around with the FlexCAN demo all day on MQX 3.8 without any success. As others have commented, the terminal output is pretty unhelpful... it says that setup succeeded and that the message is transmitting correctly:
*********FLEXCAN TEST PROGRAM.*********
Message format: Standard (11 bit id)
Message buffer 0 used for Tx and Rx.
Interrupt Mode: Enabled
Operation Mode: TX and RX --> Normal
***************************************
selected frequency (Kbps) is: 125
Data length: 1
FLEXCAN reset. result: 0x0
FLEXCAN initilization. result: 0x0
FLEXCAN mode selected. result: 0x0
FLEXCAN global mask. result: 0x0
FLEXCAN Error ISR install, result: 0x0
FLEXCAN Bus off ISR install, result: 0x0
FLEXCAN error interrupt enable. result: 0x0
FLEXCAN rx remote mailbox initialization. result: 0x0
FLEXCAN rx mailbox initialization. result: 0x0
FLEXCAN mailbox activation. result: 0x0
FLEXCAN RX ISR install. result: 0x0
FLEXCAN RX remote ISR install. result: 0x0
FLEXCAN tx remote mailbox initialization. result: 0x0
FLEXCAN tx mailbox initialization. result: 0x0
FLEXCAN tx mailbox activation. result: 0x0
FLEXCAN TX ISR install. result: 0x0
FLEXCAN TX remote ISR install. result: 0x0
FLEXCAN started. result: 0x0
Data transmit: 0
Data transmit: 1
FLEXCAN tx update message. result: 0x0
Data transmit: 2
FLEXCAN tx update message. result: 0x0
Data transmit: 3
FLEXCAN tx update message. result: 0x0
I think the software end of it is working correctly, as I'm able to see the message data increment in the mailbox register (0x400A_4058) if I view memory while running the code. I've tried putting a logic analyzer on pin 42 of the A-side expansion port, but the signal doesn't change (sampled at 1MHz for 5 seconds) and the bus just stays high.
I've established that the CAN transceiver works correctly by stimulating pins 1 and 3 of J7 on the TWR-SER with a CAN-USB module. I'm able to view the data stream on the A-side expansion port, Pin 41 (CAN_RX). However, the FlexCAN demo code doesn't acknowledge receipt of the message (sent with message id 0x123).
Are there any known issues with the TWR-K60N512 or TWR-SER that would prevent the FlexCAN demo from working out of the box? I've tried the following with no success:
- K60 Mask set 0M33Z errata fix e2583, by placing "OSC_CR |= OSC_CR_ERCLKEN_MASK;" at line 333 of kflexcan.c.
- Shorting pins 1-2 of J7, as suggested by Abhinav.
Any advice or experience would be greatly appreciated!!
Robert