-
Notifications
You must be signed in to change notification settings - Fork 134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JTAG programming ESP32-C3 devKit M (OCD-384) #165
Comments
Could you please run |
Thanks for your help! I tried running espefuse summary, which outputs a lot of information I don't really understand... I get the following Config:
I also have a part of the output which says something about JTAG:
What's the part I need to check ? |
BTW, i checked the chip revision using:
And i got the following output
Isn't it strange that it says the chip is unknown ? |
This should be solved by espressif/esptool@dbbf83f, but ESP-IDF still uses a slightly older version of esptool, so the fix hasn't propagated there yet. ESP32-C3, starting from revision 3, supports a built-in USB to SERIAL/JTAG adapter. It should be useable both for console (flash/monitor) and OpenOCD out of the box, provided you connect a USB cable to specific pins, described here. On Windows, there is an extra step to install the driver to make JTAG work. If you want to use JTAG via GPIOs using an external adapter such as J-link, there are two options. One option is to burn The other option is to burn |
Thank you @igrr for these very clear explanations! I am now able to connect to my esp32c3 board using my JLINK. I tried running
but I have now another issue:
Something is probably wrong with my config, I'm trying to figure this out. I'll let you know when I'm able to flash my ESP32-C3-DevKitM-1 using JTAG |
I'm sorry i missed the fact you are trying to flash an ESP32-C3 over JTAG, not debug it! This feature was implemented in OpenOCD recently (e950ede) but is not part of a release yet. We'll make a new release soon; in the meantime you can use these binaries provided by @gerekon in another issue: #162 (comment). |
Oh that's why! I will wait for the new release then. Thank you for your help! Closing the issue now |
Now that openocd-esp32 supports JTAG programming on ESP32-C3, I successfully flashed my ESP32-C3-DevKitM-1 after burning the JTAG_SEL_ENABLE efuse. The thing is, I also wanted to flash ESP32-C3 modules placed on custom PCBs. However, I cannot use USB to burn the JTAG_SEL_ENABLE efuse of these modules, therefore I cannot use my ESP32-C3... @igrr what's the best way to proceed to successfully use JTAG to flash my modules without using USB ? |
@Wasabinary I think you do not need USB to program efuses. It is done over UART0 (@igrr @Spritetm please correct me). So you need to have TXD/RXD connected to your PC in some way (e.g. via external USB-UART bridge). Having that you can program, efuses to use ESP32-C3 JTAG pads to connect external JTAG adapter. So you need TXD, RXD and JTAG pins to be accessible on your custom PCB for external connection. |
To clear it a bit... |
Almost correct. It's done using either ROM or USB serial/JTAG; the ROM and stub understand both. But yeah, you need to zap the efuse either way before JTAG-over-GPIOs work. |
Yes. In order to do it fully automatic, you'll also need to connect to EN and IO0 to get into bootloader mode, however. |
@Spritetm I'm using ESP32-C3, don't you mean EN and IO9 ? It seems like IO9 is the one connected to the boot button on ESP32-C3-DevKitM-1 |
Egh, I keep doing that wrong, mostly because I only use USB nowadays. Yes, it's IO9 on the C3. |
Got it.
It starts connecting, tries detecting the chip type... and fails:
I think I miss something, but it looks like I'm close... Please save me @Spritetm! |
Not sure what happens there... try adding --no-stub in there perhaps? |
Same behavior with --no-stub option... |
Is there any hardware modification to perform on the ESP32-C3-DevKitM-1 before doing this ? |
Ah, that might possibly be the problem: the DevkitM-1 has an USB-serial converter connected to TxD/RxD that interfere. If you remove R21 and R22 and it works, that's your issue. |
Nice! Seems like it's going better without R21 and R22. I also changed
to
Though, espefuse is still not able to recognize the chip type:
So I also added --chip option:
Now it finally gives me the expected output with the list of the efuses! 👍 👍 👍 Thank you @Spritetm. One question remains though: why is the program not able to determine the chip type ? |
Just speculating, but I think I recall something minor changed in the C3 ROM between ECO2 and ECO3... the esptool.py version you have may be new enough to recognize ECO2 but not new enough to recognize ECO3. |
Ok, so nothing too worrying right now. Thanks a lot, I will try with the module itself now! |
Well, works like a charm on the module itself. Using an FTDI cable and the reference design given in the ESP32-C3-MINI-1 datasheet, I was able to burn the efuse JTAG_SEL_ENABLE, and the next step is to use JTAG to program the module. |
So, why is there an FDTI USB<-> serial chip on the ESP32-C3-DevKitM-1 board? |
Hi @andrew-elder, indeed ESP32-C3 DevKitM-1 currently comes with a CP2102 USB-UART bridge. The design of this development board was done when ESP32-C3 support in ESP-IDF was in early stages, and we didn't yet support the "serial" part of USB_SERIAL_JTAG well enough to fully rely on it. Since then, support for this feature in ESP-IDF has improved. Given that, I think Espressif will eventually remove the CP2102 from the future version of DevKitM board. With the current generation of DevKitM-1 boards you can use USB_SERIAL_JTAG either through a USB breakout cable (such as this one) or through the built-in USB connector by swapping resistors R1 and R4 into positions of R2 and R3. The latter will disconnect CP2102 from USB and connect ESP32-C3's D+ and D- pins instead. |
@igrr - thanks for the super fast response! I'll be trying your resistor swapping soon here. After the resistors are "moved", would I expect to see two USB derived devices in Linux? I currently have just the /dev/ttyACM0 one. |
You should see one /dev/tty(something) device for the "serial" port. I'm not sure if on Linux it's going to be called ttyACM or not (I'm using macOS). The "jtag" part of the USB_SERIAL_JTAG peripheral doesn't create a /dev/tty* device file, but it will be available to OpenOCD via libusb, should you decide to run OpenOCD. |
At deployment time, if I set the efuse to disable JTAG, will the serial interface still work over OpenOCD, or are they intertwined in such a way that the serial output will be disabled as well. |
I get
when I try to flash. I'm unsure of the next step(s). |
Hi,
After successfully flashing my code using a JLINK and JTAG pins( TDO, TDI, TCK and TMS) of an ESP32-S2-SAOLA-1 board, I tried to do the same with an ESP32-C3-DevKitM-1, following the instruction given here
Unfortunately, I am not able to use JTAG with this ESP32-C3 board, even after downloading the newest version of openocd-esp32 and checking my connections multiple times.
I keep receiving an error when launching the command
Error: JTAG scan chain interrogation failed: all zeroes
Error: Check JTAG interface, timings, target power, etc.
Error: Trying to use configured scan chain anyway...
Error: esp32c3.cpu: IR capture error; saw 0x00 not 0x01
Warn : Bypassing JTAG setup events due to errors
I tried changing the adapter frequency in the jlink.cfg file, but it does not change anything.
Any idea?
The text was updated successfully, but these errors were encountered: