-
Notifications
You must be signed in to change notification settings - Fork 66
Description
Problem: "logic" command does not terminate on some "Blue Pill" MCUs
Reason: MCU does not generate interrupt when writing past end of RAM
Workaround: None. Do not use "logic edges=" or "logic edges=unlimited" feature. Set "logic duration=" or manually halt sampling via ENTER key.
Background info: Firmware sampling code is infinite loop terminated by write past end of memory, elapsed timer, or user halt command from host via USB. See Infinite loop.
Details:
Manufacturers of "Blue Pill" development boards are known to use cloned/bootleg/reject STM MCUs. See https://github.com/keirf/Greaseweazle/wiki/STM32-Fakes and other online resources. Note that visual inspection of the MCU is likely not sufficient to determine genuine chips vs clones. Note also that some clones may perform perfectly/adequately, and that the buck50 firmware exercises more STM32F103 subsystems/peripherals than does Greaseweazle. Also that there are at least two variants of "Blue Pill" PC boards (silkscreen labels, components -- round metal reset switch vs rectangular plastic, and USB connector) but these differences are not sufficient to tell if a board/MCU has the interrupt problem. The failing MCUs I have tested return a 0x2BA01477 CPUTAPID as reported by openocd software, compared to working chips with 0x1BA01477 which matches documentation in ST Reference Manual RM0008. Again, this may or may not be a 100% reliable means of detecting "good" vs "bad" chips, and I have seen 0x2BA01477 chips explicitly marked as clones with "CKS32F103C8T6" but also with seemingly correct STM markings. Finally, I assume triggering the ARM HardFault IRQ when writing to reserved locations in the CPU memory map is correct behavior (0x2BA01477 chips do not raise HardFault or any other IRQ) but do not have a definitive documentation reference stating this, nor a 100% known-to-be-genuine STM32F103 chip to test. One more: Clone chips likely will eventually terminate sampling when addresses increment into the 0x40000000 peripherals area of the memory map (in approx. 85.9 seconds with max 6.25MHz sampling speed input signals, or 4.3 years with none), probably resulting in CPU lockup requiring hardware reset.