repeating timer not working if set to 8399ms #1550
Labels
No labels
bazel
bluetooth
board settings
boot_stage2
bug
build
c++
can't reproduce
clang
clib-interface
cmsis
code cleanliness
code size
compiler version issues
cyw43_driver
debug
discussion
documentation
duplicate
dynamic_clock
elf2uf2
enhancement
errata
filesystem
flash layout
floating point
FreeRTOS
hardware_adc
hardware_claim
hardware_clocks
hardware_dma
hardware_exception
hardware_flash
hardware_gpio
hardware_i2c
hardware_irq
hardware_pio
hardware_pwm
hardware_rcp
hardware_rtc
hardware_spi
hardware_sync
hardware_uart
hardware_vreg
hardware_watchdog
hardware_xosc
help wanted
host
IAR
installation
invalid
linker scripts
lto
lwip
mbedtls
missing API
needs reporter detail
networking
newlib
newlib-multicore
non-c
non-cmake
non-gcc
openocd
orphan PR
OS integration
pico_async_context
pico_base
pico_binary_info
pico_flash
picolibc
pico_lwip
pico_malloc
pico_multicore
pico_printf
pico_runtime
pico_stdio
pico_stdio_usb
pico_sync
pico_time
pico_util
pioasm
port
question
review
review2
rtos interop
runtime init
static library
svd
test
tinyusb
vscode
wifi integration
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-raspberrypi/pico-sdk#1550
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Hi,
while I working on a reliable reproduction of #1531, I run into this bug:
I set the Timervalue for the repeating timer to 8399ms and the watchdog to (8399 * 2) the repeating timer isn't firing
at all and the watchdog is rebooting in a loop.
example code:
multicore-repeattimer.zip
namespace {
const int32_t TIMERVALUE = 8399; /* fire timer every xx mseconds */
const int32_t WATCHDOGTM = TIMERVALUE * 2;
}
if (add_repeating_timer_ms(TIMERVALUE, timer_callback, nullptr, &_timer))
watchdog_enable(WATCHDOGTM,false);
timer_callback() is feeding the watchdog.
please note:
the main() is deadlock with mutex in the while(true) on purpose!
Isn't this expected? The max time for the watchdog is ~8.3 seconds?
I my opinion it is not expected that the Watchdog is triggered because set twice the time of the repeating timer , therefore will be restarted always if the repeating timer is working correct.
But in my finding the repeating timer is not start at all.
IMO the problem here is that if you try to set the watchdog to a too high value it silently cuts it down to 8.3s
If your code typically feeds the watchdog more often but you have a valid situation where 8.3s isn't enough you might end up in a situation where the watchdog doesn't behave as expected.
I think that there at least should be an
assert(load_value <= 0xffffffu);in there.Or even better:
assert(delay_ms <= 8389);to catch possible integer overflows when delay_ms is more than 2147484.(8389*2000 will be more than 0xffffffu, but only by 785.
Peter,
wow - that is an unexpected limitation.
I agree with add an assert() to give a clear warning, it will help a lot to avoid the issue I run into.
I will close this issue now. Thanks for your help!
Chris