RZA2M

Hi Team,

I am using the RZA2M for my project. I want a falling edge interrupt. I set it by R_IRQ_SetSense(3,1);  I am using the IRQ3 for my application but when I am using the interrupt IRQ3 the R_OS_TaskSleep(50) is used to make a delay. But when I debug the code get stuck in this R_OS_Tasksleep

void R_OS_TaskSleep(uint32_t sleep_ms)
{
    uint32_t target_tickcount;

    /* get the system tick count appropriate for the sleep_ms argument */
    target_tickcount = get_timeout_tickcount(sleep_ms);

    /* Delay the task for the specified duration */
    do
    {
        R_COMPILER_Nop();
    }
    while (s_interrupt_counter < target_tickcount);

    }
e_r_drv_intc_err_t R_IRQ_SetSense( e_r_drv_irq_num_t irq_num, e_r_drv_irq_sense_t sense)
{
    uint16_t dummy16;
    uint16_t mask;

    /* check irq num */
    if( irq_num > INTC_IRQ7 )
    {
        return INTC_ERR_INVALID_NUM;
    }

    /* check sense */
    if( sense > IRQ_SENSE_BOTHEDGE )
    {
        return INTC_ERR_INVALID_SENSE;
    }

    /* make ICR1 IRQ sense register mask */
    mask = (uint16_t)( 3u << (irq_num * 2u) );

    /* read ICR1 register */
    dummy16 = RZA_IO_RegRead_16(&INTC.ICR1.WORD, IOREG_NONSHIFT_ACCESS, IOREG_NONMASK_ACCESS);

    /* clear target bit of ICR1 register */
    dummy16 &= (uint16_t)(~mask);

    /* modify target bit of ICR1 register */
    dummy16 |= (uint16_t)( sense << ( irq_num * 2u) );

    /* write back to ICR1 register */
    RZA_IO_RegWrite_16(&INTC.ICR1.WORD, dummy16, IOREG_NONSHIFT_ACCESS, IOREG_NONMASK_ACCESS);
    RZA_IO_RegRead_16(&INTC.ICR1.WORD, IOREG_NONSHIFT_ACCESS, IOREG_NONMASK_ACCESS);

    return INTC_SUCCESS;
}

This is the IRQ_SetSense code. Please help

Thanks and Regards 

FAHAD K R