Configuration of CAN for S32K344

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

Configuration of CAN for S32K344

5,112 Views
anagha12
Contributor I

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. 

0 Kudos
Reply
9 Replies

5,052 Views
anagha12
Contributor I

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.

0 Kudos
Reply

5,059 Views
anagha12
Contributor I

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.

0 Kudos
Reply

5,031 Views
Irina_Costachescu
NXP Employee
NXP Employee

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

 

0 Kudos
Reply

4,968 Views
anagha12
Contributor I

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.

0 Kudos
Reply

4,598 Views
Irina_Costachescu
NXP Employee
NXP Employee

Hi @anagha12 

Let's address the questions in this thread separately. First, I would like to establish if Can frames are received on S32K344.
 
As explained in my previous reply, the CanIf_RxIndication function is not explicitly called inside the application generated code, so you will not be able to find it in ert_main.c. This is ok, because CanIf_RxIndication is called inside the drivers MBDT blocks generates code on top of, being a callback which is executed whenever a Can frame is received. Please note that MBDT blocks generate code on top of already implemented C functions, part of the RTD - Real-Time Drivers.
 
Could you please provide us the following details?
 
- For being able to receive Can messages, TJA1044 needs to be set in Normal mode (please check the attached datasheet of the transceiver - https://www.nxp.com/docs/en/data-sheet/TJA1044.pdf).
According to this document, STB pin of the transceiver must be set to LOW for the transceiver to operate in Normal mode. On your board, to what is your STB pin connected to? Please check the board schematics.
- On your hardware board, what are the CAN instance and pins (CAN_RX/TX) you are using?
- What data is the S32K344 board receiving? How do you validate the correct reception of Can frames? 
 
Thank you,
Irina
0 Kudos
Reply

4,917 Views
Irina_Costachescu
NXP Employee
NXP Employee

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.

Irina_Costachescu_0-1696155616454.png

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.

Irina_Costachescu_1-1696155642606.png

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.

Irina_Costachescu_2-1696155696207.png

By default, the model is configured to enable TJA1153, initializing the transceiver's on-board connections for an S32K3x4EVB-Q257 evaluation board.

Irina_Costachescu_3-1696156259424.png

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:

  • What evaluation board you are using for testing this example?
  • Are you using MBDT for S32K3 v1.4.0 or a different one?

 

Thank you,
Irina

0 Kudos
Reply

3,830 Views
HarryQi
Contributor III
Hello,Irina ,can you please send the demo model you post as screenshot in this thread ,i want to use it as a reference model to know how to initialize TJA1153A using MBTD & s32 ct
0 Kudos
Reply

3,824 Views
Irina_Costachescu
NXP Employee
NXP Employee

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

0 Kudos
Reply

4,906 Views
anagha12
Contributor I

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.

 

0 Kudos
Reply