How to Start CAN Module Development on KDS v3.2.0 + Processor Expert

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

How to Start CAN Module Development on KDS v3.2.0 + Processor Expert

How to Start CAN Module Development on KDS v3.2.0 + Processor Expert

- This document introduces how to develop a simple CAN module application on KDS, it is suitable for the beginners to start using the KDS and Processor Expert, and it mainly focus on how to developing a CAN Loopback application, how to use the “Typical Usage” of “help on component”.

- About the Sending or Receiving data demo(with interrupt or polling) we can find on  the "Typical Usage" of "help on component" .

- Pay attention that , in the Typical Usage code , the Transfer Message ID is 0x123u, while in the CAN_LDD default configuration , the Receive Message ID is 0x7FF, they are should be same . So we should change one of them (In standard frame format, the admissible range is from 0x00 to 0x7FF; in extended format, the range is from 0x00 to 0x1FFFFFFF ), on my project , I change the TX ID from 0x123u to 0x7FFu on the code, about the detail information,

please look at the document and application project.

 

This application hardware is TWR-K21F120M board, software is KDS v3.2.0 .

Labels (1)
Attachments
Comments

I'm using KDS v3.2.0 with Process Expert and a FRDM-KE06.  I'm trying to send CAN data frames with extended 29 bit message IDs. Everything works fine if I use 11 bit standard message IDs, but if I set the frame message ID to a 29 bit extended frame, the message ID is truncated to 11 bits. I'm setting the message ID as follows:

Frame1.MessageID = 0x1401FFFF;

Frame2.MessageID = 0x1402FFFF;

Then sending message as follows:

Error_CAN = CAN1_SendFrame(CAN1_DeviceData, 1U, &Frame1);

Error_CAN = CAN1_SendFrame(CAN1_DeviceData, 2U, &Frame2);

When I monitor the CAN, I'm only seeing 0x7FF as the message ID for both messages. I've tried different CAN monitoring tools to rule that out. If I change the message IDs as follows:

Frame1.MessageID = 0x1;

Frame2.MessageID = 0x2;

...Then they show up with message IDs 0x1 and 0x2 respectively. 

 

My Message Buffers tab does not look the same as yours in PE. Here is a screenshot:

messagebufferstab.PNG

What do I need to do in order to send extended frame message IDs with PE and KDS 3.2.0?

I should have waited one more minute before posting. I found the problem. Posting in case anyone else runs into it. I found the answer in the help file under typical usage. For extended 29 bit IDs, they need to be set as follows:

Frame1.MessageID = (0x1401FFFF | LDD_CAN_MESSAGE_ID_EXT);

After doing this, it works as expected.

%3CLINGO-SUB%20id%3D%22lingo-sub-1129316%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EHow%20to%20Start%20CAN%20Module%20Development%20on%20KDS%20v3.2.0%20%2B%20Processor%20Expert%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1129316%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E-%20This%20document%20introduces%20how%20to%20develop%20a%20simple%20CAN%20module%20application%20on%20KDS%2C%20it%20is%20suitable%20for%20the%20beginners%20to%20start%20using%20the%20KDS%20and%20Processor%20Expert%2C%20and%20it%20mainly%20focus%20on%20how%20to%20developing%20a%20CAN%20Loopback%20application%2C%20how%20to%20use%20the%20%E2%80%9CTypical%20Usage%E2%80%9D%20of%20%E2%80%9Chelp%20on%20component%E2%80%9D.%3C%2FP%3E%3CP%3E-%20About%20the%20Sending%20or%20Receiving%20data%20demo(with%20interrupt%20or%20polling)%20we%20can%20find%20on%26nbsp%3B%20the%20%22Typical%20Usage%22%20of%20%22help%20on%20component%22%20.%3C%2FP%3E%3CP%3E-%20Pay%20attention%20that%20%2C%20in%20the%20Typical%20Usage%20code%20%2C%20the%20Transfer%20Message%20ID%20is%200x123u%2C%20while%20in%20the%20CAN_LDD%20default%20configuration%20%2C%20the%20Receive%20Message%20ID%20is%200x7FF%2C%20they%20are%20should%20be%20same%20.%20So%20we%20should%20change%20one%20of%20them%20(In%20standard%20frame%20format%2C%20the%20admissible%20range%20is%20from%200x00%20to%200x7FF%3B%20in%20extended%20format%2C%20the%20range%20is%20from%200x00%20to%200x1FFFFFFF%20)%2C%20on%20my%20project%20%2C%20I%20change%20the%20TX%20ID%20from%200x123u%20to%200x7FFu%20on%20the%20code%2C%20about%20the%20detail%20information%2C%3C%2FP%3E%3CP%3Eplease%20look%20at%20the%20document%20and%20application%20project.%3C%2FP%3E%3CP%20style%3D%22min-height%3A%208pt%3B%20padding%3A%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20application%20hardware%20is%20TWR-K21F120M%20board%2C%20software%20is%20KDS%20v3.2.0%20.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1129316%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CLINGO-LABEL%3EGeneral%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1129318%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20How%20to%20Start%20CAN%20Module%20Development%20on%20KDS%20v3.2.0%20%2B%20Processor%20Expert%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1129318%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EI%20should%20have%20waited%20one%20more%20minute%20before%20posting.%20I%20found%20the%20problem.%20Posting%20in%20case%20anyone%20else%20runs%20into%20it.%20I%20found%20the%20answer%20in%20the%20help%20file%20under%20typical%20usage.%20For%20extended%2029%20bit%20IDs%2C%20they%20need%20to%20be%20set%20as%20follows%3A%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3EFrame1.MessageID%20%3D%20(0x1401FFFF%20%7C%20LDD_CAN_MESSAGE_ID_EXT)%3B%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3EAfter%20doing%20this%2C%20it%20works%20as%20expected.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1129317%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20How%20to%20Start%20CAN%20Module%20Development%20on%20KDS%20v3.2.0%20%2B%20Processor%20Expert%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1129317%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EI'm%20using%20KDS%20v3.2.0%20with%20Process%20Expert%20and%26nbsp%3Ba%20FRDM-KE06.%20%26nbsp%3BI'm%20trying%20to%20send%20CAN%20data%20frames%20with%20extended%2029%20bit%20message%20IDs.%20Everything%20works%20fine%20if%20I%20use%2011%20bit%20standard%20message%20IDs%2C%20but%20if%20I%20set%20the%20frame%20message%20ID%20to%20a%2029%20bit%20extended%20frame%2C%20the%20message%20ID%20is%20truncated%20to%2011%20bits.%20I'm%20setting%20the%20message%20ID%20as%20follows%3A%3C%2FP%3E%3CP%3EFrame1.MessageID%20%3D%200x1401FFFF%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EFrame2.MessageID%20%3D%200x1402FFFF%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3EThen%20sending%20message%20as%20follows%3A%3C%2FP%3E%3CP%3EError_CAN%20%3D%20CAN1_SendFrame(CAN1_DeviceData%2C%201U%2C%20%26amp%3BFrame1)%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EError_CAN%20%3D%20CAN1_SendFrame(CAN1_DeviceData%2C%202U%2C%20%26amp%3BFrame2)%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3EWhen%20I%20monitor%20the%20CAN%2C%20I'm%20only%20seeing%200x7FF%20as%20the%20message%20ID%20for%20both%20messages.%20I've%20tried%20different%20CAN%20monitoring%20tools%20to%20rule%20that%20out.%20If%20I%20change%20the%20message%20IDs%20as%20follows%3A%3C%2FP%3E%3CP%3EFrame1.MessageID%20%3D%200x1%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EFrame2.MessageID%20%3D%200x2%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E...Then%20they%20show%20up%20with%20message%20IDs%200x1%20and%200x2%20respectively.%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EMy%20Message%20Buffers%20tab%20does%20not%20look%20the%20same%20as%20yours%20in%20PE.%20Here%20is%20a%20screenshot%3A%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22messagebufferstab.PNG%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22messagebufferstab.PNG%22%20style%3D%22width%3A%20999px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F13108i0AC8AB85A455BAF8%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22messagebufferstab.PNG%22%20alt%3D%22messagebufferstab.PNG%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EWhat%20do%20I%20need%20to%20do%20in%20order%20to%20send%20extended%20frame%20message%20IDs%20with%20PE%20and%20KDS%203.2.0%3F%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
No ratings
Version history
Last update:
‎04-25-2016 02:49 AM
Updated by: