cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 4 MCU

Anonymous
Not applicable

Hi, 

   

I am facing a problem when using PSOC4 as a SPI master.

   

The SPI slave is a chip, and the operation defined by the chip is the following.

   

The SPI mode is 0,0

   

#1. NSS = 0

   

#2. Master MOSI write the address byte . e.g 0x01

   

#3. Master MISO read the data byte generated by the slave.

   

#3. NSS = 1

   

The following code is used in this operation.

   


////////////////////////////////////////////////////////////////////////    
    uint8 mTxBuffer[1] = {addr};

   

    SPIM_SpiUartPutArray(mTxBuffer, 1);

   

    while(2!=SPIM_SpiUartGetRxBufferSize())
    {
    }
    SPIM_SpiUartClearTxBuffer();
    

   

    while(SPIM_SpiUartGetRxBufferSize()>0){
       Value = SPIM_SpiUartReadRxData();
    }
    SPIM_SpiUartClearRxBuffer();

   

/////////////////////////////////////////////////////////

   

 

   

But always found the NSS will be set to 1 after the write is executed.

   

Then it is not possible to read the byte return from the slave.

   

Any suggestion on this? Or have to using the GPIO to simulator this feature?

0 Likes
Reply
1 Reply
Anonymous
Not applicable

Simply write two byte(add additional 0x00), and seams problem solved.

0 Likes
Reply