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.

CCS/CC3220SF-LAUNCHXL: What is the minimum delay time of each transaction for SPI communication in blocking mode?

Part Number: CC3220SF-LAUNCHXL
Other Parts Discussed in Thread: SYSBIOS

Tool/software: Code Composer Studio

Hello

I'm stuck with SPI receive issue. I've connected CC3220SF-LAUNCHXL as master and an image device as slave. I execute the following program. When time of Task_sleep is more than 1000 / Clock_tickPeriod, the program works well.

 

uint8_t i;

SPI_Transaction spiTransaction;

for (i=0;i < 50;i++)

{

  Task_sleep(1000 / Clock_tickPeriod); //1 ms

  spiTransaction.count = 4920;

  spiTransaction.txBuf = NULL;

  spiTransaction.rxBuf = gpCurrentBuffer->Lines.au8Data;

  SPI_transfer(pObject->spiHandle, &spiTransaction);

}

 

However, when the time of Task_sleep is less than 1000 / Clock_tickPeriod or even delete the Task_sleep command, the program will enter an infinite loop.

 

ti_sysbios_family_arm_m3_Hwi_excHandlerAsm__I:

.asmfunc

       tst     lr, #4         ; context on PSP?

       ite     NE

       mrsne   r0, psp         ; if yes, then use PSP

       moveq   r0, sp         ; else use MSP

 

       mov     sp, r0         ; use this stack

       stmfd   sp!, {r4-r11}   ; save r4-r11 while we're at it

       mov     r0, sp         ; pass sp to exception handler

       mov     r1, lr         ; pass lr too

       mov     r4, lr         ; preserve LR in r4

 

       ldr     r2, excHandlerAddr

       blx     r2

 

       mov     r0, sp         ; for ROV

       mov     r1, r4         ; for ROV

$1

       b       $1             ; spin here indefinitely

 

Does it need to delay time for periodical reading data of SPI ?

Could you please help me to fix the problem.

 

Thanks, Shyr-Long

  • Hi Shyr-Long, 

    Depending on the RTOS ticks, the delay lower than 1 ms might not be registered as a delay. usually the RTOS tick is 1ms, so the scheduler wouldn't be able to delay a task shorter than that. 

    Try removing your delay entirely, and seeing if you still get a HWI. If yes, next steps would be to isolate the function this occurs in. 

    BR,

    Vince 

  • Hi, Vince

     

    Thanks for your information. May I ask the related problem?

     

    I created two tasks.

    When a periodic external synchronization signal occurs,

    one task reads the image data through the SPI interface,

    while the other task transmits the corresponding data based on

    the service callback function of HTTP GET.

    The synchronization frequency is about 120 Hz.

    However, my program often enter the following infinite loop.

    What is usually the cause of this program error? Thanks.

     

     

    ti_sysbios_family_arm_m3_Hwi_excHandlerAsm__I:

           .asmfunc

           tst     lr, #4         ; context on PSP?

           ite     NE

           mrsne   r0, psp         ; if yes, then use PSP

           moveq   r0, sp         ; else use MSP

     

           mov     sp, r0         ; use this stack

           stmfd   sp!, {r4-r11}   ; save r4-r11 while we're at it

           mov     r0, sp         ; pass sp to exception handler

           mov     r1, lr         ; pass lr too

           mov     r4, lr         ; preserve LR in r4

     

           ldr     r2, excHandlerAddr

           blx     r2

     

           mov     r0, sp         ; for ROV

           mov     r1, r4         ; for ROV

    $1

           b       $1             ; spin here indefinitely

     

     

    BR,

     

    Shyr-Long

  • Shyr-Long,

    Are you using TI-RTOS? If yes, use the debug version of the RTOS build that will give you more information about what happened here. You will be able to tell what function caused this and you'll need to work backwards from there.

    BR,

    Vince