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.

SPI read works from one task but not another

Other Parts Discussed in Thread: SYSBIOS

I am using tirtos_simplelink_2_13_00_06 and added some SPI reading.writing code to one of the examples (SensorTag). Specifically, the init function of the SensorTag task. The reading and writing via SPI works as expected. If i move this code to the init function (or anywhere else) of that task, the SPI read/write fails (the data i read i bogus). 

I verified that the priority and stack size of the 2 tasks are identical but can not understand why that SPI reading works in one but not the other. One difference is that my task is statically created in .cfg while the SensoTag example task is created dynamically in code.

While i used the BLE SensorTag example for this test, this is, i suppose, more of a general TIRTOS question and therefore i decided to post it here. 

Does anyone have some hint what could cause this? 

void myTaskFunc(UArg a0, UArg a1) {

	bspSpiOpen();
        setupFRAM(); //setup CS for this SPI memory
        testFRAM();  //SPI r/w fails here
  
        // Task loop
while (true) { ... } } static void SensorTag_taskFunc(UArg a0, UArg a1) { bspSpiOpen(); setupFRAM(); //setup CS for this SPI memory testFRAM(); //SPI r/w works here // Task loop
while (true) { ... } }

  • Some more info on this. If i look at the call stack when the SPI read works, i see "ti_sysbios_knl_Task_processVitalTaskFlag__I" at the bottom of the call stack.

    However, when the SPI read does not work correctly, the call stack shows "MemBusWrkAroundHapiEraseSector" at the bottom.

    What does "MemBusWrkAroundHapiEraseSector" mean and could it be an indication for whats wrong in this case?

  • Hi,
    Are you calling testFRAM (Is this what does the SPI read?) from both tasks? If so you can try just calling it from just myTaskFunc. I don't know about the implementation of bspSpiOpen, setupFRAM or testFRAM to know if they can be handled being called twice. Just to characterize this more, you can remove the sensorTag task completely and run just your myTaskFunc with the SPI code to see if it works.
    If you can share your project it will help even better.

    Thanks,
    Moses