• I have accumulated lot of cheap stuff based on STMF103C8T6 chip. Before pandemic, these were typically for < 2 USD on Aliexpress/Ebay including shipping.

    They typically have 20KB RAM, 128KB Flash and USB. Some board files are still in https://github.com/espruino/Espruino/tre­e/UNMAINTAINED_BOARDS/boards

    Wanted to check whether current code still fits and how usable they are with Espruino now. Main reason was to have something to experiment with STLINK V2 dongle (see e.g. https://hackaday.io/project/162597-st-li­nk-clone-repurposing) as I wanted to port something to it so wanted to get familiar quickly with the hardware.

    I started with minimal SAVE_ON_FLASH configuration (only 128KB of Flash!) and then managed to add

    • Flash and Storage modules (including Storage.compact() and getFree())
    • tab completion
    • native calls - Inline C, compiled JS
    • loading modules from storage require("xx")
    • arrow functions (for Espruino IDE storage browsing/uploads)

    while still having 11KB flash free for persistent storage. So overall surprising success. With 20K RAM there is also ~1000 variables.

    So now I have very compact USB stick Espruino device with pin header with up to six GPIOs that can do HW UART (including console if usb is not plugged in), software SPI and I2C and other stuff. Tried e.g. to backup SPI flash (photo here https://i.ibb.co/fG3wRJf/IMG-20211119-01­2644.jpg ) and it was pretty easy to do. I can also load native C code quickly to test this platform.

    The only catch is that there is no bootloader so update is needed via SWD, but when bringing SWD pins outside, which is easy to do, reprogramming is easy and I have two more GPIOs (A13,A14) as SWD functionality can be turned off at runtime via one poke32 call. Also I am thinking about building some "bootloader" and upload it to storage (or RAM) temporarily to update it via USB or serial.

    Some photos, board file and binary build is here
    https://github.com/fanoush/EspruinoBoard­s/tree/master/STLINKV2

  • Wow, this is super cool - thanks for sharing!

  • If you have many of them (I do, my incomplete order history :-) ) then it is good to pick the better ones. Some have two leds, some one, some have chip labelled STM32 some have CKS32 and also some have 680 ohm pullup on SWIM (as per schematics) which is easy to find and scratch off the board and some not. Also some have SWD test points that are easier to solder (bigger or with holes) or attach to, some not. With every order I got slightly different one and then when searching internet I saw plenty of different ones too. I flashed two variants (three in total) and they work fine but no guarantee it will work with yours. Also some are labelled F101 instead of F103 (F101 should not have USB functionality at all, don't have any 101 one myself but others report getting it).

    Also nowadays they are more expensive so not worth getting them now I guess. Funnily I wanted to port CMSIS-DAP debugger source to it including working UART and then checked aliexpress for these dongles again and found cheaper ones already having CMSIS-DAP preinstalled - here or here, ordered but will see what is inside. There can be something worse than STM32.

  • Just a small followup - I found aliexpress store that sells those STLink V2 dongles (board photo https://ibb.co/m4MpRhB) with Geehy APM32F103CBT6 https://www.geehy.com/apm32?id=14

    This APM32F103CBT6 is somewhat interesting STM32F103 clone that has 128KB of flash and can run at 96MHz with usb working (real STM32F103 can only do 72MHz). It even has interesting memory mapped single precision FPU that seems to work. So I made Espruino build that run on that chip at 96MHz.

    These dongles are cheap, small and versatile but the ram/flash is pretty small (20KB,128KB) so the Espruino build is stripped down but still it can be used for small USB to GPIO/SPI/I2C projects. The usb stick like form factor with metal case and pin header on the other side can be handy.

    The shop is here https://www.aliexpress.com/item/10050016­21626894.html but no guarantee you'll get same chip too. I got it twice and made third order. Anyway, it is no big deal, just small heads up.

    And btw this one is also nice because it has two LEDs, no strong pull resistors on B6/B7 and even have extra A9/A10 and BOOT0 pads available on PCB so apart from SWD can be flashed via serial bootloader and those two more GPIOs are also readily available for extra HW uart.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

build for STMF103C8T6 - STLINK V2 dongle, Blue Pill, Maple Mini

Posted by Avatar for fanoush @fanoush

Actions