Part Number: CC2640R2F
Tool/software: TI-RTOS
Hello,
I am developing my BLE application around the simple_peripheral example and I am having an issue reliably reading in data from my SPI peripheral. I have an external SPI CAN bus controller that interrupts when a message is received into one of its two buffers and I must read this message over SPI immediately. I have added a can task with an interrupt handler for this that has a higher priority than the simple_peripheral task, but lower than the ICall_createRemoteTasks() and the GAPRole_createTask().
I need to be able to receive a large packet (of around 10 messages) back to back after I issue a data request to another device on the CAN bus. This works for most of the time, however, there are times when the can task is preempted by the higher priority tasks and it misses several of the messages (does not read them before another comes in and overwrites the buffer on the external controller).
I have been looking into using the Task_disable() and enable functions around this critical transfer since I have control over and know when the transfer will occur but I can't seem to get it to work properly. It seems to crash the entire program like it is not ever re-enabling. Is it ok to use these functions in this manner with the ICall_createRemoteTasks() and the GAPRole_createTask() tasks? Is this the best way to go about solving this problem or is there a better solution I should be looking at?
Thanks!