wagiminator / MCU-Flash-Tools

Simple ISP Flash Tools for various Microcontrollers
MIT License
45 stars 6 forks source link

py32f0 series? #1

Open NoNamedCat opened 9 months ago

NoNamedCat commented 9 months ago

Hello first of all TKS a lot for this repo. I'm wondering if it would be a pain to add PY32F0 series tool (Cortex m0+) with SWD interface? I want a small tool to program this MCU to add this tool to the arduino IDE.

I'm trying to do this using the hidapi an libusb libraries on linux and my knowledge is not enough.

My cpp program scan the usb devices based on one txt file that contains all the vid/pid values, then connect to one of them and then it start reading and writing to one endpoint. But i dont know how to talk to the SWD HID device...

Here is the TXT file for the CMSIS/DAP device list:

# This file is a list of VID / PID of the devices that the py32flasher will search
# to flash the PY32F Microcontrollers.
# You can find the VID / PID values using in linux the command "lsusb" on the terminal
# In Windows you can find this values following the next steps:
# * Go to Control Panel > Device Manager and find your USB device
# * Double click the device or right click and select Properties.
# * Go to the Details tab and select Hardware ID to view its PID and VID.
#
# You should add the VID and PID following the next examples: 

# STM32 nucleo boards, with onboard st/linkv2-1
0483 374b
0483 3752

# STM32 discovery boards, with onboard st/linkv2
0483 3748

# STLINK-V3 boards (standalone and embedded) in usbloader mode and standard (debug) mode
0483 374d
0483 374e
0483 374f
0483 3753
0483 3754
0483 3755
0483 3757

# Essemi ESLinkII
30cc 9527

# WCH-Link
1a86 8011

# # WCH-Link clone
2a86 8011

# Wagiminator picoDAP
1209 C55D

# CMSIS-DAP Cat Programmer
4348 55E0

# Cypress KitProg1/KitProg2 
04b4 f138
04b4 f148

# Cypress MiniProg4
04b4 f151
04b4 f152

# Cypress KitProg3
04b4 f154
04b4 f155
04b4 f166

# DAPLink
0d28 0204

# Keil ULINKplus
c251 2750

# NXP LPC-LinkII
1fc9 0090

# NXP MCU-Link
1fc9 0143

# Microchip EDBG CMSIS-DAP
03eb 2111

# Microchip JTAGICE3 CMSIS-DAP
03eb 2140

# Microchip Atmel-ICE CMSIS-DAP
03eb 2141

# Microchip Power Debugger CMSIS-DAP
03eb 2144

# Microchip mEDBG CMSIS-DAP
03eb 2145

# Microchip EDBGC CMSIS-DAP
03eb 216c

# Microchip nEDBG CMSIS-DAP
03eb 2175

# RadioOperator STM32F103C8T6_CMSIS-DAP_SWO probe firmware
# Note, this firmware uses STMicroelectronic's USB VID.
0483 572a
wagiminator commented 9 months ago

Hi, I definitely plan to experiment a bit with the PY32F002. However, this may take some time as it is not a priority at the moment. What helped me a lot when developing the programming software was the use of a USB sniffer (https://wiki.wireshark.org/CaptureSetup/USB). This allows you to read what packets other programming software sends via the endpoints. By the way, the SWD programming devices should also be recognizable via their product descriptor string, as this should contain "CMSIS-DAP".

wagiminator commented 9 months ago

Hi, I wrote a tool for flashing PY32F0xx microcontrollers using a USB-to-serial converter. This is also easier to integrate on a board and can also be used as a serial interface. Maybe I'll do the story with the SWD programmer later.

NoNamedCat commented 9 months ago

Tks a lot!!!!