-
I have a problem with simple example, where interrupt set semaphore and thread take this semaphore. It does not work for me when ISR is executed with period less than 50 ms. My example toggle with LEDs in ISQ as well as in thread. During tracing I see following: It looks, that idle is NOT interrupted by thread_a. /* main.c - Hello World demo */ /*
#include <zephyr.h> //#include <logging/log.h> struct counter_top_cfg top_cfg; #define COUNTER_PERIOD 50000 /* = 50 ms [us] / #define LED0_NODE DT_ALIAS(led0) #if !DT_NODE_HAS_STATUS(LED0_NODE, okay) #if !DT_NODE_HAS_STATUS(LED1_NODE, okay) struct led { static const struct led ld1 = { static const struct led ld2 = { const struct gpio_dt_spec *ld1_spec = &ld1.spec; volatile uint8_t g_cnt_counter_ld1=0; static const char * const devices_counter[] = { /* size of stack area used by each thread */ /* scheduling priority used by each thread / /* define semaphores */ static void counter_interrupt_callback(const struct device *dev, void *user_data) /* #21111 */ void counter_interrupt_period_setup(const struct device *p_counter_dev) top_cfg.flags = 0; printk("%u ticks\n", top_cfg.ticks);
} void threadA(void *dummy1, void *dummy2, void *dummy3)
} K_THREAD_STACK_DEFINE(threadA_stack_area, STACKSIZE); void main(void)
int ret; device_is_ready(ld1_spec->port); device_is_ready(ld2_spec->port);
} counter_interrupt_period_setup(counter_dev);
} /* */ |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
The issue with rescheduling is solved when ISR_DIRECT_DECLARE returns different value to 0. This needs to be managed in STM32 Counter driver, see: https://github.com/zephyrproject-rtos/zephyr/blob/6a838bfaba59f75675b5641305277f6ec9bdff76/drivers/counter/counter_ll_stm32_timer.c#L587 Explanation, rescheduling after interrupt happen when z_arm_int_exit() is called when ISR finish. This can be done in ISR_DIRECT_FOOTER(). |
Beta Was this translation helpful? Give feedback.
The issue with rescheduling is solved when ISR_DIRECT_DECLARE returns different value to 0. This needs to be managed in STM32 Counter driver, see: https://github.com/zephyrproject-rtos/zephyr/blob/6a838bfaba59f75675b5641305277f6ec9bdff76/drivers/counter/counter_ll_stm32_timer.c#L587
Explanation, rescheduling after interrupt happen when z_arm_int_exit() is called when ISR finish. This can be done in ISR_DIRECT_FOOTER().