Classic CAN using mcan in LPC546xx

cancel
Showing results for 
Search instead for 
Did you mean: 

Classic CAN using mcan in LPC546xx

Jump to solution
1,036 Views
hemanthvasista
Contributor IV

Hello ,

Are there any sample code/example for usage of classic CAN in LPC54628?

regards,

Hemanth

Labels (1)
0 Kudos
1 Solution
931 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Hemanth,

Just change the definition to 0:

#define USE_CANFD (0U)

Hope it helps,

Alice

View solution in original post

7 Replies
931 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Hemanth S,

There is CAN demo under MCUXpresso SDK for lpc54628, it support MCUXpresso IDE,

keil and IAR, you can download from:

https://mcuxpresso.nxp.com/en/select   

Regards,

Alice

0 Kudos
931 Views
hemanthvasista
Contributor IV

Hello Alice,

The both example in SDK are mostly CAN FD based.

Are any sample code for Classc CAN and not CAN FD?

regards,

Hemanth

0 Kudos
932 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Hemanth,

Just change the definition to 0:

#define USE_CANFD (0U)

Hope it helps,

Alice

View solution in original post

931 Views
hemanthvasista
Contributor IV

Hello Alice,

Thanks for your inputs.

I had more queries regarding the CAN usage:

1. Which is the recommended work flow for Receiving the CAN messages?
CAN Bus-> RX FIFO -> Application Buffer
CAN Bus-> RX Buffer -> Application Buffer

2. I am able to receive messages based on CAN filter configuration.
But when I tried to read the received message ID from the structure "mcan_rx_buffer_frame_t",

it show some value which is not the same which I configured to receive.
The CAN RAM location also seem to contain this value.

e.g. for msg ID 0x11 (STD ID) -> 0x00464022 (R0 bits figure 133 in manual)
       for msg ID 0x21 (STD ID) -> 0x00864042 (R0 bits figure 133 in manual)

So even tough the message are correctly received in FIFO/Buffer,

I am unable to read-back the message ID from the structure.

regards,

Hemanth

0 Kudos
931 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Hemanth,

Why do you think "it show some value which is not the same which I configured to receive.",

what value do you read ?

There is no problem about the ID in below:

e.g. for msg ID 0x11 (STD ID) -> 0x00464022 (R0 bits figure 133 in manual)
       for msg ID 0x21 (STD ID) -> 0x00864042 (R0 bits figure 133 in manual)

pastedImage_1.png

Regards,

Alice

931 Views
hemanthvasista
Contributor IV

Hello Alice,

Thanks for you inputs, I was looking in wrong bits (11:0)

any inputs for other question?

0 Kudos
931 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Hemanth,

1. Which is the recommended work flow for Receiving the CAN messages?
CAN Bus-> RX FIFO -> Application Buffer
CAN Bus-> RX Buffer -> Application Buffer

I think both can ok, recommend you refer to demo, thanks.

Regards,

Alice

0 Kudos