I am trying CAN_RX for S32K344 board using NXP toolbox. I am using CAN receive S32CT example from NXP toolbox. The logic of the model is whenever CAN frame is received DIO is turned off. This logic is written inside CAN_43_FLEXCAN_MainFunction_Read function. But this function is not called anywhere due to which the DIO is not turning ON. Can u plz help to understand why this function is not called using in the Matlab model.
Also in the example I am referring to - in the board init GUI for CAN there is no CAN_Config_MBDT array passed as an argument to the CAN_FlexCAN_Init function. Whereas in case of other peripherals it is passed as an argument.
In case of CAN, NULL Ptr is passed. Can you please explain the reason for this?
And if I want to pass CAN_Config_MBDT as argument how can I do that using model? as this has been passed in CAN_transmit example in nxp toolbox.
I have attached screenshot of the same for your reference.
Hello Irina,
Thankyou for your support.
As you mentioned following are the hardware specifications we are using -
MBDT S32K3 1.1.0 version
Evaluation board - S32K344
CAN transceiver on board - TJA1044
Configuration tool - S32 config tool
Hence according to your explanation we need to change the configuration to our transceiver. But I am unable to see that option to change or initialize the CAN transceiver.
We are using matlab example from NXP tool box supported for XS32K396 eval board and we are using S32K344 eval board.
I am attaching the model I am referring to. It would be really helpful if you can please support us on this. This issue is a bit critical for us and needs to be resolved on urgent basis.
Hi @anagha12
Thanks for the information provided.
Could you please let us know if you are using the following evaluation board or a different one? Or maybe a custom design? Moreover, from this post I am understanding that you are able to receive Can messages on the bus, however the only part of the model not working is the LED toggling.
Is this correct?
Thank you,
Irina
Yes right. We are using custom designed board having S32K344 NXP chip on it.
Also I have attached the code getting generated through the model.
My question was -
there is function "CanIf_RxIndication" getting generated in CAN_Receive.c file inside which LED toggling logic has been implemented. So i checked and encountered that this function is not getting called any where. So how will the LED toggle?
Can you please explain me on this above point.
Also in CAN_Tx exmaple, there is an option to pass hardware object which we need to use but in case of CAN_Receive example there is no such option wherein we need to mention the hardware object which we need to use.
I have attached the screenshots of all the above points mentioned.
Thankyou.
Hi @anagha12
Hi @anagha12,
The MBDT application demonstrating how CAN messages can be received on an S32K344-Q257 processor is implemented inside the s32k3xx_can_receive_s32ct.mdl which can be found under the toolbox_root/S32K3_Examples/can folder.
Now, to provide an overview of the application, inside the Initialize subsystem, the CanController_0 and the on-board transceiver are initialized, with the following mentions:
1. The correspondence between the CanController_0 and the physical Can instance on the board can be found by pressing the Configure button of any MBDT Simulink blocks.
This action will open the configuration associated to the model, in this case an S32 Configuration Tools .mex file, which contains the settings of the peripherals, pins and clocks which will be initialized on the board. MBDT for S32K3 uses external configuration tools (S32 Configuration Tools and EB Tresos) for allowing the board configuration.
2. The model allows the selection of two different transceivers (TJA1153 or TJA1043) to be initialized by the application, selection which can be enabled by clicking one of the buttons inside the Simulink top model.
By default, the model is configured to enable TJA1153, initializing the transceiver's on-board connections for an S32K3x4EVB-Q257 evaluation board.
The model also provides the initialization settings for TJA1153 on an S32K3X4EVB-Q172 evaluation board. In order to enable that one, you would need to change the processor targeted by the application by following the steps described in the section Prepare the demo of the help file associated to this model (s32k3xx_can_receive_s32ct_example_readme.html).
In case you are using a different board, or a different transceiver, you would need to make the necessary adjustments to this implementation to ensure a correct initialization sequence.
Moving back to the top model, the execution of the CanIf_RxIndication callback is interrupt driven, the function being executed whenever a Can frame is received. The function is called inside the logic implemented by the drivers MBDT generates code on top of (MBDT blocks generate code on top of RTD - Real-Time Drivers APIs), so there is no explicit call of this function inside the application generated code. However, the implementation of this callback can be found inside the s32k3xx_can_receive_s32ct.c file.
For more information on the RTD Can API, you could check the following documents:
Hope this description provides a clearer overview of MBDT for S32K3 applications and of this Can model implementation.
Considering all these, could you please let us know:
Thank you,
Irina
Hi @HarryQi,
The application used for the screenshots in this thread can be found inside the MBDT for S32K3 toolbox, under the <toolbox_installation_root>/S32K3_Examples/can folder. You could check both the s32k3xx_can_receive_s32ct.mdl and s32k3xx_can_transmit_ebt.mdl for an example of how TJA1153 can be initialized in Simulink.
Regards,
Irina
Thankyou Irina.
As per screenshot you have attached, I am unable to see that option which allows me to select CAN transceiver type. I have attached the screenshot of the same below.
Can you please tell me which MBDT NXP toolbox you are using in which we are getting this option to select CAN transceiver.