S32K344 EVB With EB AUTOSAR

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

S32K344 EVB With EB AUTOSAR

ソリューションへジャンプ
10,546件の閲覧回数
jacst
Contributor II

Hello, I configured CAN0 of S32K344 EVB with RTD and it can work normally (not AUTOSAR). But after I use EB to configure the code, CAN0 does not work, am I missing something?

0 件の賞賛
返信
1 解決策
10,451件の閲覧回数
namnguyenviet
NXP Employee
NXP Employee

Hello @jacst,

I have seen some problems in your code:

1. The JTAG pins are being left as unused, which means their mode would be overwritten and hence lead to an unexpected reset. I have to comment out them in order to successfully initialize the Port pins:

namnguyenviet_0-1633606870775.png

namnguyenviet_2-1633606910677.png

Not sure how did you do to pass it, but you can check the UntouchPin list in EB Tresos and make sure that all of the JTAG pins (4, 10, 68, 69) are untouched:

namnguyenviet_3-1633607004731.png

2. You expected the SYS_CLK is the CAN clock source, however in fact FIRC is the clock source for CAN (by checking MC_CGM_3):

mc-cgm-3.PNG

Which means the clock source frequency is 48MHz instead of 80MHz, it leads to incorrect CAN baud-rate. Due to the fact that TJA1153 only accepts 125, 250 and 500kbps during initialization, your sending frame wasn't responded and the buffer flag wasn't set.  

Please change the CAN clock reference to correct clock source, it should be FLEXCAN_PE_CLK0_2 instead of SYS_CLK:

namnguyenviet_4-1633607438020.png

Then re-calculate the time quanta and modify the baud-rate segments.

Best Regards,

Nam

 

 

 

元の投稿で解決策を見る

9 返答(返信)
10,496件の閲覧回数
namnguyenviet
NXP Employee
NXP Employee

Hello @jacst,

What do you mean when you're saying: it worked normally in non-AUTOSAR? Can you send/receive the frames with your non-AUTOSAR project?

I asked this because the TJA1153 needs some pre-configuration before starting communication, and you need to get the TJA1153 document to figure out how to pre-configure it. Unfortunately, the document can't be shared here, and you need to contact NDA group to get that.

Best Regards,

Nam

0 件の賞賛
返信
10,486件の閲覧回数
jacst
Contributor II

@namnguyenviet 

Hello, I am using the RTD demo, which contains the configuration program of TJA1153, running on S32K344 EVB, I can see CAN0 send 0x141, 0x142.

Then, I used EB to configure MCAL and transplanted the configuration program of TJA1153, but the message could not be sent normally, and it would be stuck in the function FlexCAN_Ip_SendBlocking. I compared the values of CAN0, PLL and other module registers, but I didn’t find the problem. Can you help me see the reason?Many thanks

0 件の賞賛
返信
10,473件の閲覧回数
namnguyenviet
NXP Employee
NXP Employee

Hello @jacst,

Sorry I haven't realized that  you've attached your code. The TJA1153 configuration (in My_Tja1153_Init) looks good although I haven't tried out it yet. You mean that you're stuck in one of the FlexCAN_Ip_SendBlocking function call in My_tja153_Init, right? 

Best Regards,

Nam

0 件の賞賛
返信
10,470件の閲覧回数
jacst
Contributor II

hi,@

Yes, the program is stuck in the place where it sends data to 0x555. The return value of the function FlexCAN_GetBuffStatusFlag(base, mb_idx) has not been equal to 1, and the program is stuck in this place.

0 件の賞賛
返信
10,452件の閲覧回数
namnguyenviet
NXP Employee
NXP Employee

Hello @jacst,

I have seen some problems in your code:

1. The JTAG pins are being left as unused, which means their mode would be overwritten and hence lead to an unexpected reset. I have to comment out them in order to successfully initialize the Port pins:

namnguyenviet_0-1633606870775.png

namnguyenviet_2-1633606910677.png

Not sure how did you do to pass it, but you can check the UntouchPin list in EB Tresos and make sure that all of the JTAG pins (4, 10, 68, 69) are untouched:

namnguyenviet_3-1633607004731.png

2. You expected the SYS_CLK is the CAN clock source, however in fact FIRC is the clock source for CAN (by checking MC_CGM_3):

mc-cgm-3.PNG

Which means the clock source frequency is 48MHz instead of 80MHz, it leads to incorrect CAN baud-rate. Due to the fact that TJA1153 only accepts 125, 250 and 500kbps during initialization, your sending frame wasn't responded and the buffer flag wasn't set.  

Please change the CAN clock reference to correct clock source, it should be FLEXCAN_PE_CLK0_2 instead of SYS_CLK:

namnguyenviet_4-1633607438020.png

Then re-calculate the time quanta and modify the baud-rate segments.

Best Regards,

Nam

 

 

 

10,444件の閲覧回数
jacst
Contributor II

Hello,Thank you so much, the problem has been solved.

1.I added an unconfigured PORT.

2.The clock source was changed to FLEXCAN_PE_CLK0_2, the CAN baud rate was recalculated, and it is now OK.

When the problem occurred, I only chose an 80M McuClockReferencePoint, and did not realize the correlation between the CAN clock source and ClockMux3.

Thanks again

0 件の賞賛
返信
10,533件の閲覧回数
josip
Contributor I

It seems to me that CAN baud rate is 150 kbit/s. TJA1153 supports 125, 250, 500 kbit/s. 

10,521件の閲覧回数
jacst
Contributor II

I use EB for CAN configuration. The CAN reference clock is 80M, divided by 16 to 5M, 1 bit is divided into 10 tq, and the baud rate is 500k. Am I missing something? Many thanks@josip

0 件の賞賛
返信
10,503件の閲覧回数
josip
Contributor I

I have connected logic analyser to TP275 & TP276 (CAN Rx and Tx) on S32K344 EVB and measured baud rate to be 150 kbit/s.

I haven't looked at config. There is also probability that there is bug in config tool or drivers.

0 件の賞賛
返信