Still, why can't it be erased by the button? Did you modify it?
Anyways, I can't think on a worse example to play with, make a mistake and it'll be gone!
Just play with a led like the rest of the world
You can now tell the wife you'll have food for Christmas!
because the PY32F002A micro is the same as a PY32F030,
except for the pinout, I have prepared a small document (extracted from the datasheets) which can be of some help when you are planning to use the 002A using all the "enhancements" of the 030.
I hope it can be of some use...
During a test on a PY32F003 current was fed via the onboard protection diodes into the bulk capacitors placed on the output of a 5V regulator powering a py32F003. As more current was pushed in than drawn by the processor the voltage started to rise to about 8V. I thought this was the end of that microcontroller but to my surprise nothing broke and the processor still runs fine. I thought this is quite remarkable and makes me think that these PYFxxx controllers have quite robust IO pins.
For the 8 pin (SOP8) PY32F002AL15S6TU, how would i flash this device? using J-link, USART RX/TX and PA14 ?
This model does not have a boot0 mode, only reset/nrst button?
I'm trying to connect to the 8 pin (SOP8) PY32F002AL15S6TU via PuyaISP, but i cant really get it working, how should i enter the bootloader? I have tried pulling pin 6 (PA2/PF2-NRST) both high and low while power-cycling the MCU, but PuyaISP wont connect,
Is pulling NRST high the correct method to enter the bootloader? This package does not have a dedicated BOOT0 pin,
I have the option to try J-Link, does Puya have some tool to upload or read the mcu info via this? I have tried PuyaProgrammer but it can't find the USB device to use for SWD, For the J-link i'm using a nucleo board i have converted to J-link, but i belive Puya has its own programmer but it should be compatible ?
You already asked ths and were answered:
Jlink, dap...
No bootloader possible without Boot0, you need a programmer or buy a different package which has Boot0.
Read the thread, that matter has already been talked.
I have the option to try J-Link, does Puya have some tool to upload or read the mcu info via this? I have tried PuyaProgrammer but it can't find the USB device to use for SWD, For the J-link i'm using a nucleo board i have converted to J-link, but i belive Puya has its own programmer but it should be compatible ?
J-Link has its own software, which can be downloaded from
https://www.segger.com/downloads/jlink/
I'm reading this thread and trying to piece together on how to programm the SOP8/SOP16 versions of the PY32F002 (those don't have the boot0 pin available)
I don't have any dedicated programming device at the moment, and up to this point I have only programmed dev-boards that can be flashed via USB port (like arduino nano with it's onboard CH340 usb-to-serial chip and similar)
Which programming device should I get to program SOP8/SOP16 versions of those chips?
I've seen JLink mentioned, and on the first glance those cost 1000 euro or more.
For example, STM32 chips seem to have cheap ST-Link V2 programmers available on ali and else where.
Similarly, WCH CH32V003 chips have cheap WCH-LinkE on ali.
Are there any affordable beginner options to program SOP8/SOP16 versions of these chips?
I saw that. Unfortunately, it's windows-only and doesn't provide the source, so it's not useful for me.
probe-rs does support the py32, though, so that's my go-to OCD
Thank you for advice!
Sop8 version has following pins:
1. VCC
2. PA4/PA10
3. PA3
4. PA14-SWC/PB3
5. PA13-SWD
6. PA2/PF2-NRST
7. PA1
8. GND
The pins that have to be connected when programming are (5) SWC (6) SWD and (1) VCC (2) GND, correct?
Can SWC/SWD pins be shared and reused for different purposes?
And if the pins can be reused/shared, how does the device know that is being flashed instead of being used as in normal operation?
Is there some sort of special startup sequence?
I generally reserve SWC and SWD for debugging only, and don't re-assign them. It's easy enough to use a TSSOP-20 or something with more pins if IO is that tight.
If you do want to re-assign them, it'd be wise to implement a boot delay in your code before doing so, so that you have a moment when you can flash it on bootup before the SWD interface becomes unavailable to you. Otherwise, you'd essentially get a one-time-programmable device (which is not necessarily a problem if you're a manufacturer, but is less than ideal for a hobbyist)
Also be aware that in some cases, the 'multiplexing' is just the way the die is bonded - i.e. they just short together the points to the same pin. So you might have trouble if you try to drive PA14 high and PB3 low at the same time. Not sure if this is the case with the py32 or not, you'd need to carefully examine the datasheet (or experiment) and make your own inferences.
If you reasign swd pins, then you must also connect nRST to enter programming mode, otherwise it'll be impossible.
I was able to run puya OpenOCD under CubeIDE.
- Replace bin/dlls in plugins\com.st.stm32cube.ide.mcu.externaltools.openocd.win32_xxx\tools\bin.
- Add script files to plugins\com.st.stm32cube.ide.mcu.debug.openocd_xxx\resources\openocd\st_scripts
But the IDE had other genuine checks I missed out in the previous patch, so it didn't work.
I analyzed com.st.stm32cube.ide.mcu.debug.launch_xxx.jar and found a better aproach to entirely bypasss the checks.
Now it works great either with Jlink or openocd+stlink.
Updated the 1.12.1 patch, also added the patching guide so anyone can do it for any IDE version.
It's all very confusing, for example PY32F002BW15S sop16 B version of the chip doesn't even seem to have NRST pin. (or is it a bug in the datasheet?)
How does writing to the flash memory of the device gets started/initiated when connected just to VCC/GND/SWC/SWD pins?
From what I could understand from reading the reference manual is:
1. Once powered on device resets pin functions to their default state
2. Since the SOP14/16 devices don't have a BOOT0 pin, CPU fetches top-of-stack value from 0x0000 00000
and starts executing code from 0x0000 0004 from the main flash memory (20kbytes)
3. Now in code, functions of GPIO pins will be set via Alternate Function Registers called GPIOx_AFRH and GPIOx_AFRL and accessed via peripheral registers (those are memory mapped in linear address space (32bit, 4gb))
For PF2-NRST pin specifically, their function is set through so called "Option bytes"
Option bytes (128bytes, one page of flash memory) are stored in flash memory.
Is that correct?
It's all very confusing, for example PY32F002BW15S sop16 B version of the chip doesn't even seem to have NRST pin. (or is it a bug in the datasheet?)
PIN13 is NRST, multiplexed with PC0, PA7
EN datasheet v0.3 is not the latest, please refer to the pin map in
CN datasheet v0.9, page 17
How does writing to the flash memory of the device gets started/initiated when connected just to VCC/GND/SWC/SWD pins?
SWD transfer doesn't need a reset
Hi , there is something maybe new at aliexpress : TW32F003 https://fr.aliexpress.com/item/1005006207267714.html
it is showed as a CH32V003 equivalent , but it is ARM , so rather a new PY32 ?
some thoughts ?
Don't ....
I think i have 3 of these , but : Absolutely no DOC is to be found ....
/Bingo