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.

CC2340R5: CC2340 dynamically changes SPI.

Expert 1085 points
Part Number: CC2340R5

Tool/software:

Hi Ti Experts.

I have a project that uses SPI to read about once every minute.
After reading spi, spi_close will be executed immediately, and the slave chip will be powered off.
At this time, if I don't set those SPI pins to input pull down, there will be about 70uA of leakage.
Because I changed the program to set the spi pin to GPIO_setConfig(CONFIG_GPIO_SPI_CONTROLLER_SCLK, GPIO_CFG_INPUT_INTERNAL | GPIO_CFG_PULL_DOWN_INTERNAL); after spi_close.

But the next time I want to read SPI, I will encounter SPI cannot read.
When I do the SPI read function, I will first do SPI_init and then

SPI_init();
SPI_Params_init(&spiParams);
spiParams.transferTimeout=2000;
spiParams.frameFormat = SPI_POL0_PHA1;//SPI_POL0_PHA1;//weli todo
/* See device-specific technical reference manual for supported speeds */
spiParams.bitRate = 1000000;//125000;//weli todo

usleep(1000*30);
controllerSpi = SPI_open(CONFIG_SPI_CONTROLLER, &spiParams);

In order to save power, I need SPI pins that can be switched dynamically.
Please tell me how should I do it.