From 5c096dd86a2ab2c21d623beb95150be68cbc8609 Mon Sep 17 00:00:00 2001 From: Eric Brombaugh <ebrombaugh1@cox.net> Date: Fri, 12 May 2023 10:37:47 -0700 Subject: [PATCH] Update README.md --- examples/systick_irq/README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/systick_irq/README.md b/examples/systick_irq/README.md index 26e561e..9ca11cb 100644 --- a/examples/systick_irq/README.md +++ b/examples/systick_irq/README.md @@ -4,11 +4,11 @@ interrupts for timing. Many bare-metal and RTOS based embedded applications will use the Systick IRQ for timing, periodic housekeeping and task arbitration so knowing how to set that up is useful. -Note that this example is *NOT* compatible with the Delay_*() functions that are -part of the ch32v003fun library - those functions use the Systick counter for -doing busy-wait delays and assume that the CNT register rolls over at 32-bit -maximum. Do not use the built-in Delay_Ms() and related functions when using -Systick for IRQs. +This code is compatible with the busywait delay functions in the ch32v003fun +library because it allows the Systick CNT register to keep running over its full +32-bit range. It does not set the STRE bit in the CTRL register so the counter +does not reset when the CMP register matches. In order to do this, the CMP register +is advanced at every IRQ. Note also the use of the `__attribute__((interrupt))` syntax in declaring the IRQ handler. Some of the IRQ examples from the WCH HAL library have slightly -- GitLab