AnsweredAssumed Answered

Procedure to change use different PCS of SPI0 during runtime?

Question asked by Michael Koller on Aug 5, 2016
Latest reply on Aug 16, 2016 by Michael Koller

Hey there!

I am trying to use the SPI0 module of my K64F to read sensor data. I can initialize the SPI0 in a way, that I get the reading of only one of the four sensors. That means, I configure the SPI0 at the start of the program to PCS0, 1, 2 or four.

But I cannot change the PCS during runtime. What is the way to do this?

This is my most elaborate try, which also does not work:

while(1){

.

.

.

dspiResult = DSPI_DRV_MasterDeinit(DSPI_MASTER_INSTANCE); //Deinit old PCS


dspiResult = DSPI_DRV_MasterInit(DSPI_MASTER_INSTANCE, //Init new PCS

&masterState,

&masterUserConfig);


dspiResult = DSPI_DRV_MasterConfigureBus(DSPI_MASTER_INSTANCE,

&masterDevice,

&calculatedBaudRate);


dspiResult = DSPI_DRV_MasterTransfer(DSPI_MASTER_INSTANCE,

NULL,

NULL,//sendBuffer,

receiveBuffer,//NULL,

TRANSFER_SIZE);


while (DSPI_DRV_MasterGetTransferStatus(DSPI_MASTER_INSTANCE, &wordsTransfer) == kStatus_DSPI_Busy)

{

}


.

.

.

}


Where is my problem, what am I missing? Please tell me the steps and function calls to do this.

I would be very glad if someone could tell me the correct procedure to do this. I have read the Spi chapter in the manual, but could not find the appropriate pages for that.


Thanks for any help and information!
Cheers,

Michael


Outcomes