All units reported the ChibiOS kernel version "400" as USB serial number,
so Windows could not tell two tinySAs apart: with two of them on the same
VID/PID only one enumerated, and a unit could get another unit's COM port.
The serial number is now 12 hex digits made from the MCU unique ID the way
the STM32F303 DFU bootloader makes its serial number (UID0 + UID2, then the
upper half of UID2): a tinySA Ultra has the same serial as COM port and in
DFU mode. It is filled at every USB reset, before the host asks for it.
Windows assigns every unit a new COM port once.
Tested: ZS407 enumerates as 1781:0A44\205D346A2039 (its DFU serial), the
tinySA BASIC as 0483:5740\2056325F2039, both work side by side.
BASIC about +80 B flash, +26 B RAM.
The tinySA ULTRA enumerates as VID 0x1781 PID 0x0A44 instead of the ST
virtual COM port pair 0x0483 0x5740; the tinySA keeps 0x0483 0x5740.
The IDs now follow the model (TINYSA4) instead of the USB descriptor
variant (__USE_USB_MSC__). bcdDevice is unchanged.
Tested on a ZS405 (HW V0.4.5.1) under Windows 11: the composite device,
the serial port and the mass storage interface bind to the inbox drivers
(usbccgp, usbser, USBSTOR) without an INF, the console works on the new
COM port and "reset dfu" enters the bootloader (0483:DF11) as before.
tinySA-App with both IDs accepted connects to either firmware.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The tinySA ULTRA now enumerates as a composite device: the CDC serial
port plus a mass storage interface (Bulk-Only Transport, SCSI). The SD
card is only presented to the PC in USB DISK mode (STORAGE menu or shell
command 'usbdisk on|off'), which stops sweeping and screen updates so the
mass storage thread owns SPI1 and spi_buffer. Outside the mode the PC
sees an empty card reader, so the serial port never re-enumerates. The
mode ends on touch, jog button, eject from the PC, card removal or
'usbdisk off'.
- usb_msc.c/h: mass storage thread, BOT state machine, SCSI commands
- usbcfg.c: composite descriptors (IAD, bcdDevice 0x0201), bulk EP3,
requests hook, packet memory reuse on a repeated SET_CONFIGURATION and
data toggle reset on CLEAR_FEATURE (both specific to this ChibiOS fork)
- ui.c: USB DISK menu item and mode screen
- main.c: 'usbdisk' command; shell commands that could use SPI1 are
refused while the mode is active
F072 builds are unchanged. Tested on HW V0.5.4 with Windows 11: about
620 KB/s read and 370 KB/s write, data verified against FatFs reads.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
get a fixed string format for USB version string parsing
fix left border ver display for v1.2-3-g.., 1.2-34-g.. and 1.2-3456-g..
changes to make dfu (build *.dfu) and make flash (switch to dfu mode)
Signed-off-by: Martin <Ho-Ro@users.noreply.github.com>
use same name as PRODUCT from Makefile, either tinySA or tinySA4
report FW version as v1.3-nnn-gxxxxxxx in USB descriptor, see dmesg log:
[ +1,567891] usb 1-1: new full-speed USB device number 121 using uhci_hcd
[ +0,179094] usb 1-1: New USB device found, idVendor=0483, idProduct=5740, bcdDevice= 2.00
[ +0,000008] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ +0,000005] usb 1-1: Product: tinySA
[ +0,000005] usb 1-1: Manufacturer: tinysa.org
[ +0,000004] usb 1-1: SerialNumber: v1.3-498-gf04006f
[ +0,003544] cdc_acm 1-1:1.0: ttyACM0: USB ACM device
Signed-off-by: Martin <Ho-Ro@users.noreply.github.com>