This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

problem with OS_MBX_WAIT() timeout after combining with ISR_MBX_SEND

Hi, I am trying to get messages from my mailbox to display it on my LCD Screen. However, my IRQ is always displaying the Full Message and my os_mbx_wait always timeout even when the mailbox is full.

Is there anything I am missing? FYI, Task1 has a lower priority (sender event to activate irq) and task2 has a higher priority (it will sleep)

TIA :)

extern os_mbx_declare (mailbox1, 20);
//IRQ
unsigned char dd_in_progress;

__irq void _IRQ_Handler (void) {

        val1 = ->DR0 & 0x03FF;

        val2 = ->DR1 & 0x03FF;

        ddC->CR &= 0xFFFE;
        ddC->CR &= 0x7FFF;

        VIC0->VAR = 0;
        VIC1->VAR = 0;

        if (isr_mbx_check (&mailbox1) == 0) {
            LCD_puts("Full");
        }
        isr_mbx_send(mailbox1, (void *)val1);


        dd_in_progress = 0;

} //END IRQ

void start_ddC ( )
{

        if (!dd_in_progress)
        {
                dd_in_progress = 1;
                ddC->CR |= 0x0423;

        }
}

__task void Task1(void){
  // timing
        const unsigned int period = 200;
        os_itv_set(period);
                for(;;){
                        os_itv_wait();
                        /* Do actions below */
                        start_ddC();

                }
}        // End

/*----------------------------------------------------------------------------
 *        Task 2:
 *---------------------------------------------------------------------------*/
__task void Task2(void){
  // timing
        const unsigned int period = 100;
        int light;
        short *data;
        short value;
        char displayMsg[15];

        OS_RESULT x;
        os_itv_set(period);


                for(;;){
                        os_itv_wait();
                        /* Do actions below */
                        x = os_mbx_wait (&mailbox1, (void**)&data, 200);
                        if (x != OS_R_TMO) {
                                value=(short)*data;
                                sprintf(displayMsg, "Value: %d", value);


                                LCD_puts(displayMsg);
                                LCD_cur_off();

                        } else if (x == OS_R_TMO)
                        {
                                LCD_puts("Timeout");
                        }
                        free(data);
                }
}        // End