Get DMA, PLL with 48 MHz, 4 KB RAM, and 32 KB flash memory for PY32F002Ax5 chips

It seems that most Chinese chips PUYA PY32F002Ax5 have the core from PY32F030x6 chips inside, which gives undocumented features like DMA support, PLL with the ability to run chip on 48 MHz, additional timers like TIM3, and 4 KB RAM with 32 KB flash. How to check if you PY32F002Ax5 has more memory There you have several options: Build and flash this code to test RAM and flash https://github.com/IOsetting/py32f0-template/tree/main/Examples/PY32F0xx/HAL/Test/PY32F002A_32KF_4KR Create an empty 32kb binary file in your preferred hex editor (or use the online hex editor https://hexed.it), put some bytes to the end of the file, flash the file to the chip, then verify those bytes by reading the firmware back. How to unlock hidden features of PY32F002Ax5 If you’re using the HAL and LL libraries from the repository https://github.com/IOsetting/py32f0-template, you just need to modify Makefile, change: MCU_TYPE = PY32F002Ax5 to MCU_TYPE = PY32F003x6 and recompile the entire project. ...

October 18, 2024

PY32F002 pyOCD STLink error (22): DP error

After run the command to upload firmware to chip PY32F002AA15M6TU pyocd load app.hex -t PY32F002Ax5 I got the error 0004908 C STLink error (22): DP error [__main__] But if you try to read firmware, it works fine pyocd> savemem 0x08000000 20480 py32f002.bin BTW pyOCD and ST-Link V2 work well with the PY32F003xx series. The solution is to use CMSIS-DAP based programmer instead of ST-Link V2, but instead of buying a new one you can use STM32 Blue Pill board without adding any extra components, just upload the firmware https://github.com/RadioOperator/STM32F103C8T6_CMSIS-DAP_SWO/blob/master/build/F103-DAP-SWO-CDC-BLUEPILL-SWD_PB8PB9.hex from the repository https://github.com/RadioOperator/STM32F103C8T6_CMSIS-DAP_SWO and connect 2 wires. ...

September 23, 2024