cancel
Showing results for 
Search instead for 
Did you mean: 

Is there any difference between SPI1 and SPI4?

rubenles
Senior

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!!

12 REPLIES 12
Andrew Neil
Evangelist III

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?

TDK
Guru

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.

If you feel a post has answered your question, please click "Accept as Solution".
Amel NASRI
ST Employee

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

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

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

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

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

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

 

Thank you for your response Amel,

 

	hspi1.Instance = SPI1;
	hspi1.Init.Mode = SPI_MODE_SLAVE;
	hspi1.Init.Direction = SPI_DIRECTION_2LINES;
	hspi1.Init.DataSize = SPI_DATASIZE_8BIT;
	hspi1.Init.CLKPolarity = SPI_POLARITY_LOW;
	hspi1.Init.CLKPhase = SPI_PHASE_1EDGE;
	hspi1.Init.NSS = SPI_NSS_SOFT;
	hspi1.Init.FirstBit = SPI_FIRSTBIT_MSB;
	hspi1.Init.TIMode = SPI_TIMODE_DISABLE;
	hspi1.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE;
	hspi1.Init.CRCPolynomial = 0x0;

I use the same configuration as i used on spi4 because i think there is nothing that affect in here. Am i wrong?

 

Thanks.

Again, does it work without DMA ?

I have to check it well...