NUCLEO F308R8 Peripherals - martinriis/USEV-Microcontrollers-Workshop GitHub Wiki

I2C

The STM32F302R8 has three I2C (Inter-Integrated Circuit) peripherals, all of which are broken out to the headers on the NUCLEO development board.

Peripheral SDA Pin SCL Pin Wire Port Name
I2C1 PA14/PB7/PB9 PA15/PB6/PB8 Wire1
I2C2 PA10 PA9 Wire2
I2C3 PB5 PA8 Wire3

I2C Example

This example sends the text 'Hello World!' to I2C device 0x71 every second via I2C1 on pins PB7 and PB6.

#include <Wire.h>
//            SDA  SCL
TwoWire Wire1(PB7, PB6);

void setup() {
  Wire2.begin(); 
}

void loop() {
  Wire2.beginTransmission(0x71);
  Wire2.write('Hello World!');
  Wire2.endTransmission();
  delay(1000);
}

U(S)ART

The STM32F302R8 has three USART (Universal Synchronous/Asynchronous Receiver Transmitter) peripherals, all of which are broken out to the headers on the NUCLEO development board.

On the NUCLEO-F302R8 development board, the USB/UART converter is connected to Serial2 on pins PA2 and PA3.

Peripheral TX Pin RX Pin Serial Port Name
USART1 PA9/PB6 PA10/PB7 Serial1
USART2 PA2/PA14/PB3 PA3/PA15/PB4 Serial2
USART3 PB9/PB10 PB8/PB11 Serial3

SPI

The STM32F302R8 has two SPI (Serial Peripheral Interface) peripherals, all of which are broken out to the headers on the NUCLEO development board.

Peripheral MOSI Pin MISO Pin SCLK Pin SPI Port Name
SPI2 PA11/PB15 PA10/PB14 PB13 SPI2
SPI3 PB5/PC12 PB4/PC11 PB3/PC10 SPI3
⚠️ **GitHub.com Fallback** ⚠️