4 years, 7 months ago.

how can i use 2 spi in one code for stm32F767ZI ?

Hi i would like to read data from AD9833 and save it in cardSD for nucleo 144 board STM32F767ZI, so that's why i need to 2 spi in the same programme , could you please help me in that ?

for more favore can i reach to 4 spi if yes , can u say how ? i will appreciate that !! thank you in advance.

Question relating to:

STM32 Nucleo-144 development board with STM32F767ZIT6 MCU, supports Arduino, ST Zio and morpho connectivity

2 Answers

4 years, 4 months ago.

Hi Matine ,

you can use 2 or more spis' or i2cs' by using spi class, or i2c class respectively and see PeripheralPins.c PinNames.h for details.

Also, see the pinout of NucleoF767ZI.

PeripheralPins.c PinNames.h



SPI spi4(PE_14,PE_13,PE_12,PE_11); which includes slave select also

4 years, 4 months ago.


Just an addendum to the previous answer:

Once you have declared your 2 SPI objects as previoulsy explained, you'll be able to use them separately by using m_spi.write(...) or spi4.write(...)


Please take care while choosing your pins in the pinout. For each SPI software object, MOSI / MISO and CLK pins shall be mapped on the same hardware instance of SPI.

For example, you can use

SPI my_spi(PC_12, PC_11, PC_10);  /*all are on SPI3 hw instance, as stated in the pinout picture*/

but you cannot use

SPI my_spi(PC_12, PE_5, PC_10); /* because PE_5 is mapped on SPI4 hw instance */

Thanks, Armelle for additional info.

posted by Shivanand Gowda 17 May 2018