Skip to content

Commit

Permalink
[fix][wdg] add wdg access key for wdg resetcounter
Browse files Browse the repository at this point in the history
  • Loading branch information
sakumisue committed Nov 4, 2023
1 parent 587ac54 commit b263c11
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
2 changes: 2 additions & 0 deletions drivers/lhal/src/bflb_wdg.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ void bflb_wdg_init(struct bflb_device_s *dev, const struct bflb_wdg_config_s *co
regval |= (config->clock_div << TIMER_WCDR_SHIFT);
putreg32(regval, reg_base + TIMER_TCDR_OFFSET);

putreg16(0xBABA, reg_base + TIMER_WFAR_OFFSET);
putreg16(0xEB10, reg_base + TIMER_WSAR_OFFSET);
regval = getreg32(reg_base + TIMER_WCR_OFFSET);
regval |= TIMER_WCR;
putreg32(regval, reg_base + TIMER_WCR_OFFSET);
Expand Down
9 changes: 0 additions & 9 deletions examples/peripherals/wdg/wdg_reset/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,9 @@ int main(void)
bflb_wdg_reset_countervalue(wdg);
printf("Delay 1s, triggle set 2s, wdg should not reset, pass.\r\n");

bflb_wdg_set_countervalue(wdg, 4000);
bflb_mtimer_delay_ms(2000);
printf("Delay 2s, triggle set 4s, wdg should not reset, pass.\r\n");

printf("Exception test addr: 0x%08x\r\n", TEST_ADDR);
getreg32(TEST_ADDR);

/* delay 2s will trigger wdg interrupt */
bflb_mtimer_delay_ms(2000);
bflb_wdg_reset_countervalue(wdg);
bflb_wdg_stop(wdg);

printf("Error! Can't run to here, delay 2s, wdg should reset, current count = %d\r\n",
bflb_wdg_get_countervalue(wdg));

Expand Down

0 comments on commit b263c11

Please sign in to comment.