How can I read all de CAN mesages and know the ids and data frame using KEA-128?

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

How can I read all de CAN mesages and know the ids and data frame using KEA-128?

Jump to solution
1,457 Views
emilioaronmoyer
Contributor III

Hello,

 

I'm using KEA-128, and I want to read all the CAN mesages in the CAN bus, I need to extract the id and the data frame of the CAN mesages. If I'm using the attached program that I download from this discussion
https://community.nxp.com/thread/381639#comments , How can I do it?

 

Regards,

 

Emilio Moyers

Original Attachment has been moved to: MSCAN_KEA128.rar

Labels (1)
1 Solution
1,116 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Emillio,

    If you want to read all the CAN messages, you don't need to add the identifier mask, this will receive all the ID data.

    For detials, please refer to my attached code, this code can receive all the CAN message, and will printf the received CAN ID, lengh, and data frame.

  The following picture is the configuration of  receiving all the MSCAN data:

72.jpg

  After receive the data, you can get the data from structure sRxFrameInfo.

  My test result is:

Running the TRK-KEA128 CAN_Node1_demo project.

receive a frame data!

ID is 0x8!

Data length is 8

0x11,0x22,0x33,0x44,0x55,0x66,0x77,0x88,

receive a frame data!

ID is 0x108!

Data length is 8

0x11,0x22,0x33,0x44,0x55,0x66,0x77,0x88,

receive a frame data!

ID is 0x18!

Data length is 4

0x11,0x22,0x33,0x44,

    You can find all the receive information is printf out.

Wish it helps you!

If you still have question, please let me know!


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

6 Replies
1,116 Views
emilioaronmoyer
Contributor III

Hi Jingjing,

A few questions,

Where I can see what the printf command is writting?, I tried usisng the COM where the KEA128 was connected to the computer al 9600 bauds but nothing appear.

How can cofigure the speed ? I'm using 500 kbits/s but I don't know if the program using the same transmition rate.

To change the id when i send a CAN message, do I only need to change the value of sCANTxItemInfo.ID_Type.ID = NODE_ID1;?

Those questions I because nothing happen with the program, only one led is blinking every second because of the RTC task

Regards,

Emilio

0 Kudos
1,116 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Emillio,

    You need to use a serial assistant tool, eg, Hypertrm.

    The COM baud rate is 115200 bps, not 9600, so you can't get the data.

    About the CAN baudrate, the sample code is using 100Kbps.

    If you want to change the ID, just change :

  #define NODE_ID1  0X801

  You can't get it work, because you use the wrong CAN baud rate and the wrong Com baud rate.

  Please try again.


Have a great day,
Jingjing

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

0 Kudos
1,116 Views
emilioaronmoyer
Contributor III

Hello Jingjing,

If I want to change for 100kbps to 500kbps, which variable do I have to change and with which values?

Regards,

Emilio

0 Kudos
1,116 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Emillio,

  If you want to change the MSCAN baud to 500Kbps, just modify the mscan.h, BAUD_RATE_BPR data is ok.

#define BAUD_RATE_BRP 3.

  You can find how to calculate the MSCAN baud rate  in the KEA128 reference manual, chpater 32.4.5.2 Clock system.


Have a great day,
Jingjing

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

0 Kudos
1,116 Views
emilioaronmoyer
Contributor III

Hi Jingjing,

Thanks for answering all my other questions, it really helps.

I have one last question, I hope, to read an specific id for example 0x54, what do I need to put in the IDAR0, IDAR1, IDMR0, IDMR1? Or do I need only to change the Node_id's?

Can you give me an example whatever Id? I have read the sections 32.3.17 to 32.3.20, but I don't understood very hoy the mask of IDAR0, IDAR1, IDMR0, IDMR1 works. Do you have an example of what do they do step by step?

Kind regards,

Emilio

0 Kudos
1,117 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Emillio,

    If you want to read all the CAN messages, you don't need to add the identifier mask, this will receive all the ID data.

    For detials, please refer to my attached code, this code can receive all the CAN message, and will printf the received CAN ID, lengh, and data frame.

  The following picture is the configuration of  receiving all the MSCAN data:

72.jpg

  After receive the data, you can get the data from structure sRxFrameInfo.

  My test result is:

Running the TRK-KEA128 CAN_Node1_demo project.

receive a frame data!

ID is 0x8!

Data length is 8

0x11,0x22,0x33,0x44,0x55,0x66,0x77,0x88,

receive a frame data!

ID is 0x108!

Data length is 8

0x11,0x22,0x33,0x44,0x55,0x66,0x77,0x88,

receive a frame data!

ID is 0x18!

Data length is 4

0x11,0x22,0x33,0x44,

    You can find all the receive information is printf out.

Wish it helps you!

If you still have question, please let me know!


Have a great day,
Jingjing

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