Skip to main content
deleted 25 characters in body
Source Link
hcheung
  • 2k
  • 9
  • 16

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 like SPI.begin(), the SPI construct will default to the SPI to 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 to create an SPI object 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.

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 like SPI.begin(), the SPI construct will default to the SPI to 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 pass-in the pin assignments to create an SPI object 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.

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.

added 297 characters in body
Source Link
hcheung
  • 2k
  • 9
  • 16

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 like SPI.begin(), the SPI construct will default to the SPI to PA4 - PA7, see the default pins definition and default Class construct of Blue Pill.

If you want to useFor STM32 Arduino Core (Stm32duino), there are four STM32 Arduino Core specific APIs for configure the alternative SPI pins, you need.

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 pass-in the pin assignments to create an SPI object 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.

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 like SPI.begin(), the SPI construct will default to the SPI to PA4 - PA7, see the default pins definition and default Class construct of Blue Pill.

If you want to use the alternative pins, you need to pass-in the pin assignments to create an SPI object 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.

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 like SPI.begin(), the SPI construct will default to the SPI to 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 pass-in the pin assignments to create an SPI object 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.

Source Link
hcheung
  • 2k
  • 9
  • 16

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 like SPI.begin(), the SPI construct will default to the SPI to PA4 - PA7, see the default pins definition and default Class construct of Blue Pill.

If you want to use the alternative pins, you need to pass-in the pin assignments to create an SPI object 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.