Classic CAN using mcan in LPC546xx

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Classic CAN using mcan in LPC546xx

跳至解决方案
2,748 次查看
hemanthvasista
Contributor IV

Hello ,

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

regards,

Hemanth

标签 (1)
0 项奖励
1 解答
2,643 次查看
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Hemanth,

Just change the definition to 0:

#define USE_CANFD (0U)

Hope it helps,

Alice

在原帖中查看解决方案

8 回复数
2,643 次查看
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 项奖励
1,169 次查看
williamcarlisle
Contributor II

Yeah, those SDK examples are worthless. They use function macros that you cannot follow into the code to find out why the example does NOT work.

标记 (1)
0 项奖励
2,643 次查看
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 项奖励
2,644 次查看
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Hemanth,

Just change the definition to 0:

#define USE_CANFD (0U)

Hope it helps,

Alice

2,643 次查看
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 项奖励
2,643 次查看
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

2,643 次查看
hemanthvasista
Contributor IV

Hello Alice,

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

any inputs for other question?

0 项奖励
2,643 次查看
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 项奖励