i'm using the last available ChibiStudio release (With ChibiOS eclipse tools 2.5.0) and a STM32F401RE Nucleo board.
I'm working on the following code:
Code: Select all
#include "ch.h"
#include "hal.h"
#include "chprintf.h"
BaseSequentialStream* chp = (BaseSequentialStream*) &SD2;
static virtual_timer_t led_vt;
/*
* timer callback.
*/
static void cb(void *arg) {
chprintf(chp,"Hi!\r\n");
chSysLockFromISR();
chVTSetI(&led_vt, MS2ST(500), cb, NULL);
chSysUnlockFromISR();
}
/*
* Application main function.
*/
int main(void) {
/*
* System initializations.
* - Kernel initialization, the main() function becomes a thread * RTOS is active. Interrupts are enabled on chSysInit() exit.
*/
chSysInit();
/*
* Activates the serial driver 2 using the driver default configuration.
*/
sdStart(&SD2, NULL);
/* timer initialization.*/
chVTObjectInit(&led_vt);
/* Starting .*/
chVTSet(&led_vt, MS2ST(500), cb, NULL);
}
That's supposed to display " hi " every 500ms, but it's not working, i can't see anything on my terminal.
Do i have to enable any particular driver or something for Virtual Timers?