why i cannot select internal clock in matlab for s32k116?

5 visualizaciones (últimos 30 días)
Vikash
Vikash el 6 de Mayo de 2025
Editada: Vikash el 14 de Mayo de 2025
In the nxp tool box the clock selection for the internal clock is not available.Since we could not perform certain task the antipinch detection algorithm using LPIT timer

Respuestas (2)

Shaunak
Shaunak el 13 de Mayo de 2025
Editada: Shaunak el 14 de Mayo de 2025
Hi Vikash,
It sounds like your issue is related to the clock source configuration in the NXP ‘Model-Based Design Toolbox’ (MBDT) for the ‘S32K116’ MCU, specifically the inability to select the internal clock directly from the Simulink configuration parameters. By default, the generated code for the ‘S32K116’ uses the external clock, as this is the typical setting for the evaluation board (EVB).
If you need to use the internal fast clock, you will need to manually modify the ‘s32k_clock_init.c file after code generation. Here are the steps you can follow:
  1. Locate the file: After generating code from Simulink, find the ‘s32k_clock_init.c file in your project directory. This file is typically copied from: {Toolbox installation path}\mbdtbx_s32k11x\src\c_library\s32k_clock_init.c
  2. Open the file: Open _clock_init.c in a text editor or an IDE.
  3. Modify the clock source: Locate the section in the file where the clock source is set. Change the configuration from the external clock to the internal fast clock by updating the relevant registers or settings. The specific changes will depend on your application, but typically involve setting the appropriate bits for the internal clock source in the initialization structure.
  4. Save and build: Save the modified file and proceed with building and flashing your project as usual.
For more information, please refer to the following community thread from NXP:
  2 comentarios
Vikash
Vikash el 13 de Mayo de 2025
Editada: Walter Roberson el 14 de Mayo de 2025
Can we change in the tlc file to get the internal clock to work. If i change in .c file each time if build the code it will change to external clock right? Do you have abny solution for this?
Shaunak
Shaunak el 14 de Mayo de 2025
Editada: Shaunak el 14 de Mayo de 2025
I believe you'll have to edit it everytime the code is built, I don't think there's another approach as such for now. I guess your best option is to save the files in another place as mentioned in the documentation below.

Iniciar sesión para comentar.


Vikash
Vikash el 14 de Mayo de 2025
Editada: Vikash el 14 de Mayo de 2025
Do you have any other solution.Can we create a s-function accordingly.if i change every time,its like manually aprroach right.Do you have any option t automatically generate the code.Can we create user matlab function forr configuring the registers for the internal clock based so that we our selves can generate the code by automatically.

Productos


Versión

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by