Classic CAN using mcan in LPC546xx

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Classic CAN using mcan in LPC546xx

ソリューションへジャンプ
2,756件の閲覧回数
hemanthvasista
Contributor IV

Hello ,

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

regards,

Hemanth

ラベル(1)
0 件の賞賛
1 解決策
2,651件の閲覧回数
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Hemanth,

Just change the definition to 0:

#define USE_CANFD (0U)

Hope it helps,

Alice

元の投稿で解決策を見る

8 返答(返信)
2,651件の閲覧回数
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,177件の閲覧回数
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,651件の閲覧回数
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,652件の閲覧回数
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Hemanth,

Just change the definition to 0:

#define USE_CANFD (0U)

Hope it helps,

Alice

2,651件の閲覧回数
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,651件の閲覧回数
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,651件の閲覧回数
hemanthvasista
Contributor IV

Hello Alice,

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

any inputs for other question?

0 件の賞賛
2,651件の閲覧回数
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 件の賞賛