From 0b9c765d3518ac991a9174c33102e31a78fd8bb6 Mon Sep 17 00:00:00 2001 From: Saleh6969 <141997303+Saleh6969@users.noreply.github.com> Date: Sun, 23 Aug 2026 04:35:34 +0000 Subject: [PATCH] docs: consolidate RTS/DTR settings into one minimal README section Co-authored-by: Hicham Zinalabdin --- README.md | 47 ++++++++++------------------------------------- 1 file changed, 10 insertions(+), 37 deletions(-) diff --git a/README.md b/README.md index f695f88..c323fad 100644 --- a/README.md +++ b/README.md @@ -149,34 +149,23 @@ The MCU nets have fixed pull resistors — idle levels matter when the programme - J1 pin **5** open → R2 holds **BOOT0 low**. - To enter the ROM bootloader you must **actively drive BOOT0 high** (strong enough to overcome R2), then **pulse NRST low** and release. -If CH340 **RTS/DTR** are wired to your pogo `BOOT_PROGRAM` / `RST_PROGRAM` lines, set their **idle** levels so they do not fight these resistors when you are not flashing. +### CH340 RTS/DTR (STM32CubeProgrammer) + +| Programmer circuit | RTS | DTR | +|--------------------|-----|-----| +| Direct drive | High | Low | +| ESP-style dual transistor (inverted) | Low | High | ### Step-by-step (STM32CubeProgrammer) Use [STM32CubeProgrammer](https://www.st.com/en/development-tools/stm32cubeprog.html) → **UART** mode. -#### A. Manual entry (pogo + transistor reset) — recommended - -1. Set UART options in CubeProgrammer **before** Connect (see table below). Use **RTS = Low** and **DTR = High** so idle serial lines match “run mode” and do not pull BOOT0 high or NRST low through your programmer. +1. Set UART options (see table below) and RTS/DTR per your programmer circuit. 2. On the pogo: drive **BOOT0 high** (J1 pin 5), pulse **reset** (J1 pin 6), release reset while BOOT0 stays high. -3. Click **Connect** in CubeProgrammer. +3. Click **Connect**. 4. **Download** `firmware/build/cube_timer_display.bin` at **`0x08000000`**. 5. Release BOOT0 (or let R2 pull it low), reset once — firmware runs. -#### B. If RTS/DTR automate boot/reset on your programmer - -Typical wiring: **RTS → `BOOT_PROGRAM`**, **DTR → reset transistor → `RST_PROGRAM`**. - -| Phase | RTS (BOOT0) | DTR (reset circuit) | Result on MCU | -|-------|-------------|---------------------|---------------| -| Enter bootloader | **High** | **Low** (reset) | BOOT0 high, NRST low | -| Release reset | **High** | **High** | BOOT0 high, NRST high → ROM UART bootloader | -| After flash / normal run | **Low** | **High** | BOOT0 low (R2), NRST high (R1) → user flash | - -Sequence: RTS **high**, DTR **low** briefly, then DTR **high** while RTS stays **high** before Connect. After programming, set RTS **low** and DTR **high** before disconnect. - -If your reset transistor is inverted (DTR **high** = reset active), swap the DTR column. - #### STM32CubeProgrammer UART settings | Setting | Value | @@ -189,21 +178,6 @@ If your reset transistor is inverted (DTR **high** = reset active), swap the DTR | Data bits | **8** | | Stop bits | **1** | | Flow control | **Off** | -| **RTS** | **Low** *(idle — lets R2 hold BOOT0 low)* | -| **DTR** | **High** *(idle — lets R1 hold NRST high)* | - -Use the RTS/DTR row as the **safe idle** for manual pogo flashing. Only drive RTS **high** / DTR **low** when you intentionally enter the bootloader (manually or via your programmer sequence). - -CLI equivalent for idle lines before a manual boot entry: - -```text -STM32_Programmer_CLI.exe -c port=COM3 uart=115200 parity=even rts=low dtr=high -``` - -4. **Run after download** - - RTS **Low**, DTR **High** (or BOOT0 released / J1 pin 5 open so R2 pulls **low**) - - Reset the MCU - - Display firmware should start ### Command line (`stm32flash`) @@ -222,9 +196,8 @@ Replace `/dev/ttyUSB0` with your CH340 device (`COM3` on Windows, etc.). - **BOOT0 must be high during reset** to enter the ROM bootloader, not only after the chip is running. - **R2 (10 kΩ)** pulls BOOT0 low when J1 pin 5 is open — you need a **strong high** on `BOOT_PROGRAM` to enter the bootloader, not a weak float. - **R1 (10 kΩ)** pulls NRST high when J1 pin 6 is open — reset is **active low** (pull NRST low, then release). -- Set CubeProgrammer **RTS Low / DTR High** at idle so CH340 does not accidentally boot or reset the chip when connecting. - If connect fails, swap-check TX/RX against the J1 table above. -- After flashing, **BOOT0 must be low** (RTS low or pin 5 open) otherwise the chip stays in bootloader mode. +- After flashing, **BOOT0 must be low** (pin 5 open so R2 pulls low) otherwise the chip stays in bootloader mode. - If UART is flaky, tie **3.3 V** on J1 pin 1 in addition to board power. - You can flash with Stackmat and display wiring connected — programming uses PA9/PA10 only. @@ -291,6 +264,6 @@ See [LICENSE](LICENSE) (GPL-3.0). |------|----------------| | Flash binary | `firmware/build/cube_timer_display.bin` @ `0x08000000` | | Rebuild | `cd firmware && ./build.sh` | -| Flash docs | BOOT0 high + reset → UART 115200 8E1; idle RTS **Low**, DTR **High** | +| Flash docs | BOOT0 high + reset → UART 115200 8E1 | | Config | `firmware/src/config.h` | | Pins | `firmware/src/board_pins.h` |