I wonder how to get CAN to work with KDS's Processor Expert?

cancel
Showing results for 
Search instead for 
Did you mean: 

I wonder how to get CAN to work with KDS's Processor Expert?

Jump to solution
2,174 Views
Contributor I

We have a PLC to work with a device using CAN2.0 protocol, now we intend to add a Freescale KEA128 into the existing system using its CAN interface to communicate with the PLC and possibly the other device. But we are not sure that we could correctly using the methods provided by KDS2.0 Processor Expert after adding the built-in CAN device. So please help with demo code fragment.

Thank you!

 

Chao

Labels (1)
0 Kudos
1 Solution
31 Views
NXP TechSupport
NXP TechSupport

Hi Chao Dong,

      I have a PE KDS3.0 KEA128 CAN project, please find it from the attachment.

      I test my project on our TRK-KEA128 board, it works ok,  following is the test result:

37.jpg

Wish it helps you!


Have a great day,
Jingjing

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

View solution in original post

11 Replies
31 Views
Contributor II

THIS DOES NOT WORK PLEASE HELP zjj7172661314

0 Kudos
31 Views
NXP TechSupport
NXP TechSupport

Hi Michael Amici,

    Please see my reply in your post:Re: CAN_LDD TRK_KEA128 sendFrame (NOT LOOPBACK)

   Any question, please reply me in your post, I will reply you there!

Best Regards,

Jingjing

0 Kudos
31 Views
Contributor I

Hi Jingjing and David,

Thank you so much for your answers. I intended to grant right answers to both of you, however, I finally found I could not do the second after I did the first, so sorry David.

I noticed that in Jingjing's code, BufferIdx=1 was passed to SendFrame(), and the loopback test failed when passing BufferIdx=0 into it, I don't know the reason why? Is it possible to elaborate it?

Kind Regards

Chao

0 Kudos
31 Views
NXP TechSupport
NXP TechSupport

Hi Chao Dong,

    Because my project configure the transmit as the buffer, if you want to use the buffer0 as the transimt, you should configure it in the CAN_LDD:

39.jpg

Wish it helps you!

Jingjing

0 Kudos
31 Views
Contributor I

Thanks a lot.

Though it works in loopback mode, I couldn't get it work when I connect the MSCAN (PTC6/PTC7) through a Freescale CAN tranceiver onto a CAN bus: neither CAN_OnFreeTxBuffer() nor CAN_OnFullRxBuffer( ) was called when periodically calling SendFrame( ). Then I did the second test with another CAN device sending data onto the CAN bus every 1 second, I still didn't get any interrupts while I could see the bus signal on MSCAN Rx pin. All settings are default except for the baud rate that was changed to 125Kb/s to match the speed of other CAN nodes on the same bus. I wonder why?

Regards

Chao

0 Kudos
31 Views
NXP TechSupport
NXP TechSupport

Hi Chao Dong,

    Did you test it on our TRK-KEA128 board?

    I already test it on our TRK-KEA128 board, it  works ok on my side, and when I put break point in the CAN_OnFreeTxBuffer() or CAN_OnFullRxBuffer( ), these code can be entered, the according interrupt also can be entered.

    My test in connect the external CAN bus tool on the TRK-KEA128 board:

76.jpg

CANH and CANL.

If you have the TRK-KEA128 board, you can test it on your side.

If you still have question about the MSCAN, please let me know!

Best Regards,

Jingjing

0 Kudos
31 Views
Contributor I

Hi Jingjing,

Do you connect external CAN bus with your TRK-KEA128 board? I did that as a test but it failed to generate any Rx or Tx  interrupts. The external CAN bus was running ok while I did the test. Is there any other consideration in doing this test?

Best regards

Chao

0 Kudos
31 Views
NXP Employee
NXP Employee

Hi Chao,

I recently setup a KDS_3.0.0 + PE + FreeRTOS + MSCAN example using the FRDM-KE06Z (very similar to your KEA-128) where I'm using interrupts and configured the CAN module for loopback so that I can do the testing with one device.

Two attachments....1 using external clocking for clock mode FEE, and 2 using internal cclocking for clock mode FEI.

Regards,

David

31 Views
Contributor II

Hi David,

I just unpacked my FRDM KEA 128 and I have set up my very first Kenitics IDE and I want to have my first HelloWorld program running. I do want to eventually use RTOS to develop an interrupt driven application.

Can I use your examples from above 2 years later to be used in the latest Kinetics for a FRDM KEA 128 board?

Thanks a lot in advance

0 Kudos
32 Views
NXP TechSupport
NXP TechSupport

Hi Chao Dong,

      I have a PE KDS3.0 KEA128 CAN project, please find it from the attachment.

      I test my project on our TRK-KEA128 board, it works ok,  following is the test result:

37.jpg

Wish it helps you!


Have a great day,
Jingjing

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

View solution in original post

31 Views
Contributor IV

Hi Jingjing,

                 The transmit code works properly but the receive code is not working for me.Is there any constrain in the  CAN id's or no.of bytes in the code ?

0 Kudos