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.

LP-EM-CC2340R5: How do I switch the SPI on and off correctly

Part Number: LP-EM-CC2340R5
Other Parts Discussed in Thread: ENERGYTRACE

Tool/software:

Tool/software:

 

Hi, Ti

 

I have an external SE control by SPI interface , and I found that the current will stay at 2.5mA when SPI continuous opening. So for power saving, I want to close SPI when SE not working, and open SPI when SE working. But I found that SPI communication has issue after close then reopen SPI.

Close SPI I called SPI_close(); Reopen SPI I called  SPI_init(); and SPI_open();

 

I want to ask how do I switch the SPI on and off correctly to achieve my goal.

SDK:simplelink_lowpower_f3_sdk_8_20_00_119\examples\rtos\LP_EM_CC2340R53\ble5stack\basic_ble

  • Hello Peisheng Yang,

    I hope you are doing well.

    Close SPI I called SPI_close(); Reopen SPI I called  SPI_init(); and SPI_open();

    -This is the correct way of closing and re-opening, though we may try SPI_close() -> SPI_open() -> repeat. 

    But I found that SPI communication has issue after close then reopen SPI.

    -Could you describe this issue? 

    Thanks,
    Alex F

  • HI Alex,

    Thank you for your answer.

    Through your answer, I found the Root problem and solved it, but now I have encountered a new problem:

    We want to use Button(CONFIG_GPIO_SW1) and Motion Sensor (CONFIG_GPIO_MOTION_INT) to wakeup from shutdown.

    I set Button wakeup like:

    GPIO_setConfig(CONFIG_GPIO_SW1, GPIO_CFG_IN_PU | GPIO_CFG_SHUTDOWN_WAKE_LOW);

    And the shutdown current is 139uA. But when I set Motion Sensor wakeup like:

     GPIO_setConfig(CONFIG_GPIO_MOTION_INT, GPIO_CFG_IN_PU | GPIO_CFG_SHUTDOWN_WAKE_LOW);

     I found when set Button and Motion Sensor wakeup at the same time,only motion sensor can wakeup but button can’t.How can I wake up by using both the button and the sensor?

  • Hello Peisheng Yang,

    And the shutdown current is 139uA. But when I set Motion Sensor wakeup like:

    -When the device is in shutdown 139uA seems a little high, I would expect something like 0.7 uA (*EnergyTrace sometimes has a hard time measuring this though) 

    For my recommendation lets try the "gpioshutdown" example in our F3 SDK, this example shows how you can wakeup from shutdown with a button press (*also remember to release the latches, this is very important and is included in the example project). Once you get the Button wakeup working, replace it with the Motion sensor wakeup; once you confirm the motion sensor wakeup works combine both in the gpioshutdown example to see if they both work as a wakeup source, then implement the modified example code in your target project. 

    Thanks,
    Alex F