cancel
Showing results for 
Search instead for 
Did you mean: 

SPI FULL Duplex Slave ; receive data, but not transmission

Roibert
Associate II

Dear Forum

Im using the SPI of STM32 H7 43ZI.

-In master mode,full duplex, not problem: Transmit and receive data precisely, up to 2Mbit/sec (limits come from cable lenght) .Each pack is 24 bytes.

-In slave mode, this is what i do  (master at 200Kbit/sec): 

 a)FIFO LEVEL=2 BYTES

  b)Master send 2 bytes . The STM32 Slave Receive this 2 byte , and INT roudine is activate

   c) save in a buffer , and load 2 byte to be TX.

And repeat,  up to 24 bytes. 

Problem is:

     *  I get 24bytes ok

     *no data are trasmitted.. MISO is fix to low 

The simplified version of code is this:

 

 

//SPI3 Slave
uint8_t *p_TXDR_SPI3= &(SPI3->TXDR);
uint8_t *p_RXDR_SPI3= &(SPI3->RXDR);

void INT_SPI_3_RXTX_8BIT(SPI_HandleTypeDef *hspi3)
{
    if (  (   (SPI3->SR )  & (  SPI_FLAG_RXP)  )!=0)
    {
         //Save the RX data
         ArrGenRx[IndRx]=*p_RXDR_SPI3;
           IndRx++;

          ArrGenRx[IndRx]=*p_RXDR_SPI3;
          IndRx++;

          Len_Data=Len_Data-2;

          //End Msg ?
           if(Len_Data==0)
           {
                Len_Data=24;
                ...
                IndRx=0;
                IndTx=0;
            }
  
            else
            {
                //Load data to be TX; normally comes from a Array, but for simplify
                //i send costant
                *p_TXDR_SPI3=0xAA;
                IndTx++;
 
               *p_TXDR_SPI3=0xBB;
                IndTx++;
             }

           }//RXP INT ??

}​

 

Also changing the MISO pin, nothing change.

Thanks for any help

Roberto

 

 

0 REPLIES 0