Open Wenn0101 opened 4 years ago
This issue persists in AmbiqSuite SDK 2.5.1 and does not have a patch branch
The comment above is false "One is in STCFG, the other is in STMINTEN. The HAL only provides access to STMINTEN, thus you cannot enable sTimer Compare Interrupts using just the HAL."
You have access to STCFG in am_hal_stimer_config.
am_hal_stimer_config(uint32_t ui32STimerConfig) { ... CTIMER->STCFG = ui32STimerConfig;
That would mean you would need to set up the am_hal_stimer_config input parameters properly using one of these:
#define AM_HAL_STIMER_CFG_COMPARE_A_ENABLE _VAL2FLD(CTIMER_STCFG_COMPARE_A_EN, CTIMER_STCFG_COMPARE_A_EN_ENABLE)
#define AM_HAL_STIMER_CFG_COMPARE_B_ENABLE _VAL2FLD(CTIMER_STCFG_COMPARE_B_EN, CTIMER_STCFG_COMPARE_B_EN_ENABLE)
#define AM_HAL_STIMER_CFG_COMPARE_C_ENABLE _VAL2FLD(CTIMER_STCFG_COMPARE_C_EN, CTIMER_STCFG_COMPARE_C_EN_ENABLE)
#define AM_HAL_STIMER_CFG_COMPARE_D_ENABLE _VAL2FLD(CTIMER_STCFG_COMPARE_D_EN, CTIMER_STCFG_COMPARE_D_EN_ENABLE)
#define AM_HAL_STIMER_CFG_COMPARE_E_ENABLE _VAL2FLD(CTIMER_STCFG_COMPARE_E_EN, CTIMER_STCFG_COMPARE_E_EN_ENABLE)
#define AM_HAL_STIMER_CFG_COMPARE_F_ENABLE _VAL2FLD(CTIMER_STCFG_COMPARE_F_EN, CTIMER_STCFG_COMPARE_F_EN_ENABLE)
#define AM_HAL_STIMER_CFG_COMPARE_G_ENABLE _VAL2FLD(CTIMER_STCFG_COMPARE_G_EN, CTIMER_STCFG_COMPARE_G_EN_ENABLE)
#define AM_HAL_STIMER_CFG_COMPARE_H_ENABLE _VAL2FLD(CTIMER_STCFG_COMPARE_H_EN, CTIMER_STCFG_COMPARE_H_EN_ENABLE)
am_hal_stimer_config(AM_HAL_STIMER_CFG_CLEAR | AM_HAL_STIMER_CFG_FREEZE);
am_hal_stimer_config(AM_HAL_STIMER_HFRC_3MHZ | AM_HAL_STIMER_CFG_COMPARE_A_ENABLE);
Quick Steps to Reproduce:
Description There are 2 bits that need to be set in order to actually enable sTimer compare interrupts One is in STCFG, the other is in STMINTEN. The HAL only provides access to STMINTEN, thus you cannot enable sTimer Compare Interrupts using just the HAL.
So for example, if you wanted to use Compare A you would need to set both bit 8 of STCFG: And bit 0 of STMINTEN:
Calling:
Allows user to set STMINTEN, but the HAL provides no way of setting the bit in STCFG.
In am_hal_stimer_compare_delta_set() we see:
However, since it is masked with its starting value, the bit is never set.
Suggestions: