Timer 1 minimum period
Peter Everett (9846) 59 posts |
I’ve been using RPCEmu 0.9.4 (windows) running os 5.28 and I have a problem with timer 1 not giving me a 1ms interrupt. It seems to limit at 2ms even though the period is reported as being 1ms. No error is produced when the period is set, it is just ignored. Periods of 2ms and longer work correctly. The code works fine on a Pi4 (os 5.29 16/12/23). Is this an RPCEmu limitation ? I can cope with the reduced rate but it would be nice to be able to read the actual rate, rather than having to time it against the system ticker to find out. For both Pi4 and RPCEmu, HAL_TimerMaxPeriod and HAL_TimerReadCountdown always return 1 and HAL_TimerPeriod always returns what is set by HAL_TimerSetPeriod. Here are the return values for the HAL timer calls. (input value for HAL_TimerSetPeriod) RPCEmu PI4 HAL_Timers 2 2 HAL_TimerDevice (timer 1) 6 3 HAL_TimerGranularity 2000000 1000000 HAL_TimerMaxPeriod 1 1 HAL_TimerSetPeriod 2000 1000 HAL_TimerPeriod 2000 1000 HAL_TimerReadCountdown 1 1 rate relative to system ticker 5x 10x |
André Timmermans (100) 655 posts |
I am not sure that you will get what you want on RPCEmu. I used Timer1 with non-Hal machines to derive how much CPU TimPlayer used in order to limit the number of notes it was attempting to play. On RPCEmu the CPU % was just jumping between a few fixed values, indicating that the timer wasn’t updated at a very high frequency. |
Peter Everett (9846) 59 posts |
André, |