Hello, I need to generate a sound with a variable frequency during time (a siren).
I'm using uC K32L2B21, library SDK_2.9.0_K32L2B21xxxxA, MCUxpresso config tools v9, and TPM as a HW resource.
But I didn't find a way to dynamically change the frequency of a timer in a TPM library.
Pulse-Frequency-Modulation seems not supported on this chip.
I found only one timer API function that can be used for frequency changing (TPM_SetupPwm), but it entails constant period. What is the best way to generate variable frequency PWM?
Thank you in advance.
Solved! Go to Solution.
Hi @nre ,
There is a inline function in fsl_tpm.h
static inline void TPM_SetTimerPeriod(TPM_Type *base, uint32_t ticks)
{
base->MOD = ticks;
}
Regards,
Jing
Hi @nre ,
There is a inline function in fsl_tpm.h
static inline void TPM_SetTimerPeriod(TPM_Type *base, uint32_t ticks)
{
base->MOD = ticks;
}
Regards,
Jing