• 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

  • 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.

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

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

Posted by Avatar for fanoush @fanoush