In the MQX MTOS User's Guide is say in FAQ 6.2 that "The tasks are probably sharing the same global connection, rather than having their own
local, individual connection. Each task should call _event_open() or _event_open_fast() to get its own connection."
I changed the code above so that it's like (with the changes in bold):
Main:
=====
void *Event_Ptr;
#define EVENT_NO 45 // Just a number for the event ID
_event_create_fast_auto_clear(EVENT_NO);
_event_open_fast(EVENT_NO, &Event_Ptr);
OS_Task_create(GenResetApp, NULL, 10L, 4096L, "GenReset", NULL);
...
Interrupt:
=====
static void *Event_Ptr;
/* ADC IRQ handler code */
void ADC0_IRQHandler(void) {
GPIO_DRV_SetPinOutput(Reset_Pin);
CurrentSample = ADC16_DRV_GetConvValueSigned(ADC_INSTANCE, ADC_INPUT_CHAN); // Read the value
_event_set(Event_Ptr,0x01);
}
void InitRoutine (void) {
_event_open_fast(EVENT_NO, &Event_Ptr);
//... other stuff needed for the ADC setup }
Background:
=====
static void *Event_Ptr;
void GenResetApp(void * Args) {
_mqx_uint Result;
_event_open_fast(EVENT_NO, &Event_Ptr);
while (1) {
Result = _event_wait_any_until(Event_Ptr, 0x01, 0);
if (Result != MQX_OK) {
printf("\r\nMQX Event error: 0x%X ", Result);
}
}
This works. My issue was: How did I define the handle so that it was available in the interrupt routine?