Has anyone successfully use SPI1 of those pins?
SCLK -> PB3
SDIO -> PB5
SDO -> PB4
MISO CS -> PA15
I've tried to use another side of SPI1 pins on the other sides of the board (PA4, 5, 6, 7) and i can successfully communicate with
Arduino Stack Exchange is a question and answer site for developers of open-source hardware and software that is compatible with Arduino. It only takes a minute to sign up.
Sign up to join this communityHas anyone successfully use SPI1 of those pins?
SCLK -> PB3
SDIO -> PB5
SDO -> PB4
MISO CS -> PA15
I've tried to use another side of SPI1 pins on the other sides of the board (PA4, 5, 6, 7) and i can successfully communicate with
It depends on how you use the SPI object. If you use the SPI object directly like what Arduino Uno without creating an instance object, the SPI construct will default to the PA4 - PA7, see the default pins definition and default Class construct of Blue Pill.
For STM32 Arduino Core (Stm32duino), there are four STM32 Arduino Core specific APIs for configure the alternative SPI pins.
void setMISO(uint32_t miso)
void setMOSI(uint32_t mosi)
void setSCLK(uint32_t sclk)
void setSSEL(uint32_t ssel)
These must be called before the SPI.begin()
.
Another alternative way of using the alternative SPI pins is to create an SPI object and pass-in the pin assignments like this:
#include <SPI.h>
SPIClass mySPI(PB5, PB4, PB3, PB15); //mosi, miso, sclk, ssel
See the alternative construct API, and further information on STM32duino wiki page.