why i cannot select internal clock in matlab for s32k116?

조회 수: 5 (최근 30일)
Vikash
Vikash 2025년 5월 6일
편집: Vikash 2025년 5월 14일
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

답변 (2개)

Shaunak
Shaunak 2025년 5월 13일
편집: Shaunak 2025년 5월 14일
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
Vikash
Vikash 2025년 5월 13일
편집: Walter Roberson 2025년 5월 14일
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 2025년 5월 14일
편집: Shaunak 2025년 5월 14일
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.

댓글을 달려면 로그인하십시오.


Vikash
Vikash 2025년 5월 14일
편집: Vikash 2025년 5월 14일
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.

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by