Skip to main content
Graduate II
August 6, 2024
Question

Is there any difference between SPI1 and SPI4?

  • August 6, 2024
  • 3 replies
  • 2979 views

Hi, I am using a stm32h743zi to stablish a connection with a ESP32 via SPI. 

I was using SPI4 at the beginning with one board that i made using these pins:

66 PE13MISO
67 PE14MOSI
65 PE12SCK
68 PE15INT
64 PE11boot cs NSS

Using the pins above my program was working perfectly but...

Now i changed the circuit in a new board and i use other stm32h7 pins connected with the same esp32 pins. So now i am using SPI1 with these pins:

124 PG9MISO
123 PD7MOSI
126 PG11SCK
122 Pd6INT
125 PG10boot cs NSS

And now my program is working bad, sometimes with no connection and other times with connection but sending cutted messages...

 

I set up the SPI and DMA with the same configuration. The only difference is the number of the DMA stream...

 

Anyone know what is going on here? 

 

Thank you!!

    This topic has been closed for replies.

    3 replies

    Super User
    August 6, 2024

    Are these both custom boards?

    https://community.st.com/t5/community-guidelines/how-to-write-your-question-to-maximize-your-chances-to-find-a/ta-p/575228 - point #3

     


    @rubenles wrote:

    I set up the SPI and DMA with the same configuration.


    What if you use the SPI without DMA ?

    What if you don't use the SPI peripherals at all - just bit bang it?

    rubenlesAuthor
    Graduate II
    August 7, 2024

    Hello Andrew, thanks for answering me.

     

    First, I need DMA for buffer transfers that allow me to send a JSON string via SPI.

    Second


    @Andrew Neil wrote:

    Are these both custom boards?


    - Yes

    Super User
    August 6, 2024

    There is no reason you can't use SPI4 the same way that you use SPI1, provided the pins are available.

    They use different pins and you have to configure them correctly. Not enough info here to diagnose what is wrong, but there's nothing wrong with the concept.

    SPI peripheral doesn't have an INT pin, must be something specific to your code.

    rubenlesAuthor
    Graduate II
    August 7, 2024

    Thank you TDK for answering me.

    I was looking for something more about these pins based on your response... I saw i am not using bootloader pins on my h7.

    • Bootloader pins: PA7/PA6/PA5/PA4 
    • Pins i am using: PD7/PG9/PG11/PG10

    I tried to add Threshold on FIFO Mode, but the result is the same, although the string of data is a bit different.

    Result: {"reqid":4,"dachipid":"003D0040-stm32h743zi"} (The is more data between {} i can not show)

    What i wonder to obtain: {"reqid":456,"chipmodel":"stm32h743zi"} (The is more data between {} i can not show)

     

    My question now is. I don't want to flash the h7 chip, i just want to stablish connection and send bytes between microcontrollers... Do you think bootloader pins are affecting here?

     

    Thank you so much

     

    Super User
    August 7, 2024

    Bootloader pins are not relevant if you're in user code.

    Showing your code would help.

    Technical Moderator
    August 6, 2024

    Hi @rubenles ,

    Based on RM0433, the differences between SPI1 & SPI4 are summarized in this table:

    AmelNASRI_0-1722958305244.png

    These differences should be considered at driver level also, so it is important to review the initialization of the SPI instance.

    -Amel

    Graduate II
    August 6, 2024

    Perhaps clocked off different buses too, or via peripheral clock source(s)