I am using S32K144EVB. Is trigmux clock enable required?
Hi
Based on your previous question, it seems that you are referring to AN5303. TRGMUX_Init() in AN5303SW\S32K_FTM_Features\src\S32K_FTM_Features.c enable clock for TRGMUX module. If you do not enable clock before operating the module's register, you may get a hardfault.
Best Regards,
Robin
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------
HI Robin_Shen,
Greetings.
You are correct I am referring to AN5303 and TRGMUX_Init() function. I have copied the same function however there is compilation error. Pl see the following error message.
14:25:30 **** Build of configuration Debug for project S32K144_Project_FTM ****
make -j4 all
Building file: ../src/FTM.c
Building file: ../src/clocks_and_modes.c
Invoking: Standard S32DS C Compiler
Invoking: Standard S32DS C Compiler
Building file: ../src/main.c
arm-none-eabi-gcc "@src/FTM.args" -MMD -MP -MF"src/FTM.d" -MT"src/FTM.o" -o "src/FTM.o" "../src/FTM.c"
arm-none-eabi-gcc "@src/FTM.args" -MMD -MP -MF"src/clocks_and_modes.d" -MT"src/clocks_and_modes.o" -o "src/clocks_and_modes.o" "../src/clocks_and_modes.c"
Invoking: Standard S32DS C Compiler
arm-none-eabi-gcc "@src/FTM.args" -MMD -MP -MF"src/main.d" -MT"src/main.o" -o "src/main.o" "../src/main.c"
Building file: ../Project_Settings/Startup_Code/startup.c
Invoking: Standard S32DS C Compiler
arm-none-eabi-gcc "@Project_Settings/Startup_Code/startup.args" -MMD -MP -MF"Project_Settings/Startup_Code/startup.d" -MT"Project_Settings/Startup_Code/startup.o" -o "Project_Settings/Startup_Code/startup.o" "../Project_Settings/Startup_Code/startup.c"
../src/FTM.c: In function 'PDB0_Init':
../src/FTM.c:160:1: error: 'FSL_NVIC' undeclared (first use in this function)
FSL_NVIC->ISER[PDB0_IRQn / 32] |= (1 << (PDB0_IRQn % 32)); // Enable interrupt
^
../src/FTM.c:160:1: note: each undeclared identifier is reported only once for each function it appears in
../src/FTM.c: In function 'TRGMUX_Init':
../src/FTM.c:174:11: error: 'PCC_TRGMUX_INDEX' undeclared (first use in this function)
PCC->PCCn[PCC_TRGMUX_INDEX] = PCC_PCCn_CGC_MASK; // Enable clock for TRGMUX module
^
make: *** [src/subdir.mk:26: src/FTM.o] Error 1
make: *** Waiting for unfinished jobs....
Finished building: ../src/clocks_and_modes.c
Finished building: ../Project_Settings/Startup_Code/startup.c
Finished building: ../src/main.c
14:25:33 Build Finished (took 3s.213ms)
I have read the S32 RM regarding the PCC configuration registers. My observation is the TRGMUX peripheral does not have the PCC_TRGMUX_INDEX. Hence the compiler could not detect.
Pl suggest me the suggestion.
Regards,
Kapila
Hi Kapila,
Thank you for your hint.
I didn't check the reference manual carefully before, I only looked at AN5303SW\S32K_FTM_Features\src\S32K_FTM_Features.c and didn't realize that the header file used by this project is too old (S32K144RM Rev. 1, Draft D, 10/2015).
After checking the latest S32K1XXRM Rev.14.1, I agree with you. TRGMUX is not gated by PCC[CGC]. PCC_TRGMUX_INDEX does not exist in the new header file used by your project, so an error occurs.
Referring to the trgmux_lpit_s32k144 example in S32K1 SDK 4.0.3 in S32DS v3.4, there should be no need to enable the clock through PCC[CGC] like other peripherals.
Best Regards,
Robin
HI Robin
Greetings.
Does it mean There is no need to enable PCC clock in TRGMUX_init()? Also the core does not contain PCC configuration register?
Pl clarify regarding error related to NVIC interrupt.
Regards,
Kanakaraju Kapila
There is no need to enable PCC clock in TRGMUX_init(). The ARM Cortex M4 core does not contain PCC configuration register.
If you are using S32K1 SDK in S32DS, just call INT_SYS_EnableIRQ(IRQn_Type irqNumber)
SDK/platform/drivers/src/interrupt/interrupt_manager.c