S32G M7 core CAN bus configuration

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

S32G M7 core CAN bus configuration

Jump to solution
820 Views
vsong
Contributor II

I am modifying the "Can_example_S32G399A_M7" to:

1. use both FlexCan0 and FlexCan1, both send one CAN message, and receiving is also ready.

a. I use the loop back for both CAN controllers.   

Both CAN controller share the same CanIf_TxConfirmation callback and CanIf_RxIndication callback

Both CAN controller sent 1 message each, (I can see the CanIf_u8TxConfirmCnt went to 2 if I sent 2, only went up to 1 if I sent one message).  Looks good for Tx part.

But only Controller0 will have the RxIndication callback, the other controller does not have the RxIndication callback being invoked, In the RxIndication, the mailbox show controller0 only.  If message is on controller1, the RxIndication callback will never enter, no mailbox for controller1.   what was the issue here?  My CanIf configure as below, is it correct?

vsong_0-1696386764391.png

 

 

b.  When I unselect the "Can loop Back Mode", recompile and run, nothing happened, no TxConfirmation and no RxIndication.

I plug in the 20 pair connector come with gold box.  Two black ground wires connect to ground.  For FlexCan0 and FlexCan1, I twist green wires together and white wires together, with 120ohm resistor connect the green and white wire.  which I consider it as a CAN bus.

My question is why I do not even have TxConfirmation?

I assume say for FlexCan0 connect to Tja1043.  the Flex_CAN0_EN and FLEX_CAN0_STB if both are 1, Tja1043 should in normal working mode.

vsong_1-1696387595908.png

 

Flex_CAN0_EN and FLEX_CAN0_STB are connected to P2.x of PCALxxxxx

 

vsong_3-1696388167767.png

 

the default power on value is all 1 for output port.

 

 

 

vsong_2-1696388113321.png

 

So I assume all the Tja1043 should be set to normal mode.  

 

Summary, please let me know:

1. why I don't have Controller1's RxIndication callback while controller0 has it.

2. why my external CAN bus not Tx/Rx normally.

 

Thanks,

 

 

0 Kudos
1 Solution
717 Views
MayanksPatel
NXP Employee
NXP Employee

Hi @vsong,

For 1st question, Our internal team tried to reproduce the issue and can't reproduce the same, Maybe please check the configuration again.

 

For 2nd question, you need to configure the port and execute port initialization in the main function(for example, FlexCAN0 -> PB01/PB02) if not using loopback mode, and then it will go to "CanIf_TxConfirmation"

 

Hope this helps.

 

Thanks,

Mayank S Patel

View solution in original post

0 Kudos
5 Replies
792 Views
MayanksPatel
NXP Employee
NXP Employee

Hi @vsong,

Thank you for reaching out to us.

 

Will you please share the changes on top of the Can_example_S32G399A_M7 application?

 

Thanks,

Mayank S Patel

0 Kudos
784 Views
vsong
Contributor II

I attached project foler as zip file, Please take a look.

1. if select both controller as "loopback", no Rx indication for controller1

2. If unselect "loopback" for both controller, no TxConfimation/RxIndication for any of them.

 

Thanks

0 Kudos
736 Views
MayanksPatel
NXP Employee
NXP Employee

Hi @vsong,

Thank you for your patience.

I am unable to test the configuration with multiple CAN controllers locally. I have created a ticket with the internal team and I will get back to you on this.

 

Thanks,

Mayank S Patel

0 Kudos
718 Views
MayanksPatel
NXP Employee
NXP Employee

Hi @vsong,

For 1st question, Our internal team tried to reproduce the issue and can't reproduce the same, Maybe please check the configuration again.

 

For 2nd question, you need to configure the port and execute port initialization in the main function(for example, FlexCAN0 -> PB01/PB02) if not using loopback mode, and then it will go to "CanIf_TxConfirmation"

 

Hope this helps.

 

Thanks,

Mayank S Patel

0 Kudos
708 Views
vsong
Contributor II

Thank you for the answer.

For question 1, I figure it out, when I configure the CAN object1 (receiving object), I didn't use the correct CAN controller.

 

For question 2, Thank you for the answer.  I realize I did not set the pin for Rxd and Txd for Can0 and Can1 in PIN configuration.  After I configure the pin, and add Suil2_port driver, then in main.c add port init.  the external loop working.

Thanks,

0 Kudos