FRDM KE06Z - CAN Comunication

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

FRDM KE06Z - CAN Comunication

2,103 Views
renanikeda
Contributor II

Hello,

I'm using KDS to development of an CAN comunication project.

I'm trying to understand the CAN_Node1_demo example. This example is building and I can send this to the board by openSDA. But I don't understand the baud rate and how this program works.

I have a PEAK CAN hardware and can't read anything from the FRDM KE06.

Can anyone help me to understand how this example works?

I have the same project in a microchip microcontroler and this works fine. NXP/Freescale is new to me and I'm very confusing in this hardware.

Thanks.

0 Kudos
Reply
9 Replies

1,695 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi Renan,

For example:

If you want to set the standard identifier 0x7E, then you should:
#define NODE_ID1            0x7E<<18

sCANTxItemInfo.bIsExtOrStand = 0;    //standard frame

Best Regards,

Robin

 

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

1,695 Views
renanikeda
Contributor II

I need to receive the 0x50 standard ID. 

I change the CAN_IDAR0 to 0x50 << 1, but don't works.

Is there another register to change?

Thanks

0 Kudos
Reply

1,695 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi

Please modify the baudrate define:

CAN_Node1_demo_frdm.png

#define BAUD_RATE_SJW                          0     /*!< 1 set Synchronization Jump Width. */
#define BAUD_RATE_BRP                    19          /*!< 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*/
#define BAUD_RATE_CLOCK                    20000000L/*!< clock source for MSCAN  20M bus clock, 8M external clock*/
#define Baud_RATE                    BAUD_RATE_CLOCK /(BAUD_RATE_BRP+1) / (1 + BAUD_RATE_TSEG1+ BAUD_RATE_TSEG2)

Then you can see the 100kbps CAN messages.

message.png

Best Regards,

Robin

 

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

665 Views
luojian123
Contributor I
not 1+BAUD_RATE_TSEG1+ BAUD_RATE_TSEG2   ,right answer is : #define Baud_RATE                    BAUD_RATE_CLOCK /(BAUD_RATE_BRP+1) / (3 + BAUD_RATE_TSEG1+ BAUD_RATE_TSEG2)‍‍‍‍‍‍‍
0 Kudos
Reply

1,695 Views
antonio_estupin
Contributor I

I know this is an old post, but can u provide the name of the tool used to see the CAN messages log? It would be very useful for my project.

:smileyhappy:

0 Kudos
Reply

1,695 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

I am not using PEAK CAN.

The software and tool is from ZLG, unfortunately it seems has no English version web page.

Best Regards,

Robin

0 Kudos
Reply

1,695 Views
renanikeda
Contributor II

Another question, How can I send standard identifier messages? 

I try to change the code to do that, but don't work. The transmit messages has 0x000 in the ID field.

Thanks.

0 Kudos
Reply

1,695 Views
renanikeda
Contributor II

Still not working.

Opening the serial terminal to see the debug messages only appears the initial messages from the code: 

--System Log BEGINS--


Familly ID = 0x0, Sub-family ID = 0x6, Revision ID = 0x2, Pin ID = 0x8
Pin Reset

--System Log ENDS--


Running the KE06 CAN_Node1_demo project.

In PCAN View software don't appear any message. 

Thanks.   

0 Kudos
Reply

1,695 Views
renanikeda
Contributor II

Now it works. The loopback mode was set. I change this and it works.

Thanks for the reply.