This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
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
Hi Jin,
I would say that project_zero generally is a good project to showcase how to setup multiple tasks as it creates multiple task at the start up, have a look for a *_createTask function for an example on this. I also recommend going over the BLE User guide as goes over how to add a new task to the project as well as other interesting things.
For examples on how to use Events/Semaphores/Mailboxes etc. I recommend the TI-RTOS kernel user guide. Regarding the SPI driver, the SPICC26XXDMA.h header file should contain multiple examples on both blocking and callback mode for you to look at.