Other Parts Discussed in Thread: ADS1292
Tool/software: Code Composer Studio
I am using cc2640 to communicate with ADS1292 with SPI. ADS1292 is programmed to send interrupt to cc2640. I modify the project_zero project to add SPI communication and interrupt process. The interrupt is received correctly. Here is my ISR
static void adcCallbackFxn(PIN_Handle handle, PIN_Id pinId)
{
// Allocate memory for the message.
app_msg_t *pMsg = ICall_malloc( sizeof(app_msg_t) + 1);
if (pMsg != NULL)
{
PIN_setOutputValue(ledPinHandle, Board_DIO21, 0);
pMsg->type = APP_MSG_ADC_DATA;
// Enqueue the message using pointer to queue node element.
Queue_enqueue(hApplicationMsgQ, &pMsg->_elem);
// Let application know there's a message.
Semaphore_post(sem);
}
PIN_setOutputValue(ledPinHandle, Board_DIO21, 1);
}
From oscilloscope, I can see interrupt comes every 8 ms, but pMsg sometime allocation fail. My question is do I need to allocate the pMsg every time? it seems not reliable. Can I use other means like a static global variable to communicate with the static void ProjectZero_taskFxn(UArg a0, UArg a1)?
Thanks.
Jin