m3y54m / cjmcu-ft232hq-programmer

FT232H-based JTAG, SWD, and AVR-ISP Programmer (Supported by OpenOCD and AVRDUDE)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CJMCU-232H-based JTAG, SWD, and AVR Programmer

This is a very popular module based on the FT232H chip made by CJMCU. You can use this module as a high-speed programmer for your embedded projects. I discovered that this module can be used as a JTAG and SWD programmer for ESP32 and STM32 microcontrollers. It can also be used as an ISP programmer for AVR microcontrollers.

This module might be used to program other microcontrollers, but no information about them has been published yet.

CJMCU-232H

Any similar module/board based on FT233H/FT2232H which exposes AD0, AD1, AD1, and AD3 pins can be used for this purpose.

Note that voltage level of all I/Os is 3.3V but they are 5V-tolerant

OpenOCD (for JTAG & SWD)

Install WinUSB driver for FT232H using Zadig:

image

For SWD connection use -f interface/ftdi/ft232h-module-swd.cfg, and for JTAG connection use -f interface/ftdi/um232h.cfg -c "transport select jtag".

Example: Read STM32f103C8 (Blue-Pill board) flash:

For STM32f103C8 with 64KB of flash. Target is board/stm32f103c8_blue_pill.cfg. Size to read is 0x10000. Read firmware from MCU and store it in a file named firmware.bin on your computer.

openocd -f interface/ftdi/ft232h-module-swd.cfg -f board/stm32f103c8_blue_pill.cfg -c init -c "reset halt" -c "flash read_bank 0 firmware.bin 0 0x10000" -c "reset" -c shutdown

Example: Write STM32f103C8 (Blue-Pill board) flash:

For STM32f103C8 with 64KB of flash. Target is board/stm32f103c8_blue_pill.cfg. Write firmware from the file firmware.bin to the flash memory of the MCU.

openocd -f interface/ftdi/ft232h-module-swd.cfg -f board/stm32f103c8_blue_pill.cfg  -c init -c "reset halt" -c "flash write_image erase firmware.bin 0x08000000" -c "reset" -c shutdown

Using with PlatformIO:

[env:bluepill_f103c8_128k]
platform = ststm32
board = bluepill_f103c8_128k
framework = arduino
; Upload options for FT232H USB-JTAG adapter in SWD Mode
upload_protocol = custom
upload_command = ${platformio.packages_dir}/tool-openocd/bin/openocd -s ${platformio.packages_dir}/tool-openocd/scripts -f interface/ftdi/ft232h-module-swd.cfg -f board/stm32f103c8_blue_pill.cfg -c "init" -c "reset halt" -c "flash write_image erase {$SOURCE} 0x08000000" -c "reset" -c "shutdown"
; Debug options for FT232H USB-JTAG adapter in SWD Mode
debug_tool = custom
debug_server =
  ${platformio.packages_dir}/tool-openocd/bin/openocd
  -s
  ${platformio.packages_dir}/tool-openocd/scripts
  -f
  interface/ftdi/ft232h-module-swd.cfg
  -f
  board/stm32f103c8_blue_pill.cfg

AVRDUDE / AVRDUDESS (for AVR ISP)

Install default driver from FTDI. If you have installed WinUSB or libusb driver for FT232H, you should revert it to defalut driver:

image

image

image

image

image

image

Resources

About

FT232H-based JTAG, SWD, and AVR-ISP Programmer (Supported by OpenOCD and AVRDUDE)

License:MIT License