Stuck in a delay function

Hello everyone, i am beginner in RIOT OS, i have been trying to run the blinky led program, if i comment the delay function the led is glowing but when using delay i am getting problem, when i traced the function i noticed it is stuck in delay function.

In ‘void ztimer_sleep(ztimer_clock_t *clock, uint32_t duration)’ function definition.

void ztimer_sleep(ztimer_clock_t *clock, uint32_t duration) { assert(!irq_is_in());

mutex_t mutex = MUTEX_INIT_LOCKED;

ztimer_t timer = {
    .callback = _callback_unlock_mutex,
    .arg = (void *)&mutex,

/* correct board / MCU specific overhead */
if (duration > clock->adjust_sleep) {

    duration -= clock->adjust_sleep;

else {
    duration = 0;

ztimer_set(clock, &timer, duration);



at the last of this function the mutex_lock(&mutex), the program become stuck at this point. I don’t know the reason behind it, please help me to resolve this issue.

It’s expected that the program waits for an interrupt on mutex_lock(&mutex) - the idea is that this interrupt will be generated by the timer once the timer is expired.

I assume you are still in the process of bringing up a new platform? Do you have support for interrupts and timers yet?

yes we do have support for interrupt and timers.

for interrupt generation should we need to use our timers ??so that control reach to callback function. or ztimer is using to call interrupt.

for peripheral timer interrupt we need to add our timers.

is i am right mate??

Is tests/periph/timer working for you? You might want to check if the callback function of your timer gets properly executed / if the timer is triggering an interrupt at all.

the callback above one that is i am getting, but it is not accurate and i haven’t configure timer yet. getting callback from Ztimer.

One more problem i am facing. actually in our micro controller there is no PLIC interrupt controller, we are just using simple interrupt controller. when i tried configure interrupt part in it by taking reference of other RISC-V architecture board they have PLIC mechanism, and all the function related to PLIC is already available in RISC-V common folder. Can i map the interrupt mechanism (SIC) of our board in cpu/(my_board)/ periph folder or in riscv_common??

You will have to add support for your interrupt controller to riscv_common as it’s a new type of interrupt controller that is not supported yet AFAIK.