Skip to content

Conversation

@EasyDevKits
Copy link
Contributor

Description

I found that in the openocd-esp32 repositiory is no support for CH347 based JTAG adapters. A WCH CH347 chip in mode 3 has one UART and one JTAG interface. Like an FTDI FT2232 chip, you can use the CH347 chip for UART and JTAG. With this change I add support for CH347 based JTAG adapters. I also add configuration files for the upcoming EasyDevKits JTAG adapters.

  • ch347 driver source code is adopted from https://github.com/WCHSoftGroup/ch347
  • bug fixing done in ch347 driver the get it working
  • unified all function names in ch347 driver to make it look like existing driver code
  • added a parameter in jtag_libusb_open for delivering the device description for which this function should search and adjusted all callers of this function
  • added the new ch347 driver in the build files.

Maybe a documentation update is needed to state that now also CH347 based adapters are supported.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality not to work as expected)
  • This change requires a documentation update

User Impact

Now you can JTAG debug ESP32 chips with CH347 base JTAG adapters.

Performance Impact

I changed the timeout in esp_xtensa_reset_reason_read in file src/target/espressif/esp_xtensa.c from 100ms to 200ms because it was not working for the CH347 with 100ms timeout. Other parts are unchanged. Only the new driver added.

How Has This Been Tested?

  • MuseLab CH347 JTAG adapter running on Windows 11
  • MuseLab CH347 JTAG adapter running on Linux Ubuntu 23.04
  • EasyDevKits ESP32-WROVER-E WCH JTAG DevKit Version 0.1 running on Windows 11
  • EasyDevKits ESP32-WROVER-E WCH JTAG DevKit Version 0.1 running on Linux Ubuntu 23.04

Hardware Configuration:

  • Development Kit: none
  • Module or Chip Used: ESP32-WROVER-E N16R8
  • Debug Adapter: MuseLab CH347 JTAG adapter / EasyDevKits ESP32-WROVER-E WCH JTAG DevKit Version 0.1

Software Configuration:

  • OpenOCD version: latest commit at time of writing from openocd_esp32
  • Branch: main
  • ESP_IDF version: 5.1
  • Operating System: Windows 11 / Linux Ubuntu 23.04

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings

default and others added 28 commits September 30, 2023 15:38
device description, activity LED added
jtag_libusb_open enhanced for checking the device description
The LED output can alsob e acrive low
https://github.com/coflery/openocd
 - Constants for usb timeouts added
- Read the firmware version on open
- ch347_reset: do nothing if trst/srst are unset (seen in ftdi driver)
- CH347_MoveState: Don't skip the move to TAP_RESET
- Added CH347_WriteReadBitwise -read/write for older chip versions
- Added CH347_ScanDataToFields and fixed a bug for fields without data
- for scan fields without data (one bit field) for skipping targets
the bits need also be counted
* esp/ci: Makes OpenOCD tool name in lower case in IDF branch name

* esp/ci: update openocd-ci-env and remove install packages

---------

Co-authored-by: Alexey Gerenkov <alexey@espressif.com>
Co-authored-by: Erhan Kurubas <erhan.kurubas@espressif.com>
@github-actions github-actions bot changed the title Add general support for CH347 based interfaces and configurations for EasyDevKits interfaces Add general support for CH347 based interfaces and configurations for EasyDevKits interfaces (OCD-839) Oct 12, 2023
@erhankur
Copy link
Collaborator

@EasyDevKits Thank you for creating the PR and putting in the hard work to make this driver compatible with our chips. Since the PR is not directly related to our chips, unfortunately, this isn't the right approach to merge it into our fork. Please consider creating a patch for the official mainline first. No worries, we will be cherry-picking that commit once it is merged.

@erhankur erhankur closed this Oct 13, 2023
@erhankur
Copy link
Collaborator

And I suggest to divide the patches into 2 parts.
1 - Just for CH347 driver -->to the mainline
2 - Once it is merged, Espressif fixes to make it compatible with CH347 --> to our fork. Because we haven't upstreamed all features yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants