CAN BUS communication k66f example

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

CAN BUS communication k66f example

2,425 Views
alejandrosancho
Contributor I

Dear all,

I am currently trying to set up a can bus communication using the frdm k66f. In the data sheet it says there are 2 can bus ports, on the other hand, there is no can protocol example provided and just the flexcan example is given.

The flexcan example as far as I understand provides a communication using 2 UART ports, but my goal is to send messages between both can ports (CAN 0 and CAN1) in the from k66f board.

Does someone have a short example where this is implemented or could somehow provide some insight into how could this be solved? 

Thank you very much in advance for your time and help.

Tags (3)
0 Kudos
Reply
4 Replies

1,398 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Alejandro Sancho,

1. Which flex can example ? I think maybe you mean the "sci2can" ,

if yes, this example can used to two can node , please check the sci2can.txt , I also attached it .

In this demo, the UART just tool for us to input data to CAN, or shows the data CAN received .

2. There is also demo under KSDK , you can refer to the below link download :

https://community.nxp.com/docs/DOC-329662        

Hope it helps


Have a great day,
TIC

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

0 Kudos
Reply

1,398 Views
alejandrosancho
Contributor I

Basically i get stuck here:

/* Wait until CAN Message send out. */

        while (!FLEXCAN_GetMbStatusFlags(base, 1 << mbIdx))

        {

       

        }

I am using the flexcan_loopback.c example and this function is within FLEXCAN_TransferSendBlocking.

0 Kudos
Reply

1,398 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello    Alejandro,

Sorry for reply you late as to my holiday.

Do you use the demo board FRDM-K66 or custom board ?

Please be sure connect one CAN node to another node (CAN_H to another CAN_H, CAN_L to another CAN_L), if there isn't connected , it can't  send successfully.

Under your SDK2.0 package , there is a CAN demo without loopbback about TWRK65180M :

SDK_2.2_MK66FN2M0xxx18.zip\boards\twrk65f180m\driver_examples\flexcan\interrupt_transfer

You can refer to it .

BR

Alice

0 Kudos
Reply

1,398 Views
alejandrosancho
Contributor I

Hello Alice_Yang,

Thanks for your response, I am using the flexcan_loopback.c example provided with ksdk 2.0. and trying to modify this example (ie. setting to false the loopback enable)

Ican't find the sci2can.txt in the ksdk 2.0 for k66f.  The only example I get for the flexcan is the loopback example, and loopback_transfer example.

Thanks for your help.

0 Kudos
Reply