Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect hardware reset cause sets for watchdog reset on stm32h743zi #53002

Closed
PragatiGarg-eaton opened this issue Dec 13, 2022 · 1 comment · Fixed by #53111
Closed

Incorrect hardware reset cause sets for watchdog reset on stm32h743zi #53002

PragatiGarg-eaton opened this issue Dec 13, 2022 · 1 comment · Fixed by #53111
Assignees
Labels
area: HWINFO Hardware Information Driver bug The issue is a bug, or the PR is fixing a bug platform: STM32 ST Micro STM32 priority: low Low impact/importance bug

Comments

@PragatiGarg-eaton
Copy link

Incorrect hardware reset cause sets for watchdog reset on stm32h743zi

Received reset cause = 0x01 (i.e., Bit 0 : Reset via external user defined pin)
In case of watchdog reset, 2 bits should be set (i.e., watchdog and reset pin) and cause id value should be "17".

  • While correct reset cause sets for watchdog reset on stm32f429 and software reset on stm32h743 ((i.e., "3").

Note : STM32 SoCs implement various reset types by pulling the reset pin low. Therefore, these reset types set
the PINRST flag, even if the reset was not caused by an actual pin reset event. Which means the Reset pin bit
will be set every time the system gets reset along with the actual reset cause
git issue links : #43319 #37524

Target used : stm32h743zi
Zephyr version : v3.1.0-

To Reproduce
case 1 : watchdog reset
Enable the hardware info and watchdog in proj.conf of the project.

proj.conf-

CONFIG_LOG=y
CONFIG_WDT_LOG_LEVEL_DBG=y
CONFIG_WATCHDOG=y
CONFIG_WDT_DISABLE_AT_BOOT=n
CONFIG_HWINFO=y

Code:
main.cpp-

#include <zephyr/zephyr.h>
#include <zephyr/device.h>
#include <zephyr/drivers/watchdog.h>
#include <zephyr/sys/printk.h>
#include <stdbool.h>
#include <zephyr/drivers/hwinfo.h>

void reset_cause( void )
{
	int8_t ret_value;
        
        /* Retrieve cause of device reset*/
	ret_value = hwinfo_get_reset_cause( &reset_cause_id );
	if ( ret_value < 0 )
	{
		// Unexpected negative return value
		printk( "System Reset: Unexpected negative return value\n" );
	}

	printk( "System Reset Cause: %d\n", reset_cause_id );

	// Clearing the reset cause reason flag .
	hwinfo_clear_reset_cause();
}

Expected behavior

  • The expected cause id : 17; reset cause due to watchdog. As, 3rd bit : watchdog and 0th bit : reset pin (always set for stm controller). But the observed result is 0x01 (Reset via external user defined pin)

Impact

  • Incorrect reset cause id observed for watchdog reset cause.
  • Multiple reset cause id observed even for the single reset cause.

Environment
Windows OS
IDE Used : Platform IO and Eclipse

@PragatiGarg-eaton PragatiGarg-eaton added the bug The issue is a bug, or the PR is fixing a bug label Dec 13, 2022
@erwango erwango self-assigned this Dec 13, 2022
@erwango erwango added priority: low Low impact/importance bug platform: STM32 ST Micro STM32 area: HWINFO Hardware Information Driver labels Dec 13, 2022
@erwango
Copy link
Member

erwango commented Dec 15, 2022

@PragatiGarg-eaton please check #53111

erwango added a commit to erwango/zephyr that referenced this issue Dec 15, 2022
On some STM32 series (H7, MP1), iwdg and wwdg have multiple instances.
Due to current driver implementation, these wdg instances were not
checked in the function.

Fixes zephyrproject-rtos#53002

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
fabiobaltieri pushed a commit that referenced this issue Dec 19, 2022
On some STM32 series (H7, MP1), iwdg and wwdg have multiple instances.
Due to current driver implementation, these wdg instances were not
checked in the function.

Fixes #53002

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: HWINFO Hardware Information Driver bug The issue is a bug, or the PR is fixing a bug platform: STM32 ST Micro STM32 priority: low Low impact/importance bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants