I have a conceptual/super simple test case whose result I'm struggling to fathom.
All the configuration is as set in the STM32F407 Discovery demo, discovery board is the hardware platform. Tested with -O2 and -O0, no difference.
I wanted to verify that among all the threads ready for execution, the one with the highest priority is the one being executed,
no exceptions to this rule.
It seems to be the case, what I find striking is the behavior of the blinker thread, I would expect it to alternate output state at 10 Hz.
Code: Select all
22 /*
23 * This is a periodic thread that does absolutely nothing except flashing
24 * a LED.
25 */
26 static THD_WORKING_AREA(waThread1, 128);
27 static THD_FUNCTION(Thread1, arg) {
28
29 (void)arg;
30 chRegSetThreadName("blinker");
31 while (true) {
32 chThdSleepMilliseconds(100);
33 palTogglePad(GPIOD, GPIOD_LED3); /* Orange. */
34 }
35 }
36
37 /*
38 * Application entry point.
39 */
40 int main(void) {
41
42 /*
43 * System initializations.
44 * - HAL initialization, this also initializes the configured device drivers
45 * and performs the board-specific initializations.
46 * - Kernel initialization, the main() function becomes a thread and the
47 * RTOS is active.
48 */
49 halInit();
50 chSysInit();
51
52 /*
53 * Creates the example thread.
54 */
55 chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO+1, Thread1, NULL);
56
57 /*
58 * Normal main() thread activity, in this demo it does toggle
59 * a yellow led as fast as possible while in running state.
60 */
61 while (true)
62 {
63 palTogglePad (GPIOD, GPIOD_LED4); /* Yellow. */
64 }
65 }
Output registered with logic analyzer (colours of the channels map to the leds):
Any ideas?
Raul