MPC5744P FlexCAN example

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MPC5744P FlexCAN example

1,979 Views
seize
Contributor III

Hello,

 

I am using  MPC5744P-144DS daughter board and  MPC57xxx mother board to test FlexCAN module.

As there is no FlexCAN example for S32DS, I have refereed to  "MCP5744P FlexCAN simple TXRX" example for GHS compiler and "MPC5748G-FlexCAN_with_interrupts-S32DS"

I modify the main code to Transmit a message (CAN_0 MB0) with ETimer interrupt every 1 second, and receive the message with interrupt (CAN_1 MB0).  

I also configured the mother board (P4 and P5) by connecting CAN0_CANH to CAN1_CANH and CAN0_CANL to CAN0_CANL. Also terminate the CAN bus with 60 ohm resistor.

 

When I run the program, it always suspending in the following line

 

while ( CAN_0.IFLAG1.B.BUF0I == 0) { Counter_W++;} // wait until the tx is completed.

 

Can you please look into my code and help me with this problem.

 

Thanks in advance for your kind support.

 

Hyuntae Choi

Original Attachment has been moved to: main.c.zip

0 Kudos
Reply
5 Replies

1,202 Views
martin_kovar
NXP Employee
NXP Employee

Hello,

could you please send me high quality photo of your board? I need to check jumper position for CAN.

Regards,

Martin

0 Kudos
Reply

1,202 Views
seize
Contributor III

Hi Martin,

Sorry for late reply. 

Please see the pictures of the board.

 

board.jpg

J17_Conncetion.jpg

J32_J35.jpg

termination.jpg

As I mentioned, the program always suspending on following line

while ( CAN_0.IFLAG1.B.BUF0I == 0) { Counter_W++;} // wait until the tx is completed.

But when I check the CAN bus, I can see the CAN signal  as follow.

20170531_102005.jpg

And CAN_0_ESR1 shows ACK error

pastedImage_3.png

Best regards,

Hyuntae Choi

0 Kudos
Reply

1,202 Views
martin_kovar
NXP Employee
NXP Employee

Hello,

The TX signal you shared is correct, but you do not receive acknowledge. Change j37 and j38 jumpers position on motherboard. For correct behavior jumpers position has to be 2-3.

Regards,

Martin

0 Kudos
Reply

1,202 Views
seize
Contributor III

Hi Martin,

Thanks for your kind reply.

I have solve the problem with your comment.

Regarding the jumper position, I have a question.

When the jumper position is 2-3 for j37 and j38, PA10 and PA11 is selected as TX and RX.

pastedImage_1.png

PA10 and PA11 is connected to connected to PTA10 and PTA11 pin for Daughter board (MPC5744P-144DS).

But PTA10 and PTA11 are not related to CAN TX and RX.

Rather than PTA10 and PTA11, PE5 and PG14 is connected to CAN1_TXD and CAN1_RXD 

PE5 is connected to PTA14 and PG14 is connected to PTA15

pastedImage_4.png

That is why I set the jumper position of J37 and J38 as 1-2.

Moreover, in the program,

PTA14 and PTA15 pin are set as CAN1_TX and CAN1_RX as follow;

/* configure CAN1TX and CAN1RX pin functions */
SIUL2.MSCR[14].B.SSS = 1; /* Pad PA14: Source signal is CAN1_TX */
SIUL2.MSCR[14].B.OBE = 1; /* Pad PA14: Output Buffer Enable */
SIUL2.MSCR[14].B.SRC = 3; /* Pad PA14: Maximum slew rate */
SIUL2.MSCR[15].B.IBE = 1; /* Pad PA15: Enable pad for input - CAN1_RX */
SIUL2.IMCR[33].B.SSS = 1; /* CAN1_RX: connected to pad PA15 */

Can you please explain why?

Best regards,

Hyuntae Choi

0 Kudos
Reply

1,202 Views
martin_kovar
NXP Employee
NXP Employee

Hello,

it seems you have some outdated schematic. Please look at the figure below. It is screen from MPC57xx EVB MOTHER BOARD rev C.

pastedImage_1.png

Regards,

Martin

0 Kudos
Reply