Long times ago I played with ChibiOS/RT and RPI, now I got some time to dig a bit deeper. Before I used Microchip PIC which comes with an IDE, but I don't want to stuck with the PIC so I started with RPI with GCC cross compiler.
I had a look on the RPI port and I found the IRQ handler in the hal_lld.c and I have a few questions regarding the code. In the ChibiOS/RT documentation is written that all the interrupts handler has to be defined in the macro.
Code: Select all
CH_IRQ_HANDLER(IrqHandler)
{
CH_IRQ_PROLOGUE();
systimer_serve_interrupt();
#if HAL_USE_SERIAL
sd_lld_serve_interrupt(&SD1);
#endif
#if HAL_USE_I2C
i2c_lld_serve_interrupt(&I2C0);
#endif
#if HAL_USE_SPI
spi_lld_serve_interrupt(&SPI0);
#endif
#if HAL_USE_GPT
gpt_lld_serve_interrupt();
#endif
CH_IRQ_EPILOGUE();
}
Is the IrqHandler is defined in the vector.s file?
Regarding the code above, if a hardware interruption has occurred the systimer_serve_interrupt function will be called
void chSysTimerHandlerI (void)
Handles time ticks for round robin preemption and timer increments.
If I enabled only the interruption of the system timer and initialize the timer to have 1ms interruption, which mean that the chSysTimerHandlerI will be called every 1ms. But if I enabled other interruption like SPI, UART etc, than the interruption occurs more often than 1ms which means that the chSysTimerHandlerI will be called more often. My question is how accurate the OS time/virtual timers?
Code: Select all
static void systimer_serve_interrupt( void )
{
// Update the system time
chSysLockFromIsr();
chSysTimerHandlerI();
chSysUnlockFromIsr();
// Clear timer interrupt
ARM_TIMER_CLI = 0;
}Regards,
Robert