PY32F002 - Chinese ARM for 8 cents from PUYA


There was already an ARM for 16 cents , now we have ARM for 8 cents. Yes, eight.

PY32F002/PY32F003 from PUYA are microcontrollers with ARM Cortex M0+ core clocked at 24/32MHz.
PY32F002 have 20kB FLASH, 3kB RAM, SPI, USART, I2C, ADC, timers... nothing to complain about.
PY32F003 additionally DMA and a few more timers, there is also a larger choice of memory.
There is an SWD interface, so you don't need some exotic programmer.
Power supply 1.7V...5.5V.
Packages from standard SOPs, through TSSOPs, to small QFNs or DFNs.
Downloadable PDFs on the Chinese version of the site:
https://www.puyasemi.com/cpzx3/info_267_aid_242_kid_235.html
Click on the orange folder. Each has the same RAR with a bunch of PDFs and other aids. Some in Chinese, some in English.
PY32F002:

PY32F003:

Examples of enclosures:




Hello world (sources attached):

Flashing LEDs and text on UART (9600 bps)
Tests:
From what I've noticed there are a few issues with the reset.
1. When connecting a button to the RESET pin sometimes a HardFault interrupt appears after pressing it.
The external reset can be disabled so that the problem is rather small. I haven't used an external reset in a long time.
2. The system can be overclocked about 2 times by setting the "wait state" of the flash to 1 and changing the calibration of the generator.
The only problem is that the reset resets the "wait state" of the flash, not resets the generator calibration.
If someone wants to overclock, don't reset.
The current consumption in sleep mode is about 5uA, so I wouldn't call it an 8-bit killer. Comparing the prices...

Programming:
To add support for PUYA chips to J-Link, upload the ".FLM" files from the attachment to the "/opt/SEGGER/JLink/Devices/Puya/" directory and add the following to the "JLinkDevices.xml" file:
Quote:<!-- -->
<!-- Puya -->
<!-- -->
<Device>
<ChipInfo Vendor="ST" Name="PY32F002Ax5" WorkRAMAddr="0x20000000" WorkRAMSize="0xC00" Core="JLINK_CORE_CORTEX_M0"/>
<FlashBankInfo Name="FLASH" BaseAddr="0x08000000" MaxSize="0x5000" Loader="Devices/Puya/PY32F0xx_20.FLM" LoaderType="FLASH_ALGO_TYPE_OPEN" AlwaysPresent="1"/>
<FlashBankInfo Name="OPT" BaseAddr="0x1FFF0E80" MaxSize="0x10" Loader="Devices/Puya/PY32F0xx_OPT.FLM" LoaderType="FLASH_ALGO_TYPE_OPEN" AlwaysPresent="1"/>
</Device>
<Device>
<ChipInfo Vendor="ST" Name="PY32F003x4" WorkRAMAddr="0x20000000" WorkRAMSize="0x800" Core="JLINK_CORE_CORTEX_M0"/>
<FlashBankInfo Name="FLASH" BaseAddr="0x08000000" MaxSize="0x4000" Loader="Devices/Puya/PY32F0xx_16.FLM" LoaderType="FLASH_ALGO_TYPE_OPEN" AlwaysPresent="1"/>
<FlashBankInfo Name="OPT" BaseAddr="0x1FFF0E80" MaxSize="0x10" Loader="Devices/Puya/PY32F0xx_OPT.FLM" LoaderType="FLASH_ALGO_TYPE_OPEN" AlwaysPresent="1"/>
</Device>
<Device>
<ChipInfo Vendor="ST" Name="PY32F003x6" WorkRAMAddr="0x20000000" WorkRAMSize="0x1000" Core="JLINK_CORE_CORTEX_M0"/>
<FlashBankInfo Name="FLASH" BaseAddr="0x08000000" MaxSize="0x8000" Loader="Devices/Puya/PY32F0xx_32.FLM" LoaderType="FLASH_ALGO_TYPE_OPEN" AlwaysPresent="1"/>
<FlashBankInfo Name="OPT" BaseAddr="0x1FFF0E80" MaxSize="0x10" Loader="Devices/Puya/PY32F0xx_OPT.FLM" LoaderType="FLASH_ALGO_TYPE_OPEN" AlwaysPresent="1"/>
</Device>
<Device>
<ChipInfo Vendor="ST" Name="PY32F003x8" WorkRAMAddr="0x20000000" WorkRAMSize="0x2000" Core="JLINK_CORE_CORTEX_M0"/>
<FlashBankInfo Name="FLASH" BaseAddr="0x08000000" MaxSize="0x10000" Loader="Devices/Puya/PY32F0xx_64.FLM" LoaderType="FLASH_ALGO_TYPE_OPEN" AlwaysPresent="1"/>
<FlashBankInfo Name="OPT" BaseAddr="0x1FFF0E80" MaxSize="0x10" Loader="Devices/Puya/PY32F0xx_OPT.FLM" LoaderType="FLASH_ALGO_TYPE_OPEN" AlwaysPresent="1"/>
</Device>
Comments
Add a commentWhere can I buy them? [Read more]
https://www.lcsc.com/products/Microcontroller-Units-MCUs-MPUs-SOCs_11329.html?keyword=py32f0 [Read more]
So I'm surprised that all the Chinese "toys" are still on modern '51 versions. Regarding Chinese systems, maybe someone knows what it looks like with compatibility, e.g. HC32F460KCTA and STM32F446RC.... [Read more]
Apparently, they assume that there is no need for "sparrow cannons" (Jż once was action with sparrows). [Read more]
Because '51s are 4 cents, not 8 ;) And they have programs ready for years. [Read more]
It is a pity that such microcontrollers are not available on ali. If I were to order only this microcontroller with lscs, it would still be cheaper to get something on the local market. [Read more]
More and more ARM or RiscV, but 8-bit for 2 cents probably won't disappear. They are PY32F003, just the price is ridiculous. I usually order with tiles, then I get free shipping. [Read more]
Someone wrote a toy program 20 years ago and they just keep using it. It's a matter of time and they will do it on ARMs. Changes are happening right before our eyes, at least in terms of prices. ... [Read more]
Let's hope, although in the context of the recent flood of messages, how ChatGPT spits out programs based on a verbal description, you can feel confused if it's all going in the right direction. ... [Read more]
It's a big advantage. In many solutions, the contortions needed to run the environment are an obstacle with limited time. Glad they're going this way :) [Read more]
where do you buy this and how much? [Read more]
This is "free" resulting from the use of the Cortex M core. There was no point in inventing something of our own, so we got the compatibility for free. Recently, I became the owner of several hundred... [Read more]
In 20 years, you will dictate the description to your smartphone, and after a week you will receive a ready assembled and programmed system. It twists me. [Read more]
Maybe not in 20 years, but in 10 years. And not only a ready assembled system, but possibly the whole device with a housing printed on a 3D printer ;) Interestingly, everything will be completely automated. ... [Read more]
@piotrgo And what environment or sdk do you use to program these PUYAs? Because I would love to play with them too :) Regards, Azbi [Read more]
Regular editor with syntax highlighting and multiple tabs. It goes with everything. I was tired of so many different scales that I got used to it. In addition, GCC / SDCC / or whatever it is for a given... [Read more]
VSCode works quite well with the Cortex Debug plugin, proper configuration and OpenOCD. [Read more]
What is the compatibility of such programs? I mean, I understand that "hex" will not work, but having the source code, it is enough to compile it using "Chinese tools"? [Read more]
I'm just keeping an eye on it for now. I have a GD32, but no time to test it yet. As far as I know, in most cases a binary compiled for STM32 should work on a Chinese replacement. After all, these... [Read more]