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.
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.
Some updates. I tried adding CAN1 of the LCEVB as a receiver:
- Configured PC and PC 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!
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.
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?
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?