Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,16 @@ jobs:
if [ -n "$4" ]; then git -C "$RUNNER_TEMP/st/$1" sparse-checkout set $4; fi
git -C "$RUNNER_TEMP/st/$1" checkout -q FETCH_HEAD
}
fetch cubef4 https://github.com/STMicroelectronics/STM32CubeF4.git 60c8abe0ae88a23bbd1c925358330031e36dd20f "Projects/STM32446E-Nucleo Projects/STM32F446ZE-Nucleo"
fetch cubef4 https://github.com/STMicroelectronics/STM32CubeF4.git 60c8abe0ae88a23bbd1c925358330031e36dd20f "Projects/STM32446E-Nucleo Projects/STM32F446ZE-Nucleo Drivers/BSP/Adafruit_Shield Utilities/Log Utilities/Fonts"
fetch stm32f4xx_hal_driver https://github.com/STMicroelectronics/stm32f4xx_hal_driver.git 1f6451c3e07728b4c830744de380e56bf5bc0026
fetch cmsis_device_f4 https://github.com/STMicroelectronics/cmsis_device_f4.git 9192c7b9df75a142f2027ab266601fe061fc00b3
fetch stm32f4xx-nucleo-bsp https://github.com/STMicroelectronics/stm32f4xx-nucleo-bsp.git 84b99c762908ef56f711acf970ab13d4ec278df6
fetch stm32f4xx-nucleo-144-bsp https://github.com/STMicroelectronics/stm32f4xx-nucleo-144-bsp.git 1daff230cd72b9860df011c25d815e399af6d117
fetch stm32-mw-usb-device https://github.com/STMicroelectronics/stm32-mw-usb-device.git 2a0a3521ac4d84e6e494d37bed615e2d36c373f5
fetch stm32-mw-usb-host https://github.com/STMicroelectronics/stm32-mw-usb-host.git 9d46e44c858a77bf126920b7bcc258d59afa89b1
fetch stm32-mw-fatfs https://github.com/STMicroelectronics/stm32-mw-fatfs.git fc7f8edc3ac2e263c2f231026053e15d3587b34b
fetch stm32-st7735 https://github.com/STMicroelectronics/stm32-st7735.git 2b7db825b3946fd19a158947f9be685e761bed3d
fetch stm32-bsp-common https://github.com/STMicroelectronics/stm32-bsp-common.git 1e18c5afdf1f5971a35c8e2f88b6a21e5568ed92
python3 tests/vendor/stm32cubef4/run.py --st "$RUNNER_TEMP/st" --embsim build/${{ matrix.preset }}/bin/embsim
python3 tests/vendor/stm32cubef4/run.py --st "$RUNNER_TEMP/st" --board nucleo_f446ze --embsim build/${{ matrix.preset }}/bin/embsim
- name: Pico SDK applications on the unmodified SDK
Expand Down
52 changes: 52 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,58 @@ versions follow semantic versioning. There is no release yet.

## Unreleased

### USB host mode: the NUCLEO-F446ZE drives a mouse and a flash drive, with Adafruit's TFT shield

- The STM32F446's OTG FS core as a host (`stm32-otg-fs`, FHMOD): the port
(PPWR, connection and disconnection, PRST's reset, the port enabled at
the device's full or low speed, PSUSP and PRES, PLSTS), an SOF or a
low-speed keep-alive every HFIR frame, and twelve channels with SETUP,
OUT and IN transactions at the bus's bit time, their data toggles, ACK,
NAK, STALL, time-outs, babble and toggle errors, the CHDIS/CHENA halt
and its CHH, one IN token per enable, interrupt channels once a frame on
ODDFRM's parity, the transmit FIFOs' space and the receive FIFO's host
statuses, as ST's HCD driver expects them. The MCU is both ends of its
cable: a device's pull-up reaches its host side (`mach.h`'s usbh hooks).
- USB device parts share a device core (`core/model/usb_dev.c`: chapter 9's
standard requests, EP0 in bMaxPacketSize0 packets, toggles, halts,
VBUS above 4.4 V); `emblink/usb_mouse`, a low-speed HID boot mouse
(046D:C06C) whose inputs move it and press its buttons. The PC's host
enumerates low-speed devices at 1.5 Mbit/s.
- `emblink/stmps2151str`, ST's 500 mA USB power switch with an active-high
enable, its values from ST's datasheet (90 mOhm, VIL 0.8 V, VIH 2.0 V);
the NUCLEO-F446ZE's U12 powers CN13's VBUS from 5V while PG6 is high.
- `emblink/st7735_tft18`, a 1.8" 128 x 160 TFT on a Sitronix ST7735R as a C
model: its 4-wire SPI, the 18-bit frame memory, CASET/RASET (each address
as its bytes come), RAMWR, MADCTL's order, COLMOD's 12, 16 and 18 bits,
sleep, display, inversion, idle and partial modes, the resets; its image
(as the module is held), a checksum and a pixel probe are outputs.
- `emblink/adafruit_tft_shield18`, Adafruit's 1.8" TFT shield (product
802) on the Arduino header: the TFT and the five-way joystick's ladder
on A3, its resistors from Adafruit's schematic.
- `emblink/usb_flash_drive`, a USB flash drive: a full-speed mass storage
device (Bulk-Only Transport with its CBW, CSW, residues, STALLs and reset
recovery; SCSI's INQUIRY, TEST UNIT READY, REQUEST SENSE, MODE SENSE,
READ FORMAT CAPACITIES, READ CAPACITY(10), READ(10), WRITE(10) and the
rest a host sends), its medium formatted as from the shop (an MBR, one
FAT16 partition); its outputs list its files as a computer would.
- STM32CubeF4's USB_Host/MSC_Standalone runs unmodified on the
NUCLEO-F446ZE with the shield and the drive on CN13: it mounts the drive
with FatFs, writes 'USBHost.txt', reads it back ('FatFs data compare
SUCCESS') and lists it; the drive then holds USBHOST.TXT, 40 bytes
(14/14).
- STM32CubeF4's USB_Host/HID_Standalone runs unmodified on the NUCLEO-F446ZE
with the shield and a mouse on CN13: it switches VBUS on through U12,
enumerates the mouse at low speed, logs it on the LCD, starts its mouse
demo on the joystick's SEL and draws the mouse's moves (13/13).
- The engine: an analog island chopped by another part's events under a
microsecond apart (a core's SPI clock beside a settling supply) lags up
to 10 us behind instead of a step to each, and catches up before a part
changes its sources, an MCU or a probe reads it, and at an advance's end;
the STM32's alternate-function table is indexed and its peripherals'
names cached, and an MCU no longer re-reads its ports on its own
outputs' echoes. The HID host scenario runs 7 times faster than before
these (18 min to 2.5 min for 3.3 s).

### A logic analyzer: the Saleae Logic 8

- `emblink/saleae_logic8`: Saleae's 8-channel USB logic analyzer as a part
Expand Down
23 changes: 16 additions & 7 deletions catalog/boards/nucleo_f446ze/board.json
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,11 @@
},
"doc": "R35: CN13's VBUS to PA9 (OTG_FS_VBUS), through SB127 (closed)"
},
{
"id": "U12",
"component": "emblink/stmps2151str",
"doc": "U12 (STMPS2151STR): +5V to CN13's VBUS while PG6 (USB_PowerSwitchOn) is high, for a device plugged into CN13 when the OTG core is a host; its FAULT to USB_OVCR (PG7 through JP4, LD7)"
},
{
"id": "R72",
"component": "emblink/resistor",
Expand Down Expand Up @@ -431,7 +436,8 @@
"U6.IN",
"R29.1",
"CN8.9",
"CN11.18"
"CN11.18",
"U12.IN"
],
"LD6_A": [
"R29.2",
Expand Down Expand Up @@ -515,7 +521,8 @@
"CN12.63",
"CN12.71",
"CN12.72",
"CN13.5"
"CN13.5",
"U12.GND"
],
"NRST": [
"U8.NRST",
Expand Down Expand Up @@ -596,7 +603,8 @@
"USB_VBUS": [
"R35.1",
"R68.1",
"CN13.1"
"CN13.1",
"U12.OUT"
],
"PA9": [
"U8.PA9",
Expand All @@ -606,7 +614,8 @@
"PG6": [
"U8.PG6",
"R72.1",
"CN12.70"
"CN12.70",
"U12.EN"
],
"PG7": [
"U8.PG7",
Expand All @@ -616,7 +625,8 @@
"USB_OVCR": [
"JP4.2",
"R71.2",
"LD7.K"
"LD7.K",
"U12.FAULT"
],
"LD7_A": [
"R61.2",
Expand Down Expand Up @@ -3716,12 +3726,11 @@
},
"fidelity": {
"functional": {
"claims": "Nets, ports, LD1 to LD3 and LD6 to LD8, B1, B2 and the jumpers as parts, as MB1137 B-01's schematic draws them; the STM32F446ZE runs its firmware (see its description), its HSE an 8 MHz clock on PH0 (the ST-LINK's MCO through SB149: HSEBYP needed, as on the real board) and its LSE the X2 crystal. The ST Zio connectors CN7 to CN10 carry the NUCLEO-F446ZE's assignment (D0 to D72, A0 to A8, the solder bridges in their factory state) and the morpho headers CN11 and CN12 (2 x 36) every one of the part's 114 I/Os. CN13's VBUS reaches PA9 through R35 and lights LD8; its D-, D+ and ID are PA11, PA12 and PA10, and a USB host on them (emblink/usb_host) enumerates the OTG FS controller in device mode (STM32CubeF4's HID_Standalone runs on it unmodified); PG6 and PG7 carry U12's enable and fault lines (R72's pull-down, R71's pull-up through JP4). The ST-LINK/V2-1's virtual COM port is the session's console on USART3 (PD8/PD9, through SB5 and SB6) and a serial port on the host.",
"claims": "Nets, ports, LD1 to LD3 and LD6 to LD8, B1, B2 and the jumpers as parts, as MB1137 B-01's schematic draws them; the STM32F446ZE runs its firmware (see its description), its HSE an 8 MHz clock on PH0 (the ST-LINK's MCO through SB149: HSEBYP needed, as on the real board) and its LSE the X2 crystal. The ST Zio connectors CN7 to CN10 carry the NUCLEO-F446ZE's assignment (D0 to D72, A0 to A8, the solder bridges in their factory state) and the morpho headers CN11 and CN12 (2 x 36) every one of the part's 114 I/Os. CN13's VBUS reaches PA9 through R35 and lights LD8; its D-, D+ and ID are PA11, PA12 and PA10, and a USB host on them (emblink/usb_host) enumerates the OTG FS controller in device mode (STM32CubeF4's USB_Device HID_Standalone runs on it unmodified), and as a host the controller enumerates a device on CN13, U12 powering its VBUS (USB_Host HID_Standalone, with Adafruit's 1.8\" TFT shield, runs on it unmodified with a USB mouse, MSC_Standalone with a USB flash drive); U12 (STMPS2151STR) powers CN13's VBUS from 5V while PG6 is high (R72 pulls it down), for a device on CN13 when the OTG core is a host; its fault line reaches PG7 through JP4 (R71's pull-up) and never asserts. The ST-LINK/V2-1's virtual COM port is the session's console on USART3 (PD8/PD9, through SB5 and SB6) and a serial port on the host.",
"omissions": [
"the ST-LINK/V2-1 itself: its USB enumeration, the mass-storage drag-and-drop programming, SWD and its NRST drive (the session programs and debugs the board, ADR-031)",
"the VCP's bytes reach USART3 directly, not as frames on PD9",
"LD4 (COM), the ST-LINK's tricolour LED",
"U12 (STMPS2151STR), the switch that would power VBUS from +5V for a USB host (the OTG core's host mode is not modelled either): VBUS comes only from what is plugged into CN13, and U12's fault output never asserts (LD7 stays dark)",
"the Ethernet PHY and RJ45 of sheet 5, which the NUCLEO-F446ZE does not carry (the STM32F446 has no Ethernet MAC)",
"the solder bridges are fixed in their factory state (SB120 on PB0, SB121 on PA7, SB144/SB145/SB148 open, SB163 closed, SB143/SB138 open, the F303ZE, F412ZG and L476ZG alternatives open)",
"one JP3 shunt sits on one position only; the three switches here can all be closed",
Expand Down
108 changes: 108 additions & 0 deletions catalog/boards/nucleo_f446ze/tests/usb-host-vbus.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
{
"schema_version": 1,
"kind": "component_test",
"name": "usb-host-vbus",
"description": "Powered from the ST-LINK's USB, PG6 (USB_PowerSwitchOn) driven high as the OTG core's host firmware does (USBH_LL_DriverVBUS): U12 (STMPS2151) joins 5V to CN13's VBUS, which feeds a 100 mA device (a 50 ohm load), lights LD8 and reaches PA9; U12's fault line stays high (LD7 dark).",
"policy": "electrical",
"until": "10ms",
"circuit": {
"boards": [
{
"id": "B1",
"board": "emblink/nucleo_f446ze"
}
],
"components": [
{
"id": "HOST",
"component": "emblink/vsource",
"params": {
"kind": "dc",
"dc": 5.0
}
},
{
"id": "CABLE",
"component": "emblink/resistor",
"params": {
"resistance": 0.25
}
},
{
"id": "G",
"component": "emblink/gnd"
},
{
"id": "EN",
"component": "emblink/vsource",
"params": {
"kind": "dc",
"dc": 3.3
}
},
{
"id": "DEV",
"component": "emblink/resistor",
"params": {
"resistance": 50.0
}
}
],
"nets": {
"HOSTV": [
"HOST.+",
"CABLE.1"
],
"VBUS": [
"CABLE.2",
"B1.U5V"
],
"GND": [
"HOST.-",
"G.GND",
"B1.GND",
"EN.-",
"DEV.2"
],
"PA9": [
"B1.CN12_21"
],
"CN13VBUS": [
"B1.USB_VBUS",
"DEV.1"
],
"PG6": [
"EN.+",
"B1.CN12_70"
],
"PG7": [
"B1.CN12_67"
]
}
},
"inputs": [],
"expect": {
"net:CN13VBUS": {
"at": "9ms",
"min_v": 4.6,
"max_v": 5.05
},
"net:PA9": {
"at": "9ms",
"min_v": 4.6,
"max_v": 5.05
},
"output:B1.LD8.luminance": {
"at": "9ms",
"min": 0.05
},
"output:B1.LD7.luminance": {
"at": "9ms",
"max": 0.001
},
"net:PG7": {
"at": "9ms",
"min_v": 3.0
}
}
}
Loading