Skip to main content
Graduate
June 10, 2025
Question

SPI FULL Duplex Slave ; receive data, but not transmission

  • June 10, 2025
  • 2 replies
  • 293 views

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

 

 

    This topic has been closed for replies.

    2 replies

    Technical Moderator
    August 29, 2025

    Hello @Roibert ,

     

    I apologie for my late reply.

    If the issue is not solved yet, could you please check the SS pin because, in slave mode, the SS works as a standard ‘chip select’ input and lets the slave communicate with the master.

    I recommend you also to refer to STM32CubeH7/Projects/NUCLEO-H743ZI/Examples/SPI/SPI_FullDuplex_ComPolling at master · STMicroelectronics/STM32CubeH7 · GitHub example may help you.

     

    Thank you.

    Kaouthar

    Super User
    August 29, 2025

    @Roibert wrote:

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


    What is the Master?

    Please show your schematic - see:How to write your question to maximize your chances to find a solution.

     


    @Roibert wrote:

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


    Can you drive the pin high and low when it's just configured as a GPIO - no SPI ?