Setting UP CAN bus on S32K358 using MBDT

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

Setting UP CAN bus on S32K358 using MBDT

ソリューションへジャンプ
287件の閲覧回数
primo
Contributor I

Hello, I am currently working on the CAN bus communication using S32k358.

There are no examples for k358 chip, so based on the CAN transmit s32ct example, I made one for k358. However, when i deploy the example and connected my can analyzer, I am not reading anything and i do not observe the can_msg variable to increment (incrementing should've mean successful sent). It did not show any compilation error so i assumed it to be something hardware wrong.

Then i look into the datasheet and found that there exists a SPI communication between the can trans_reciever and MCU. 

So the question is, do i have to manually wakeup the can trans_reciever using SPI to send and recieve CAN message? Or am I doing anything wrong with the CAN setup. Thanks

primo_1-1716303470914.png

 

primo_0-1716303437607.png

 

0 件の賞賛
返信
1 解決策
255件の閲覧回数
mariuslucianand
NXP Employee
NXP Employee

Hello @primo 

First of all, from the schematic screenshot you have attached, I understand that you are using the RD-K358BMU Reference Design kit. This would have been really valuable information for us to support your request. For this particular board, we do offer a ready-to-run example that has the VCU CAN already configured and performing the task you are aiming for. This example is called k358bmu_read_s32ct and can be accessed from the MBDT for BMS 1.1.0. Please make sure you have the latest MBDT for BMS 1.1.0 installed!

Once you do that, go in the MATLAB command window and type the following command to access the example in the Current Folder.

>> cd(fullfile(mbd_find_bms_root, 'BMS_Examples\k358bmu\k358bmu_read_s32ct'))

 

To give a bit of context, you are right, the CAN transceiver needs to be initialized before messages are sent over the CAN bus. The TJA initialization sequence is performed in the Initialize Function under VCU_CAN_INIT subsystem.

mariuslucianand_0-1716363767263.png

And of course, the Spi channel needs to be properly set to match the SPI requirements of the TJA CAN transceiver. But this is already performed using the external configuration tools, by the channel name SpiChannel_TJA.

mariuslucianand_1-1716363986495.png

Hope this helps,

Marius

 

 

 

元の投稿で解決策を見る

0 件の賞賛
返信
2 返答(返信)
256件の閲覧回数
mariuslucianand
NXP Employee
NXP Employee

Hello @primo 

First of all, from the schematic screenshot you have attached, I understand that you are using the RD-K358BMU Reference Design kit. This would have been really valuable information for us to support your request. For this particular board, we do offer a ready-to-run example that has the VCU CAN already configured and performing the task you are aiming for. This example is called k358bmu_read_s32ct and can be accessed from the MBDT for BMS 1.1.0. Please make sure you have the latest MBDT for BMS 1.1.0 installed!

Once you do that, go in the MATLAB command window and type the following command to access the example in the Current Folder.

>> cd(fullfile(mbd_find_bms_root, 'BMS_Examples\k358bmu\k358bmu_read_s32ct'))

 

To give a bit of context, you are right, the CAN transceiver needs to be initialized before messages are sent over the CAN bus. The TJA initialization sequence is performed in the Initialize Function under VCU_CAN_INIT subsystem.

mariuslucianand_0-1716363767263.png

And of course, the Spi channel needs to be properly set to match the SPI requirements of the TJA CAN transceiver. But this is already performed using the external configuration tools, by the channel name SpiChannel_TJA.

mariuslucianand_1-1716363986495.png

Hope this helps,

Marius

 

 

 

0 件の賞賛
返信
207件の閲覧回数
primo
Contributor I

It helped a lot, thank you very much for the help!

0 件の賞賛
返信