cancel
Showing results for 
Search instead for 
Did you mean: 

HRTIM fault clearing

OJ
Associate II

Hi,

I'm thinking what is the right way to clear HRTIM interrupt status register (HRTIM_ISR) bits?

In the description of the HRTIM_ISR register STM32G4 reference manual (RM0440 Rev 8 page 1041) says: This bit is set by hardware when fault 1 event occurs. It is cleared by software writing it at 1.

This gives the impression that you can clear HRTIM_ISR bits by writing to this register (HRTIM_ISR)

Then again bits of this register are read only ('r')?

Then we also have HRTIM interrupt clear register (HRTIM_ICR) (RM0440 Rev 8 page 1042) where we have separate bits to clear HRTIM_ISR bits.

So, which is the right way to clear HRTIM_ISR bits? Or can you clear these bits both ways?

1 ACCEPTED SOLUTION

Accepted Solutions
Pierre_Paris
ST Employee

Hello @OJ,

Thanks for your question and feedback !

"This gives the impression that you can clear HRTIM_ISR bits by writing to this register (HRTIM_ISR)" -> Indeed, you are right, the sentence is ambiguous. We will specifies the register HRTIM_ICR for next rev. I confirm that if you want to clear the flag in HRTIM_ISR you need to write at 1 the corresponding bit in HRTIM_ICR.

I advise you to use this macro define in STM32G4xx_HAL_Driver :

/** @brief  Clears the specified HRTIM common pending flag.
  * @param  __HANDLE__ specifies the HRTIM Handle.
  * @param  __INTERRUPT__ specifies the interrupt pending bit to clear.
  *        This parameter can be one of the following values:
  *            @arg HRTIM_IT_FLT1: Fault 1 interrupt clear flag
  *            @arg HRTIM_IT_FLT2: Fault 2 interrupt clear flag
  *            @arg HRTIM_IT_FLT3: Fault 3 clear flag
  *            @arg HRTIM_IT_FLT4: Fault 4 clear flag
  *            @arg HRTIM_IT_FLT5: Fault 5 clear flag
  *            @arg HRTIM_IT_FLT6: Fault 6 clear flag
  *            @arg HRTIM_IT_SYSFLT: System Fault interrupt clear flag
  *            @arg HRTIM_IT_DLLRDY: DLL ready interrupt clear flag
  *            @arg HRTIM_IT_BMPER: Burst mode period interrupt clear flag
  * @retval None
  */
#define __HAL_HRTIM_CLEAR_IT(__HANDLE__, __INTERRUPT__)   ((__HANDLE__)->Instance->sCommonRegs.ICR = (__INTERRUPT__))

 

Kind Regards,

Pierre

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

View solution in original post

4 REPLIES 4
Pierre_Paris
ST Employee

Hello @OJ,

Thanks for your question and feedback !

"This gives the impression that you can clear HRTIM_ISR bits by writing to this register (HRTIM_ISR)" -> Indeed, you are right, the sentence is ambiguous. We will specifies the register HRTIM_ICR for next rev. I confirm that if you want to clear the flag in HRTIM_ISR you need to write at 1 the corresponding bit in HRTIM_ICR.

I advise you to use this macro define in STM32G4xx_HAL_Driver :

/** @brief  Clears the specified HRTIM common pending flag.
  * @param  __HANDLE__ specifies the HRTIM Handle.
  * @param  __INTERRUPT__ specifies the interrupt pending bit to clear.
  *        This parameter can be one of the following values:
  *            @arg HRTIM_IT_FLT1: Fault 1 interrupt clear flag
  *            @arg HRTIM_IT_FLT2: Fault 2 interrupt clear flag
  *            @arg HRTIM_IT_FLT3: Fault 3 clear flag
  *            @arg HRTIM_IT_FLT4: Fault 4 clear flag
  *            @arg HRTIM_IT_FLT5: Fault 5 clear flag
  *            @arg HRTIM_IT_FLT6: Fault 6 clear flag
  *            @arg HRTIM_IT_SYSFLT: System Fault interrupt clear flag
  *            @arg HRTIM_IT_DLLRDY: DLL ready interrupt clear flag
  *            @arg HRTIM_IT_BMPER: Burst mode period interrupt clear flag
  * @retval None
  */
#define __HAL_HRTIM_CLEAR_IT(__HANDLE__, __INTERRUPT__)   ((__HANDLE__)->Instance->sCommonRegs.ICR = (__INTERRUPT__))

 

Kind Regards,

Pierre

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Sarra.S
ST Employee

Hello @OJ,

Thank you for your post 

>>Then again bits of this register are read-only ('r')?

Indeed, the description in the RM0440 of the bits FLT1 to FLT6 is not correct, I reported this typo internally (Ticket 176481). 

To clear the interrupt service register, use the HRTIM interrupt clear register (HRTIM_ICR). 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

OJ
Associate II

Hi,

Thank you for your answer and advice!

Now everything is clear.

 

Sama S

Ta that makes better sense!

Does the same error apply here?:..........

Extracts from RM3604 - the STM32F334 reference manual

21.5.41
HRTIM Interrupt Status Register (HRTIM_ISR)
Bit 16 DLLRDY: DLL Ready Interrupt Flag
This bit is set by hardware when the DLL calibration is completed.
IT IS CLEARED BY SOFTWARE WRITING IT AT 1.

21.5.42
HRTIM Interrupt Clear Register (HRTIM_ICR)
Bit 16 DLLRDYC: DLL Ready Interrupt flag Clear
WRITING 1 TO THIS BIT CLEARS THE DLLRDY FLAG IN HRTIM_ISR REGISTER.

Are both methods of clearing DLL Ready flag correct?
Or is the first one wrong - same author - same error??