Current implementation of T2 - T5 times on the STM32 platform does not work properly. After configuring the timer-counter circuit to report interrupts every 10ms, in reality the first interrupt is reported only once after a few seconds, while subsequent interrupts do not come. The current code also does not properly emulate the operation of even the basic functions of the TIME-BASE unit. This patch contains fixes that reimplements the basic functionality of the time base unit such as up-counting down-counting , and alternate- mode up-down counting. The ptimer() API is used to emulate timers. After applying the patch, STM32 timer works correctly in its basic functionality. The ISIX-RTOS test unit was used to test the patch. Links and instructions can be found below:
https://github.com/lucckb/isixrtos/blob/master/tests/libisix/01_basic_primitives.cpp https://github.com/lucckb/isixrtos/blob/master/extras/doc/unit_test_qemu.md qemu-system-arm -M olimex-stm32-h405 -kernel build/tests/libisix/isixunittests.binary -nographic unittests_entry.cpp:146|ISIX VERSION pub/ep0319-157-gb239b35f-dirty unittests_entry.cpp:83|Exceptions pretest. OK 51 selected tests [ RUN ] 01_base_00 TimeBase timer vs systick [ 1001ms ] ... [ RUN ] 01_base_01 Basic heap allocator [ 1ms ] ... Lucjan Bryndza (20): Fixing the basic functionality of STM32 timers Fixing the basic functionality of STM32 timers Fixing the basic functionality of STM32 timers Fixing the basic functionality of STM32 timers Fixing the basic functionality of STM32 timers Fixing the basic functionality of STM32 timers Fixing the basic functionality of STM32 timers Fixing the basic functionality of STM32 timers Fixing the basic functionality of STM32 timers Fixing the basic functionality of STM32 timers Fixing the basic functionality of STM32 timers Fixing the basic functionality of STM32 timers Fixing the basic functionality of STM32 timers Fixing the basic functionality of STM32 timers Fixing the basic functionality of STM32 timers Fixing the basic functionality of STM32 timers Fixing the basic functionality of STM32 timers Fixing the basic functionality of STM32 timers Fixing the basic functionality of STM32 timers Fixing the basic functionality of STM32 timers hw/arm/stm32f405_soc.c | 2 +- hw/timer/stm32f2xx_timer.c | 262 +++++++++++++++++++---------- include/hw/timer/stm32f2xx_timer.h | 23 ++- 3 files changed, 189 insertions(+), 98 deletions(-) -- 2.38.5