Welcome

Programming the chip

So programming is easy: download the SDK, put it in a directory, insert blink.c and go, right? Well, we're talking non-mainstream SoCs here, so it's not likely to be that easy. There's two problems: first of all, the SDK is available but needs one of two commercial C compiler packages to work (either IAR or Keil), and secondly programming the chip needs to be done either through one of those compiler packages or through a closed-source Windows-only program that uses a seemingly-undocumented programming protocol.

Luckily, this chip has a bog-standard ARM Cortex M0+ as its core, and that means a fair few things are standardized. Chips like this support SWD, a two-wire way of debugging anything running on the core, and e.g. OpenOCD has the capability to connect to that. For compilation, GCC has had an Arm compiler since forever, and as it also has Cortex M0+ functionality, it can be a good replacement for the costly commercial compilers.

The SDK still needed some wrangling to get to work under gcc. First of all, it has some specific defines and include file requirements that assume things from the compiler that gcc does not fulfill. Secondly, while gcc is a compiler, it's not a build system. The first problem can be solved by copying, hacking, and coming up myself with the required things that satisfy the SDKs requirements. The second issue is fixed by pressing good old GNU Make into service to handle building everything. The result is a 'SDK wrapper' that makes building programs from the SDK using FLOSS tools possible. You can grab it here if you're interested.

Secondly, we still need to program the flash. OpenOCD can happily connect to the chip using one of a plethora of available SWD debuggers, but it does not know about the integrated flash, or how to program it. The solution for this is to write a flash driver. Luckily, after machine-translation from Chinese, the translated docs are fairly readable, and it didn't take me long to add a slow-but-functional flash driver to OpenOCD. My modified version of OpenOCD is included in the SDK as a submodule, or you can fetch it here.

With that, I managed to finally write my blinkie:

And with that, I reached my goal: grab this tiny microcontroller and see if I can use it, even though documentation is in Chinese and the chip is in a miniscule package. I'm not planning to do anything with the other 6 chips I have yet, but knowing that I know how to handle them is a good addition to my mental toolbox.

« Prev 3 

9 comments

prez wrote at 21 Mar 2022, 20.07:

Correction: https://jlcpcb.com/capabilities/Capabilities says that on single and double layer PCBs the minimum total via diameter is 0.6mm; on multilayer boards it's 0.4mm, with 0.1mm-thick ring and 0.2mm hole Your dry hole idea is intriguing, maybe reflow the chip and then blind-solder magnet wire into the hole, hoping that it'd wet and bond into the ball?

Nathan Myers wrote at 21 Mar 2022, 20.00:

So maybe instead of a via, you just have a hole drilled through to a pad on the other side, and you solder a wire to that pad extending through the board, cut flush so the ball will sit on it. Effectively, a dead bug connection coming through the board.

prez wrote at 21 Mar 2022, 14.42:

@Nathan, the minimum via diameter is 0.4mm, plus the pad ring, and balls are 0.35mm apart so you can't put it under the ball

Sprite_tm wrote at 21 Mar 2022, 12.36:

Ron: I work and live in China; our company makes Chinese products. My 'accusations' are 1. against closed source stuff, and 2. against posting everything in Chinese-only while the rest of the world tends to use English as the lingua franca. To be honest, I didn't intend it to read as me having an issue with the product purely because it's Chinese; I'll see if I can modify the article to reflect that.

logan wrote at 21 Mar 2022, 11.19:

Great write-up. It somewhat reminded me of 3 cent Padauk OTP MCU from China EEVblog 'discovered' in 2019.

Tim wrote at 21 Mar 2022, 10.59:

Check out the MAXIM 32660. Available in a 16 pad WCSP. 1.6 x 1.6mm. With a Cortex M4, 96mhz, 256k FLASH and 128k RAM. Have used if in a commercial product.

Ron wrote at 21 Mar 2022, 10.27:

I think a bit less negative and accusatory language, because it's a Chinese product, would look better for both the article and the author.

Nathan Myers wrote at 21 Mar 2022, 9.44:

Could the pad for an interior ball double as a via?

Cedric wrote at 19 Mar 2022, 17.43:

Super congrats, this is beautiful...

Leave a comment:

Your name:

What does this picture say?
Sorry, this is a captcha

Your comment:


© 2006-2021 Sprite_tm - Contact