PlatformIO Community

STM32F103RB comunication SPI



how i define the second port/bus of SPI on muc stm32f103???

/Pins of spi 2*************************************
//#define SCS PB1 //1 // SLAVE PIN
//#define MOSI PB15 // MOSI, for “Master Out / Slave In”.
//#define MISO PB14 // MISO, for “Master In / Slave Out”.
//#define SCLK PB13 //clock

//******* pins of SPI 1**************************************************
//#define SCS PA4 // SLAVE PIN
//#define MOSI PA7 //MOSI, for “Master Out / Slave In”.
//#define MISO PA6 // MISO, for “Master In / Slave Out”.
//#define SCLK PA5 //clock

i use this configuration on platformio.ini

platform = ststm32@5.1.0
board = genericSTM32F103RB
framework = arduino
debug_tool = stlink
upload_protocol = stlink
monitor_speed = 115200
monitor_port = COM9

my two first line of my code have this
#include <Arduino.h>;
#include <SPI.h>;


It looks like on the stm32duino core the pins are defined using the constructor? So something like SPIClass SPI_2(MOSI,MISO,SCLK,SCS); should create a SPI_2 object with the defined pins.

Btw, there shouldn’t be semi-colons ‘;’ after include statements :wink: