flexcan testing in TWR-K60F120M

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

flexcan testing in TWR-K60F120M

2,960 Views
sruthyuk
Contributor I

Dear friends,

 

I have been trying to test the can_loopback_node project in KINETIS512_SC_100MHz.zip .Here i am using flexcan1 for enabling loop back mode.But i dont know how to test the flexcan.Could you help me to find out connections for configuring TWR SER & pins of tower board by referring the attachments.And the steps for testing CAN transmission using the pogram code in HART_AO??

 

With Regards

Sruthy

Original Attachment has been moved to: HART_AO.zip

Labels (1)
0 Kudos
12 Replies

2,286 Views
sruthyuk
Contributor I

hi,

how can i test communication between two CAN modules in MK60DN512ZVLQ10 processor?? How does the interrupt works when CAN0 used as sending node and CAN1 as receiving node?? I am doing KDS project and the sample code used for reference is can_loopback_node project in KINETIS512_SC_100MHz.zip

with regards,

sruthy

0 Kudos

2,286 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi sruthy uk,

      Did enable the Loop back mode in your K60F120 project?

      If yes, you don't need to connect the external pin, because In the loopback mode, FlexCAN performs an internal loop back that can be used for self test operation.

      If you didn't work at the loopback mode, you need to test it associate with the CAN test tool.

      About the connect, when you plug your TWR-SER board, Short J5(1-2), J5(3-4), J5(5-6), J5(7-8), and J5(9-10) to enable CAN connection. Then connect your CAN test tool's CANH to J7 PIN1, CANL to J7 pin3.

     Then you can test your flexcan.

      Besides, I have a question, where you get KINETIS512_SC_100MHz.zip and HART_AO? from Freescale web? As I know, KINETIS512_V2_SC.zip is for K60D100, but it don't have flexcan demo.

Is your HART_AO project is CW project? or KDS project?

Best Regards,

Jingjing

0 Kudos

2,286 Views
sruthyuk
Contributor I

Hi jingjing zhou,

Now i am trying to test the loopback mode only with a single node(CAN controller) in TWR-K60F120M.For this did i want to plug the SER board??

This KINETIS512_SC_100MHz.zip contains the code for testing CAN in the project folder.Yes,it is used for K60D100. My HART_AO project is KDS project.

Best Regards,

sruthy uk

0 Kudos

2,286 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi sruthy uk,

      If you want to test the FlexCAN loopback mode, you don't need to plug the SER board, just the TWR-K60F120M is ok, the bit stream output of the transmitter is internally fed back to the receiver input. You should set LPB bit in CANx_CTRL1 register to enable the loopback mode.

Wish it helps you!

Best Regards,

Jingjing

0 Kudos

2,285 Views
sruthyuk
Contributor I

Hi jingjing zhou,

i set the LPB it in CTRL_1 register and trying to send a character  in flexcan_write function. but nothing is coming in the console.What will be the problem for this??

Whether any other sample code for testing single can loop back mode  in twrk60f120 is there??

Best Regards,

sruthy uk

0 Kudos

2,285 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi sruthy uk,

      Please refer to the attachment, the project is CAN kds3.0 project, it works on CAN loop back mode. After you run the code, you will find the InpData is : 0x00, 0x01,0x02,0x03, these data is received from the outData with flexCAN loopback mode.

    Wish it helps you!

If you still have question, please contact me!


Have a great day,

Jingjing

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

0 Kudos

2,285 Views
sruthyuk
Contributor I

​Hi Jingjing zhou,

This is the can loopback code used for testing.

0 Kudos

2,285 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi sruthy uk,

      Attached is the CAN loop code,  the project is CW project for K60D100, but the CAN module is the same as K60F120m, you can refer to it, it is not the PE code, just the barebone project.

Wish it helps you!


Have a great day,
Jingjing

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

0 Kudos

2,286 Views
sruthyuk
Contributor I

Hi,

I tested the CAN loopback mode using can0 module in twrk60f120 board.This is the debugging output window .Here i can view the two transmitted Untitled1.png

character send using flexcan_write function in the console. But the received character is not similar to the transmitted character.What may be the reason for this change??

I have attached the loopback code used.

0 Kudos

2,286 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi sruthy uk,

      Did you check my code? I already test it on my side, it can receive the data, the test result is like following:

25.jpg

    If your code still can't receive the correct data,  your configuration may still have problem, you can refer to my code.

Wish it helps you, if you still have question, please contact me!


Have a great day,
Jingjing

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

0 Kudos

2,286 Views
sruthyuk
Contributor I

hi,

the code is lengthy..also it is used in some RTOS.

Best Regards,

Jingjing

0 Kudos

2,286 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi sruthy uk,

     Now, we  still don't have the according sample code for twrk60f120, but don't worry, I will help you to create one, please wait patiently.

Best Regards,

Jingjing

0 Kudos