S32 SDK: FlexCAN MPC5748G

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

S32 SDK: FlexCAN MPC5748G

2,233 次查看
bix010
Contributor III

Hi,

I'm trying out the FlexCAN example from EAR SDK v0.8.1. 2 questions:

1) In the help file for this example, it says this is meant to work on the DEVKIT. Would it also work on the LCEVB?

2) How can I configure this example to use more than 1 CAN interface? The MPC 5748G has 8 CAN interfaces, and I would like to use 3 of them to TX and RX at the same time.

Thanks!

Bertrand

标签 (1)
0 项奖励
回复
5 回复数

1,881 次查看
PetrS
NXP TechSupport
NXP TechSupport

Hi,

1. the example should work on LCEVB too.

2. you can just add another flexcan component into a project, after PE code generation relevant code will be added and you can use new instance similarly as the first one. Moreover pins must be defined for another CAN module within pin_mux component.

BR, Petr

0 项奖励
回复

1,881 次查看
bix010
Contributor III

Hi,

Some updates. I tried adding CAN1 of the LCEVB as a receiver:

- Configured PC[10] and PC[11] as CAN1 TX and CAN1 RX respectively in pin_mux

- Called FLEXCAN_DRV_Init on CAN1

- Connected jumper wires from CAN0 interface to CAN1

Still the execution gets stuck at that line of code when transmitting from CAN0.

I hooked up an oscilloscope to the output of CAN0, and there is indeed data being transmitted. The data on the scope seems to correspond with the CAN ID and data.

I've also tried the bare metal examples for flexCAN loopback on the LCEVB, and I'm able to send from CAN0 to CAN1.

Is there something in the SDK not configured correctly? Any help would be greatly appreciated!

Bertrand

0 项奖励
回复

1,881 次查看
maksim_kashynsk
Contributor I

I guess the topic is somewhat old, but as I have just faced it myself, and a lot of people have the same problem, here is a lead to check. Hope it saves some time for a fellow programmer.

It is possible to run the Flexcan demo and/or Flexcan PAL demo on just one board.

DEVKIT-MPC5748g+DEVKIT-COMM it worked almost out of the box. CANs on DEVKIT-COMM are even already terminated.

Here is the catch:

When the receive buffer is configured, it uses 2 (RX_MSG_ID) as incoming message filter. Upon press of a button, message with TX_MSG_ID is sent, which is 1. Therefore the filter will never match.

Once reconfigured for RX_MSG_ID==TX_MSG_ID, it started working.

0 项奖励
回复

1,881 次查看
PetrS
NXP TechSupport
NXP TechSupport

Hi,

unfortunately I do not have LCEVB board, so cannot test.

Seems the message is not acknowledged by other node. Read values of CAN0 ECR,ESR registers.

With a scope measure signals on CAN1 TX/RX. Is there ACK on TX line?

BR, Petr

0 项奖励
回复

1,881 次查看
bix010
Contributor III

Hi Petr, 

Thanks for your reply. I tried the example, and commented out "#define DEVKIT" since I'm using the LCEVB. I'm using 1 LCEVB and have set it to MASTER.

The code compiles and runs, but gets stuck at this line:

while (FLEXCAN_DRV_GetTransferStatus(INST_CANCOM1, TX_MAILBOX) == STATUS_BUSY);

This happens even when I step through on the first run. Is this correct behaviour? Does the board require a receiver on the other end for it to work?

Bertrand

0 项奖励
回复