Hi, There are mistakes of the FRDM-KE06 CAN Sample code, Because of the CAN baud rate.
I share the code on the below website:
http://www.openfsl.com/thread-48-1-1.html
#include "stdio.h"
#define TSEG_1 0x00 /*!< 1 Tq clock cycle. */
#define TSEG_2 0x01 /*!< 2 Tq clock cycle. */
#define TSEG_3 0x02 /*!< 3 Tq clock cycle. */
#define TSEG_4 0x03 /*!< 4 Tq clock cycle. */
#define TSEG_5 0x04 /*!< 5 Tq clock cycle. */
#define TSEG_6 0x05 /*!< 6 Tq clock cycle. */
#define TSEG_7 0x06 /*!< 7 Tq clock cycle. */
#define TSEG_8 0x07 /*!< 8 Tq clock cycle. */
#define TSEG_9 0x08 /*!< 9 Tq clock cycle. */
#define TSEG_10 0x09 /*!< 10 Tq clock cycle. */
#define TSEG_11 0x0a /*!< 11 Tq clock cycle. */
#define TSEG_12 0x0b /*!< 12 Tq clock cycle. */
#define TSEG_13 0x0c /*!< 13 Tq clock cycle. */
#define TSEG_14 0x0d /*!< 14 Tq clock cycle. */
#define TSEG_15 0x0e /*!< 15 Tq clock cycle. */
#define TSEG_16 0x0f /*!< 16 Tq clock cycle. */
#define SJW_1TQ 0x00 /*!< 1 Tq clock cycle. */
#define SJW_2TQ 0x01 /*!< 2 Tq clock cycle. */
#define SJW_3TQ 0x02 /*!< 3 Tq clock cycle. */
#define SJW_4TQ 0x03 /*!< 4 Tq clock cycle. */
#define BUS_CLK_HZ 20000000L
#define BAUD_RATE_CLOCK BUS_CLK_HZ/*!< clock source for MSCAN*/
#define Baud_RATE BAUD_RATE_CLOCK/(BAUD_RATE_BRP+1)/\
(3 + BAUD_RATE_TSEG1+BAUD_RATE_TSEG2)
#define BAUD 250
#if BAUD == 1000 //1M
#define BAUD_RATE_SJW SJW_3TQ /*!< 1 set Synchronization Jump Width. */
#define BAUD_RATE_BRP 1 /*!< 1 Baud Rate Prescaler */
#define BAUD_RATE_SAMP 0 /*!< 0-One sample per bit, 1-three sample per bit. */
#define BAUD_RATE_TSEG1 TSEG_5 /*!< Time Segment 1*/
#define BAUD_RATE_TSEG2 TSEG_4 /*!< Time Segment 2*/
#elif BAUD == 500 //500K
#define BAUD_RATE_SJW SJW_3TQ /*!< 1 set Synchronization Jump Width. */
#define BAUD_RATE_BRP 1 /*!< 1 Baud Rate Prescaler */
#define BAUD_RATE_SAMP 0 /*!< 0-One sample per bit, 1-three sample per bit. */
#define BAUD_RATE_TSEG1 TSEG_10 /*!< Time Segment 1*/
#define BAUD_RATE_TSEG2 TSEG_9 /*!< Time Segment 2*/
#elif BAUD == 250 //250K
#define BAUD_RATE_SJW SJW_3TQ /*!< 1 set Synchronization Jump Width. */
#define BAUD_RATE_BRP 7 /*!< 1 Baud Rate Prescaler */
#define BAUD_RATE_SAMP 0 /*!< 0-One sample per bit, 1-three sample per bit. */
#define BAUD_RATE_TSEG1 TSEG_5 /*!< Time Segment 1*/
#define BAUD_RATE_TSEG2 TSEG_4 /*!< Time Segment 2*/
#endif
int main()
{
int bd = Baud_RATE;
printf("bd is %d\r\n",bd);
}