Difference between revisions of "BLACK-PILL-HUB"

From Land Boards Wiki
Jump to navigation Jump to search
 
(86 intermediate revisions by the same user not shown)
Line 1: Line 1:
[[File:Black-Pill-Board.png]]
+
[[File:tindie-mediums.png|link=https://www.tindie.com/products/land_boards/black-pill-hub-pcb-only/]]
 +
 
 +
[[File:Black-Pill-Hub_P1383-720px.jpg]]
 +
 
 +
<video type="youtube">3o0MC8F1onk</video>
  
 
== Features ==
 
== Features ==
  
* Carrier for the [[STM32|STM32 Black Pill Board]]
+
* Carrier for the [[STM32_Black_Pill|STM32 Black Pill Board]]
** STM32F401/411 CPU
+
** STM32F4XX|STM32F401/411 CPU
 +
** [https://www.aliexpress.com/item/4001098711269.html?spm=a2g0s.9042311.0.0.27424c4dqDjXsl AliExpress listing]
 
* I2C Hub - [https://www.ti.com/lit/ds/symlink/pca9544a.pdf PCA9544A]
 
* I2C Hub - [https://www.ti.com/lit/ds/symlink/pca9544a.pdf PCA9544A]
 
** 4-channel
 
** 4-channel
 
** Independent 3.3V/5V power for each channel
 
** Independent 3.3V/5V power for each channel
* Separate interrupts for each channel
+
** Separate interrupts for each channel
* GVS connections for Blue Pill pins
+
* GVS connections for Black Pill pins
 +
** Good for supplying power/ground to external I/O cards
 
* Reset switch
 
* Reset switch
 +
* Power options
  
 
=== Black Pill Module ===
 
=== Black Pill Module ===
Line 17: Line 24:
  
 
[[File:BlackPillBoard-720px.png]]
 
[[File:BlackPillBoard-720px.png]]
 +
 +
==== Reserved Pins ====
 +
 +
* PA0 - On-board USER KEY - needs INPUT_PULLUP
 +
* PC13 - On-board LED
 +
* PB2 - BOOT1
 +
** Pulling this pin down by external hardware causes the board to boot to serial
 +
** Can be ignored by holding both reset and BOOT1 buttons on the Black Pill card
 +
** Release reset button first
 +
* PA11 - USB-M
 +
* PA12 - USB-P
 +
* PA9 - Serial TX1
 +
* PA10 - Serial RX1
 +
 +
== Programming ==
 +
 +
* [https://github.com/stm32duino/wiki/wiki stm32duino wiki]
 +
** [https://github.com/stm32duino/wiki/wiki/Getting-Started Getting Started]
 +
** [https://github.com/stm32duino/wiki/wiki/API#analog Analog]
 +
** [https://github.com/stm32duino/wiki/wiki/API#wiring Wiring API]
 +
** [https://github.com/stm32duino/wiki/wiki/API#i2C I2C]
 +
** [https://github.com/stm32duino/wiki/wiki/API#EEPROM-Emulation EEPROM emulation]
 +
** [https://github.com/stm32duino/wiki/wiki/API#spi SPI]
 +
** [https://github.com/stm32duino/wiki/wiki/HardwareTimer-library#hardwaretimer HardwareTimer]
 +
 +
==== Second Serial Port - HardwareSerial====
 +
 +
From [https://github.com/stm32duino/wiki/wiki/API#hardwareserial HardwareSerial]. The STM32 MCU's have several U(S)ART peripherals. By convenience, the U(S)ARTx number is used to define the Serialxinstance:
 +
 +
* Serial1 for USART1
 +
* Serial2 for USART2
 +
* Serial3 for USART3
 +
* Serial4 for UART4
 +
** For LPUART1 this is SerialLP1
 +
* By default, only one Serialx instance is available mapped to the generic Serial name.
 +
 +
* To use a second serial port, a HardwareSerial object should be declared in the sketch before the setup() function:
 +
 +
<pre>
 +
//                      RX    TX
 +
HardwareSerial Serial1(PA10, PA9);
 +
 +
void setup() {
 +
  Serial1.begin(115200);
 +
}
 +
 +
void loop() {
 +
  Serial1.println("Hello World!");
 +
  delay(1000);
 +
}
 +
</pre>
  
 
== Connectors ==
 
== Connectors ==
 +
 +
[[file:BLACK-PILL-HUB-REV_2.PNG]]
  
 
=== J1 - 5V power ===
 
=== J1 - 5V power ===
Line 25: Line 85:
 
* 5V
 
* 5V
 
* Center positive
 
* Center positive
 +
* Don't need to power the card via this connector if the USB cable is plugged into the Black Pill CPU
  
 
=== J4 - 5V Power ===
 
=== J4 - 5V Power ===
Line 45: Line 106:
 
=== P2 - Vbattery ===
 
=== P2 - Vbattery ===
  
* Battery power to the Blue Pill board
+
* Battery power to the Black Pill board
 
# GND
 
# GND
 
# Vbat
 
# Vbat
  
=== P3 - FTDI connector (Rev X1-X3) ===
+
=== P3 - FTDI Module ===
 
 
* To cable to FTDI wires swap pins 4 and 5 in cable
 
* FTDI card jumper has to be set to 3.3V since STM32 has 3.3V signal levels
 
 
 
# GND
 
# N/C
 
# VCC (to H8 pin 2)
 
# TX (to Blue Pill RX) (PA10 pin on STM32)
 
# RX (to Blue Pill Tx) (PA9 pin on STM32)
 
# RESET*
 
 
 
[[File:FTDI_rot.jpg]]
 
 
 
=== P3 - FTDI Module (Rev 4 or higher) ===
 
  
 +
* Not as necessary on the Black Pill card since downloads can be done with the [[BLACK-PILL-HUB#DFU_Programming|DFU mode]]
 
* Cheap FT232 module pinout
 
* Cheap FT232 module pinout
 +
* Remove 6 pin right angle header
  
 
[[File:FTDI_rot.jpg]]
 
[[File:FTDI_rot.jpg]]
Line 71: Line 120:
 
=== P4, P5, P6, P7 - I2C Interfaces #0-#3 ===
 
=== P4, P5, P6, P7 - I2C Interfaces #0-#3 ===
  
# INT*
+
* Four independent I2C interfaces
# SCL
+
** Black Pill Hub card is I2C Master
# SDA
+
* I2C mux connections to Black Pill Hub card
 +
** INT* - Connects to PB8
 +
** SCL - Connects to PB6
 +
** SDA - Connects to PB7
 +
* I2C Pins
 +
 
 +
# INT* - Connects to PB8
 +
# SCL - Connects to PB6
 +
# SDA - Connects to PB7
 
# VCC
 
# VCC
 
# GND
 
# GND
Line 79: Line 136:
 
=== P8 - SPI ===
 
=== P8 - SPI ===
  
# PA6 (MISO)
+
* 2x3 header
 +
* SPI Pins
 +
 
 +
# PA6 (MISO1)
 
# 3.3V
 
# 3.3V
# PA5 (SCK)
+
# PA5 (SCK1)
# PA7 (MOSI)
+
# PA7 (MOSI1)
 
# RES
 
# RES
 
# GND
 
# GND
Line 89: Line 149:
  
 
* Ground, Power, Signal pins
 
* Ground, Power, Signal pins
 +
* Pin near Black pill is signal
  
# n/c
 
 
# PC13
 
# PC13
 
# PC14
 
# PC14
 
# PC15
 
# PC15
 +
# N/C
 
# PA0
 
# PA0
 
# PA1
 
# PA1
Line 104: Line 165:
 
# PB0
 
# PB0
 
# PB1
 
# PB1
 +
# PB2
 
# PB10
 
# PB10
# PB11
 
  
 
=== P12/P13  - GVS Connector ===
 
=== P12/P13  - GVS Connector ===
  
 
* Ground, Power, Signal pins
 
* Ground, Power, Signal pins
 +
* Pin near Black pill is signal
  
# n/c
+
# GND
 
# PB9
 
# PB9
 
# I2C_INT (PB8)
 
# I2C_INT (PB8)
# I2C_SDA1 (PB7)
+
# I2C_SDA (PB7)
 
# I2C_SCL (PB6)
 
# I2C_SCL (PB6)
 
# PB5
 
# PB5
Line 131: Line 193:
  
 
== Headers ==
 
== Headers ==
 
=== H1 - 3.3V (Rev X1-X3) ===
 
 
* Install to power 3.3V from regulator
 
  
 
=== H1 - 3.3V source select ===
 
=== H1 - 3.3V source select ===
  
* 1-2 power from 5V to 3.3V regulator
+
* 1-2 = Power from 5V to 3.3V regulator
* 2-3 Power from Blue Pill board 3.3V regulator
+
* 2-3 = Power from Black Pill board 3.3V regulator
  
=== H2 - 5V Jumper (Rev X1-X3) ===
+
=== H2 - 5V Power Source ===
 
 
* Install to connect J4 and J1 5V
 
 
 
=== H2 - 5V Power Source (Rev 4 or higher) ===
 
  
 
* T-shaped header
 
* T-shaped header
* Up - Power 5V from BluePill Hub USB power
+
* Up - Power 5V from FTDI 5V
 +
* Down - Power 5V from Black Pill Hub USB power
 
* Left - Power 5V from DC Jack
 
* Left - Power 5V from DC Jack
* Down - Power 5V from  FTDI 5V
 
  
 
=== H3, H4, H5, H6 - I2C Power ===
 
=== H3, H4, H5, H6 - I2C Power ===
  
* Select the power to the I2C interface
+
* Select the power to/from the (4) I2C interfaces
* Install in one of the two positions to power external I2C interface from the board
+
* Install in one of the two positions to power the external I2C interface from the Hub board
* Remove if power comes in from external I2C interface
 
  
 
# 3.3V
 
# 3.3V
 
# 5V
 
# 5V
  
=== H7 - 3.3V from Blue Pill module 3.3V regulator ===
+
* Remove if power comes in from external I2C interface
 
 
* Install = power on-board 3.3V circuitry from regulator on Blue Pill module
 
** H8 should not be installed if H7 is installed
 
 
 
=== H8 - Power from FTDI ===
 
 
 
* 1-2 = 3.3V from FTDI (don't ever do this)
 
* 2-3 = 5V from FTDI (probably don't do this)
 
* H7 should not be installed if H8 is installed
 
  
 
=== H9 - Hub Chip Address ===
 
=== H9 - Hub Chip Address ===
  
* Select the address of the PCA9544A I2C hub
+
* Select the 3-bit (A0-A2) address of the PCA9544A I2C hub
 +
* Remove for 1, install for 0
  
 
== Switches ==
 
== Switches ==
Line 180: Line 225:
 
=== SW1 - Reset Switch ===
 
=== SW1 - Reset Switch ===
  
* Press to reset Blue Pill board
+
* Press to reset Black Pill board
  
 
=== SW2 - Switch on/off J1, J4 power source ===
 
=== SW2 - Switch on/off J1, J4 power source ===
Line 186: Line 231:
 
== Schematic ==
 
== Schematic ==
  
* [https://land-boards.com/BLUE-PILL-HUB/BLUE-PILL-HUB-Rev3_Schematic.pdf Schematic] - Rev 3 Board
+
* Board has silkscreen with rev on rear
* [https://land-boards.com/BLUE-PILL-HUB/BLUE-PILL-HUB-Rev4_Schematic.pdf Schematic] - Rev 4 Board
+
* [http://land-boards.com/BLACK-PILL-HUB/BlackPillHub_Schematic-Rev1.pdf BLACK-PILL-HUB Schematic Rev 1]
 +
** Has title block errors, title. rev
 +
* [http://land-boards.com/BLACK-PILL-HUB/BlackPillHub_Schematic-Rev2.pdf BLACK-PILL-HUB Schematic Rev 2]
 +
 
 +
== Software ==
 +
 
 +
* [https://github.com/land-boards/lb-Arduino-Code/tree/master/LBCards/BLACKPILLHUB Black Pill Hub Software GitHub]
 +
* [https://github.com/SuperThunder/STM32F411CEU6-BlackPill-MicroPython-Examples STM32F411CEU6 MicroPython Examples]
 +
* [https://github.com/search?q=STM32F411 STM32F411 GitHub]
  
 
== Testing ==
 
== Testing ==
  
 
* [[Arduino Based Test Station]]
 
* [[Arduino Based Test Station]]
* [https://github.com/land-boards/lb-Arduino-Code/tree/master/LBCards/ODAS/ODASTESTER ODAS Tester Github Repo]
+
** Issue with library
 +
 
 +
== Programming ==
 +
 
 +
=== DFU Programming ===
 +
 
 +
[[file:STM32F4-Black-Pill-Board-oriented.jpg]]
 +
 
 +
* Steps from [https://www.sgbotic.com/index.php?dispatch=pages.view&page_id=49 Programming|Program STM32 Black Pill (STM32F401 / F411) with Arduino IDE (Windows OS)]
 +
** Add the URL to Additional Board Manager URLs text box:
 +
*** https://github.com/stm32duino/BoardManagerFiles/raw/master/STM32/package_stm_index.json
 +
** Go to Tools > Board > Boards Manager
 +
** Search for STM32, select latest version and click Install.
 +
** Download and install STM32CubeProg from ST.com: [https://www.st.com/en/development-tools/stm32cubeprog.html]
 +
** Start the STM32CubeProg
 +
** From the Tools > Board > STM32 Board, select Generic STM32F4 series
 +
** Select Tools > Board Part Number > BlackPill F411CE
 +
** Under USB Support, select CDC (generic "Serial" supersede U(S)ART)
 +
** Under Upload method, select STM32CubeProgrammer(DFU)
 +
** Use the onboard BOOT0 and NRST button to put the board into bootloader mode:
 +
*** press and hold the BOOT0 button
 +
*** press and release NRST (reset) button to power cycle the processor
 +
*** release BOOT0 button
 +
*** Sometimes removing the USB cable and plugging it back in while pressing BOOT0 button works better
 +
** Upload sketch
 +
 
 +
[[File:Arduino-Programming-Tools-Dropdown.png]]
 +
 
 +
* Displays in IDE
 +
 
 +
<pre>
 +
USB speed  : Full Speed (12MBit/s)
 +
Manuf. ID  : STMicroelectronics
 +
Product ID  : STM32  BOOTLOADER
 +
SN          : 348C35983539
 +
FW version  : 0x011a
 +
Device ID  : 0x0431
 +
Device name : STM32F411xC/E
 +
Flash size  : 512 KBytes (default)
 +
Device type : MCU
 +
Device CPU  : Cortex-M4
  
[[File:BPH-P711-720px.jpg]]
 
  
=== Programming ===
+
 
 +
Memory Programming ...
 +
Opening and parsing file: ODASTESTER.ino.bin
 +
  File          : ODASTESTER.ino.bin
 +
  Size          : 49132 Bytes
 +
  Address      : 0x08000000
 +
 
 +
 
 +
Erasing memory corresponding to segment 0:
 +
Erasing internal memory sectors [0 2]
 +
erasing sector 0000 @: 0x08000000 done
 +
erasing sector 0001 @: 0x08004000 done
 +
erasing sector 0002 @: 0x08008000 done
 +
Download in Progress:
 +
 
 +
 
 +
File download complete
 +
Time elapsed during download operation: 00:00:02.263
 +
 
 +
RUNNING Program ...
 +
  Address:      : 0x8000000
 +
Start operation achieved successfully
 +
</pre>
 +
 
 +
=== Other Programming ===
  
 
* ST-LINK V2
 
* ST-LINK V2
Line 203: Line 319:
 
[[File:SerialPropogramming (AN3155).PNG]]
 
[[File:SerialPropogramming (AN3155).PNG]]
  
== Rev 4 ==
+
== PCB ==
 
 
* Change FTDI to Module
 
 
 
[[File:P1725-crop-720px.jpg]]
 
 
 
== Rev 1 Board ==
 
  
[[File:BluePillHub-P682-cropped-720px.jpg]]
+
[[File:Black-Pill-Hub_P1385-720px.jpg]]
  
 
== Assembly Sheet ==
 
== Assembly Sheet ==
  
* [[Blue Pill Hub Assembly Sheet Rev 4]]
+
* [[Black Pill Hub Assembly Rev 1]]
* [[Blue Pill Hub Assembly Sheet]] - Rev 3
 

Latest revision as of 12:08, 6 April 2022

Tindie-mediums.png

Black-Pill-Hub P1383-720px.jpg

Features

  • Carrier for the STM32 Black Pill Board
  • I2C Hub - PCA9544A
    • 4-channel
    • Independent 3.3V/5V power for each channel
    • Separate interrupts for each channel
  • GVS connections for Black Pill pins
    • Good for supplying power/ground to external I/O cards
  • Reset switch
  • Power options

Black Pill Module

Not pin compatible with Blue Pill due to power pin locations

BlackPillBoard-720px.png

Reserved Pins

  • PA0 - On-board USER KEY - needs INPUT_PULLUP
  • PC13 - On-board LED
  • PB2 - BOOT1
    • Pulling this pin down by external hardware causes the board to boot to serial
    • Can be ignored by holding both reset and BOOT1 buttons on the Black Pill card
    • Release reset button first
  • PA11 - USB-M
  • PA12 - USB-P
  • PA9 - Serial TX1
  • PA10 - Serial RX1

Programming

Second Serial Port - HardwareSerial

From HardwareSerial. The STM32 MCU's have several U(S)ART peripherals. By convenience, the U(S)ARTx number is used to define the Serialxinstance:

  • Serial1 for USART1
  • Serial2 for USART2
  • Serial3 for USART3
  • Serial4 for UART4
    • For LPUART1 this is SerialLP1
  • By default, only one Serialx instance is available mapped to the generic Serial name.
  • To use a second serial port, a HardwareSerial object should be declared in the sketch before the setup() function:
//                      RX    TX
HardwareSerial Serial1(PA10, PA9);

void setup() {
  Serial1.begin(115200); 
}

void loop() {
  Serial1.println("Hello World!");
  delay(1000);
}

Connectors

BLACK-PILL-HUB-REV 2.PNG

J1 - 5V power

  • DC jack
  • 5V
  • Center positive
  • Don't need to power the card via this connector if the USB cable is plugged into the Black Pill CPU

J4 - 5V Power

  • 5mm terminal block

J7 - I2C

  • The I2C interface that goes to the I2C hub part
  1. SCL (PB6)
  2. SDA (PB7)
  3. 3.3V
  4. GND

P1 - 5V

  • 2x4 header with 5V from H2 (Rev 4 card)

P2 - Vbattery

  • Battery power to the Black Pill board
  1. GND
  2. Vbat

P3 - FTDI Module

  • Not as necessary on the Black Pill card since downloads can be done with the DFU mode
  • Cheap FT232 module pinout
  • Remove 6 pin right angle header

FTDI rot.jpg

P4, P5, P6, P7 - I2C Interfaces #0-#3

  • Four independent I2C interfaces
    • Black Pill Hub card is I2C Master
  • I2C mux connections to Black Pill Hub card
    • INT* - Connects to PB8
    • SCL - Connects to PB6
    • SDA - Connects to PB7
  • I2C Pins
  1. INT* - Connects to PB8
  2. SCL - Connects to PB6
  3. SDA - Connects to PB7
  4. VCC
  5. GND

P8 - SPI

  • 2x3 header
  • SPI Pins
  1. PA6 (MISO1)
  2. 3.3V
  3. PA5 (SCK1)
  4. PA7 (MOSI1)
  5. RES
  6. GND

P11/P12 - GVS Connector

  • Ground, Power, Signal pins
  • Pin near Black pill is signal
  1. PC13
  2. PC14
  3. PC15
  4. N/C
  5. PA0
  6. PA1
  7. PA2
  8. PA3
  9. PA4
  10. PA5/SCK1
  11. PA6/MISO1
  12. PA7/MOSI1
  13. PB0
  14. PB1
  15. PB2
  16. PB10

P12/P13 - GVS Connector

  • Ground, Power, Signal pins
  • Pin near Black pill is signal
  1. GND
  2. PB9
  3. I2C_INT (PB8)
  4. I2C_SDA (PB7)
  5. I2C_SCL (PB6)
  6. PB5
  7. PB4
  8. PB3
  9. PA15
  10. PA12
  11. PA11
  12. RX
  13. TX
  14. PA8
  15. PB15
  16. PB14
  17. PB13
  18. PB12

Headers

H1 - 3.3V source select

  • 1-2 = Power from 5V to 3.3V regulator
  • 2-3 = Power from Black Pill board 3.3V regulator

H2 - 5V Power Source

  • T-shaped header
  • Up - Power 5V from FTDI 5V
  • Down - Power 5V from Black Pill Hub USB power
  • Left - Power 5V from DC Jack

H3, H4, H5, H6 - I2C Power

  • Select the power to/from the (4) I2C interfaces
  • Install in one of the two positions to power the external I2C interface from the Hub board
  1. 3.3V
  2. 5V
  • Remove if power comes in from external I2C interface

H9 - Hub Chip Address

  • Select the 3-bit (A0-A2) address of the PCA9544A I2C hub
  • Remove for 1, install for 0

Switches

SW1 - Reset Switch

  • Press to reset Black Pill board

SW2 - Switch on/off J1, J4 power source

Schematic

Software

Testing

Programming

DFU Programming

STM32F4-Black-Pill-Board-oriented.jpg

  • Steps from Programming|Program STM32 Black Pill (STM32F401 / F411) with Arduino IDE (Windows OS)
    • Add the URL to Additional Board Manager URLs text box:
    • Go to Tools > Board > Boards Manager
    • Search for STM32, select latest version and click Install.
    • Download and install STM32CubeProg from ST.com: [1]
    • Start the STM32CubeProg
    • From the Tools > Board > STM32 Board, select Generic STM32F4 series
    • Select Tools > Board Part Number > BlackPill F411CE
    • Under USB Support, select CDC (generic "Serial" supersede U(S)ART)
    • Under Upload method, select STM32CubeProgrammer(DFU)
    • Use the onboard BOOT0 and NRST button to put the board into bootloader mode:
      • press and hold the BOOT0 button
      • press and release NRST (reset) button to power cycle the processor
      • release BOOT0 button
      • Sometimes removing the USB cable and plugging it back in while pressing BOOT0 button works better
    • Upload sketch

Arduino-Programming-Tools-Dropdown.png

  • Displays in IDE
USB speed   : Full Speed (12MBit/s)
Manuf. ID   : STMicroelectronics
Product ID  : STM32  BOOTLOADER
SN          : 348C35983539
FW version  : 0x011a
Device ID   : 0x0431
Device name : STM32F411xC/E
Flash size  : 512 KBytes (default)
Device type : MCU
Device CPU  : Cortex-M4



Memory Programming ...
Opening and parsing file: ODASTESTER.ino.bin
  File          : ODASTESTER.ino.bin
  Size          : 49132 Bytes
  Address       : 0x08000000 


Erasing memory corresponding to segment 0:
Erasing internal memory sectors [0 2]
erasing sector 0000 @: 0x08000000 done
erasing sector 0001 @: 0x08004000 done
erasing sector 0002 @: 0x08008000 done
Download in Progress:


File download complete
Time elapsed during download operation: 00:00:02.263

RUNNING Program ... 
  Address:      : 0x8000000
Start operation achieved successfully

Other Programming

SerialPropogramming (AN3155).PNG

PCB

Black-Pill-Hub P1385-720px.jpg

Assembly Sheet