2024-08-06 05:59 AM
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 PE13 | MISO |
67 PE14 | MOSI |
65 PE12 | SCK |
68 PE15 | INT |
64 PE11 | boot 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 PG9 | MISO |
123 PD7 | MOSI |
126 PG11 | SCK |
122 Pd6 | INT |
125 PG10 | boot 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!!
2024-08-06 06:02 AM - edited 2024-08-06 06:05 AM
Are these both custom boards?
@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?
2024-08-06 07:52 AM
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.
2024-08-06 08:33 AM
Hi @rubenles ,
Based on RM0433, the differences between SPI1 & SPI4 are summarized in this table:
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.
2024-08-06 09:24 AM
Perhaps clocked off different buses too, or via peripheral clock source(s)
2024-08-06 11:58 PM
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
2024-08-07 12:38 AM
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.
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
2024-08-07 12:40 AM
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.
2024-08-07 01:58 AM
Again, does it work without DMA ?
2024-08-07 02:03 AM - edited 2024-08-07 02:05 AM
I have to check it well...