News for hackers. Stuff that matters.

embedawayz

Re:The amazing $1 microcontroller (2017) on Thursday September 10, 2020 @02:15AM (#24429414)
Eh, sometimes it's nice to have a go-to workhorse that you can throw into almost anything.

The STM32F103C8 is a good example. If you buy a few dozen off of AliExpress or TaoBao, "blue pill" boards containing them and a microUSB connector cost less than $3 each.

They only run at 72MHz, and they don't have floating-point hardware, but the price point means that you can give them away without a second thought. When someone has an idea for a Halloween decoration, or a garden sensor, or a proof-of-concept, it's usually my first choice because it costs less than a coffee.

Once it stops getting rained on, and corroded, and coated in dust, and submerged, and fried by a squirrel who thought wires were edible...then you can reach for the top of the line.

Re:The amazing $1 microcontroller (2017) on Thursday September 10, 2020 @01:27AM (#24429155)
As an example, the modern equivalent of its STM32F0 chip would probably be an STM32G0.

STM32F030F4 ($0.55@2500) -> STM32G030F6 ($0.49@2500):

* Clock speed: 48MHz -> 64MHz

* Flash memory: 16KiB -> 32KiB

* SRAM: 4KiB -> 8KiB

* CPU core: Cortex-M0 -> Cortex-M0+

The newer chips are also on a smaller process node, so they can run off of slightly lower voltages and use a bit less power.

They're incremental improvements, but time is starting to march on...

Re:The amazing $1 microcontroller (2017) on Thursday September 10, 2020 @01:10AM (#24429079)
You can write ordinary C code to run on them. You just need a separate compiler/linker/etc. because they have a different CPU architecture than your computer. For an ARM Cortex-M chip, you can use the `arm-none-eabi` GNU toolchain:

https://developer.arm.com/tools-and-software/open-source-sof...

But when you write a program for a microcontroller, you don't have an OS kernel, so your code needs to include drivers for anything that you want to communicate with.

It's a little outdated, but I like this introduction to STM8 chips (which this article also mentions) as a quick crash course on embedded C:

https://lujji.github.io/blog/bare-metal-programming-stm8/

Re:The amazing $1 microcontroller (2017) on Thursday September 10, 2020 @12:50AM (#24428992)
I try not to use them, but they seem fine for basic SPI/UART/etc. Someone did an analysis of the dies, and apparently they compare favorably in some ways:

https://zeptobars.com/en/read/GD32F103CBT6-mcm-serial-flash-...

I haven't tried anything complicated with the peripherals though, and the thing is, STM32F103 chips are so cheap already. The design is over 10 years old, and ST is so good at making them that most "64KB" chips actually have 128KB of Flash.

The GD32V chips are very cool, though; they keep the STM32-alike peripherals, but they use a faster RISC-V CPU core (rv32imac).