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
已解决! 转到解答。
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.
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.
Hope this helps,
Marius
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.
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.
Hope this helps,
Marius