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.

CC3200MOD: question about SPI trasfer size (MAP_SPITransfer)

Part Number: CC3200MOD


An issue happened according to the data length of SPI transfer (MAP_SPITransfer).

  <used api> "MAP_SPITransfer(GSPI_BASE, (uint8_t *)pDat, g_ucRxBuff, 1024, 0);"

When calling with "1024", the system does not enter to LPDS mode or HIB mode. (Data transfer properly finished..)

However, when calling with "128" instead of 1024, there is no problem with entering LPDS or HIB mode.

 

* Is there any condition about the SPI data transfer size?

* Can you guess what will be the cause of this problem?

Best regards,

Hayden

  • Hi Hayden,

    Please share how you are attempting to put the device into low-power mode after initiating the SPI transfer. Are you simply calling PRCMLPDSEnter() or PRCMHibernateEnter() right after calling SPITransfer()?

    Best Regards,
    Ben M
  • Hi Ben,

    It is same as in the example of "idle_profile", as below.

    (after doing SPI WRITE...)

       iRetVal = osi_MsgQCreate(&g_tWkupSignalQueue, NULL,

                                sizeof( unsigned char ), 10);

       if (iRetVal < 0)

       {

           UART_PRINT("unable to create the msg queue\n\r");

           LOOP_FOREVER();

       }

       tTimerHndl = SetTimerAsWkUp();

       tGPIOHndl = SetGPIOAsWkUp();

       /* handles, if required, can be used to stop the timer, but not used here*/

       UNUSED(tTimerHndl);

       UNUSED(tGPIOHndl);

       /* now go to LPDS ... */

       lp3p0_setup_power_policy(POWER_POLICY_STANDBY); //lp3p0_setup_power_policy(POWER_POLICY_HIBERNATE);

       while(FOREVER)

       {

           //

           // waits for the message from the various interrupt handlers(GPIO,

           // Timer) and the UDPServerTask.

           //

           osi_MsgQRead(&g_tWkupSignalQueue, &ucQueueMsg, OSI_WAIT_FOREVER);

           switch(ucQueueMsg){

               case 1:

                   UART_PRINT("timer\n\r");

                   break;

               case 2:

                   UART_PRINT("GPIO\n\r");

                   break;

               case 3:

                   UART_PRINT("host irq\n\r");

                   break;

               default:

                   UART_PRINT("invalid msg\n\r");

                   break;

           }

       }

     

    Thanks and regards,

    Hayden

  • Ben,

    With "idle_profile_freertos", it properly worked (hibernate and wake up).
    FYI, I modified the code as below.


    (TimerGPIOTask(), main.c of idle_profile_freertos)

    /* handles, if required, can be used to stop the timer, but not used here*/
    UNUSED(tTimerHndl);
    UNUSED(tGPIOHndl);


    UART_PRINT(">>>>>> SPI start !!\n\r");
    MAP_PRCMPeripheralReset(PRCM_GSPI);
    MAP_SPIReset(GSPI_BASE);
    MAP_SPIConfigSetExpClk(GSPI_BASE,MAP_PRCMPeripheralClockGet(PRCM_GSPI),
    SPI_IF_BIT_RATE,SPI_MODE_MASTER,SPI_SUB_MODE_0, // polality 0, phase 0
    (SPI_HW_CTRL_CS | // don't mux out CS Pin, instead mux out the required GPIO, SPI_SW_CTRL_CS
    SPI_4PIN_MODE |
    SPI_TURBO_OFF |
    SPI_CS_ACTIVELOW |
    SPI_WL_8));
    MAP_SPIEnable(GSPI_BASE);
    MAP_SPITransfer(GSPI_BASE, g_ucTxBuff, g_ucRxBuff, 1024, 0);
    MAP_SPIDisable(GSPI_BASE);
    UART_PRINT(">>>>>> SPI stop !!!\n\r");


    //
    // setting Apps power policy
    //
    //lp3p0_setup_power_policy(POWER_POLICY_STANDBY);
    lp3p0_setup_power_policy(POWER_POLICY_HIBERNATE);

    while(FOREVER)
    {
    //
    // waits for the message from the various interrupt handlers(GPIO,
    // Timer) and the UDPServerTask.
    //
    osi_MsgQRead(&g_tWkupSignalQueue, &ucQueueMsg, OSI_WAIT_FOREVER);
    switch(ucQueueMsg){
    case 1:
    UART_PRINT("timer\n\r");
    break;
    ...


    Best regards,
    Hayden
  • Hi Hayden,

    Just to be clear - this resolved the issue? I can close the thread if so.

    Thanks,
    Ben M
  • Hi Ben,

    (update the result)
    The cause is the rx buffer size at "MAP_SPITransfer(GSPI_BASE, g_ucTxBuff, g_ucRxBuff, 1024, 0)".
    Tx buffer size was 1024. After changing buffer size of g_ucRxBuff as 1024, it worked properly.

    Thanks and regards,
    Hayden