2024-10-03 10:49 AM
How to enable HRTIMER system faults? I have successfully used faults coming from other peripherals to turn off HRTIMER outputs (e.g. internal comparators), but can't get system hard faults to produce the same result. I have enabled all faults in the SYSCFG_CFGR2 register. What else needs to be configured?
Thanks!
2024-10-03 11:00 AM
I think, you have to write in the hard fault INT , what you (it..) should do then.
void HardFault_Handler(void)
{
/* USER CODE BEGIN HardFault_IRQn 0 */
/* USER CODE END HardFault_IRQn 0 */
while (1)
{
----------------------------
void BusFault_Handler(void)
{
/* USER CODE BEGIN BusFault_IRQn 0 */
/* USER CODE END BusFault_IRQn 0 */
while (1)
{
/* USER CODE BEGIN W1_BusFault_IRQn 0 */
/* USER CODE END W1_BusFault_IRQn 0 */
}
}
/**
* @brief This function handles Undefined instruction or illegal state.
*/
void UsageFault_Handler(void)
{
/* USER CODE BEGIN UsageFault_IRQn 0 */
Same in other handlers...what it should do then. Only you know, what should happen then.
2024-10-03 11:43 AM
From the datasheet it looks like this is something that should run in hardware, the same as the Fault Inputs 1 - 6. As long as the HRTIMER instance is "Fault State" is set to "Inactive", any fault should immediately turn it off, without explicitly instructing it to do so in the Fault Handler
From the Reference Manual: Once the fault signal is conditioned as explained above, it is routed to the timing units. For any of them, the 6 fault channels are enabled using bits FLT1EN to FLT6EN in the HRTIM_FLTxR register, and they can be selected simultaneously (the sysfault is automatically enabled as long as the output is protected by the fault mechanism).
2024-10-03 12:52 PM - edited 2024-10-03 01:44 PM
Maybe i misunderstood : what you can enable in hardware...ok.
I just was thinking, you ask for other events (fault conditions), that are not in the avail conditions.
from rm :
The "fault" is at first a hardware problem: overcurrent, overvoltage etc. , then the timer stops. = protection.
The other is : what if the software or the cpu has a problem? Then ->
The sysfault is enabled in syscfg ->
All other "bad" conditions and errors are up to you: write, what should happen then... (cpu or HAL lib cannot know it.)
An example for a problem in the running program is "debug" : what should happen, if debug starts and stops the cpu/program : should timer run on or should it switch off all outputs ? You have to decide, whats good in your system and set the behavior accordingly.
Was this your question ...?
2024-10-09 08:18 AM