Debugging a WROOM-32 with FT232R

bibble235
Posts: 13
Joined: Mon May 28, 2018 11:23 pm

Debugging a WROOM-32 with FT232R

Postby bibble235 » Thu May 20, 2021 6:33 am

Hi

My understanding is that my WROOM-32 does not have JTAG onboard (10c4:ea60) so I need an adaptor. I already owned a RT232 0403:6001 adaptor lying around so though I would give it ago.

I downloaded the openocd https://github.com/espressif/esp-idf built it and a ran it with.

Code: Select all

./openocd -d  -s ../tcl  -f   ../tcl/interface/ft232r.cfg -f  ../tcl/board/esp-wroom-32.cfg
[/code

But the /dev/ttyUSB0 (UART board) disconnects at start up. If I telnet to 3333 it also disconnects.

Assume I am very stupid and feel free to ask if I have turned it on.

The echo examples work fine and have run with root so I think the UART thing is working.

I am running on UBUNTU 21.04. Reasonable with UNIX but maybe will struggle with the hardware side.

Thanks folks.
Iain

ESP_Sprite
Posts: 9711
Joined: Thu Nov 26, 2015 4:08 am

Re: Debugging a WROOM-32 with FT232R

Postby ESP_Sprite » Fri May 21, 2021 4:28 am

The FT232 only has a single port. You can either use the FT232R as an actual USB-to-serial device (in which case you'd use ttyUSB0) or as a JTAG device (in case ttyUSB0 disappears as openocd takes over the device).

bibble235
Posts: 13
Joined: Mon May 28, 2018 11:23 pm

Re: Debugging a WROOM-32 with FT232R

Postby bibble235 » Fri May 21, 2021 5:26 am

Sorry very new to some of this.

Are you saying that the device will disappear from the OS USB hardware list but still be communicating via the ESP32 on port 3333? I guess what I am asking is, Is it possible to debug using gdb and openocd with a wroom32 and a FT232 Serial (UART) (0403:6001) if I do not want to use the FT232 for serial. e.g. the hello_word in the examples.

Thanks,

ESP_Sprite
Posts: 9711
Joined: Thu Nov 26, 2015 4:08 am

Re: Debugging a WROOM-32 with FT232R

Postby ESP_Sprite » Sat May 22, 2021 3:25 am

Yes, and in that case disappearing of /dev/ttyUSB0 is expected.

bibble235
Posts: 13
Joined: Mon May 28, 2018 11:23 pm

Re: Debugging a WROOM-32 with FT232R

Postby bibble235 » Mon May 24, 2021 3:46 pm

Still having not joy getting the debugging going. The set up is

FT232R (0403:6001) and a ESP-WROOM-32 with (10c4:ea60 Silicon Labs CP210x UART Bridge)

I am using ubuntu 21.04 and openocd v0.10.0-esp32-20210401

Openocd Command I am running is
./openocd -f ../share/openocd/scripts/interface/ft232r.cfg -f ../share/openocd/scripts/board/esp-wroom-32.cfg

GDB is
xtensa-esp32-elf-gdb -x gdbinit build/hello-world.elf

openocd output
-------------------
WARNING: boards/esp-wroom-32.cfg is deprecated, and may be removed in a future release.
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : clock speed 1000 kHz
Error: JTAG scan chain interrogation failed: all ones
Error: Check JTAG interface, timings, target power, etc.
Error: Trying to use configured scan chain anyway...
Error: esp32.cpu0: IR capture error; saw 0x1f not 0x01
Warn : Bypassing JTAG setup events due to errors
Info : Listening on port 3333 for gdb connections
Info : accepting 'gdb' connection on tcp/3333
Warn : No symbols for FreeRTOS!
Error: Target not examined yet
Error executing event gdb-attach on target esp32.cpu0:

Info : New GDB Connection: 1, Target esp32.cpu0, state: running
Error: Failed to find HALTED core!
Error: Target not examined yet
Error: JTAG scan chain interrogation failed: all ones
Error: Check JTAG interface, timings, target power, etc.
Error: Trying to use configured scan chain anyway...
Error: esp32.cpu0: IR capture error; saw 0x1f not 0x01
Warn : Bypassing JTAG setup events due to errors
Info : esp32.cpu0: Debug controller was reset.
Info : esp32.cpu0: Core was reset.
Error: Couldn't halt target before SoC reset

Error: Target not examined yet
Error: Target not examined yet
Error: Target not examined yet

gdb output
-------------
GNU gdb (crosstool-NG esp-2020r3) 8.1.0.20180627-git
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=x86_64-build_pc-linux-gnu --target=xtensa-esp32-elf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from build/hello-world.elf...done.
0x00000000 in ?? ()
JTAG scan chain interrogation failed: all ones
Check JTAG interface, timings, target power, etc.
Trying to use configured scan chain anyway...
esp32.cpu0: IR capture error; saw 0x1f not 0x01
Bypassing JTAG setup events due to errors
esp32.cpu0: Debug controller was reset.
esp32.cpu0: Core was reset.
Couldn't halt target before SoC reset

Hardware assisted breakpoint 1 at 0x400d2be4: file ../main/hello_world_main.c, line 17.
Target not examined yet

I have tested the connection to the FT232R separately by running it on the PI with console loigin and on the ESP32 with the echo example.

I am currently running the hello_world example but with no joy. I am a novice so please ask if it is plugged in. I want help to don't mind sill questions.

ESP_Sprite
Posts: 9711
Joined: Thu Nov 26, 2015 4:08 am

Re: Debugging a WROOM-32 with FT232R

Postby ESP_Sprite » Tue May 25, 2021 12:28 am

How have you connected the FT232R? JTAG needs different connections (MTDI, MTCK, MTMS, MTDO) than serial (RxD, TxD).

bibble235
Posts: 13
Joined: Mon May 28, 2018 11:23 pm

Re: Debugging a WROOM-32 with FT232R

Postby bibble235 » Tue May 25, 2021 3:04 am

I have the following connections

FT232R ESP32
GND ->GND
CTS ->TMS (GPIO14)
5V ->Not connected
TXD ->TCK(GPIO13)
RXD ->TDI(GPIO12)

This one I was not sure about
DTR ->TDO(GPIO15) (I also tried the RI)

Here is what mine looks like though could be make by anyone of course
https://www.amazon.com/sunfounder-ardui ... b00gd6ge6o

ESP_Sprite
Posts: 9711
Joined: Thu Nov 26, 2015 4:08 am

Re: Debugging a WROOM-32 with FT232R

Postby ESP_Sprite » Tue May 25, 2021 7:55 am

According to here, the default pinout has RTS as TDO, perhaps you should try that? (Your other pins do seem fine.)

bibble235
Posts: 13
Joined: Mon May 28, 2018 11:23 pm

Re: Debugging a WROOM-32 with FT232R

Postby bibble235 » Tue May 25, 2021 10:51 am

Yes found that and this
https://arduino.stackexchange.com/quest ... -connector
I assumed from this that RTS is pin 5 or bottom left on the yellow connector (see I am very new to this) and it did not work.

bibble235
Posts: 13
Joined: Mon May 28, 2018 11:23 pm

Re: Debugging a WROOM-32 with FT232R

Postby bibble235 » Tue May 25, 2021 11:26 am

Progress but not working.

Found this site.
https://gojimmypi.blogspot.com/2019/02/ulx3s-day-1.html

Like the cowboy I am. Set mine up to be like this in the config. I am struggling to understand where the DTR is on the ESP32. The interface wont run without specifying it but assuming not used like the comment

interface ft232r
ft232r_tck_num DSR
ft232r_tms_num DCD
ft232r_tdi_num RI
ft232r_tdo_num CTS
# trst/srst are not used but must have different values than above
ft232r_trst_num RTS
ft232r_srst_num DTR
adapter_khz 1000

And... I am assuming we are getting further

WARNING: boards/esp-wroom-32.cfg is deprecated, and may be removed in a future release.
Warn : Transport "jtag" was already selected
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : clock speed 1000 kHz
Info : JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : esp32.cpu0: Debug controller was reset.
Info : esp32.cpu0: Core was reset.
Info : esp32.cpu1: Debug controller was reset.
Info : esp32.cpu1: Core was reset.
Info : Listening on port 3333 for gdb connections
Info : accepting 'gdb' connection on tcp/3333
Warn : No symbols for FreeRTOS!
Info : esp32.cpu0: Target halted, PC=0x400E264A, debug_reason=00000000
Info : Set GDB target to 'esp32.cpu0'
Info : esp32.cpu0: Debug controller was reset.
Info : esp32.cpu0: Core was reset.
Error: timed out while waiting for target halted / 4 - 2
Info : esp32.cpu0: Target halted, PC=0x400E264A, debug_reason=00000000
Info : esp32.cpu1: Debug controller was reset.
Info : esp32.cpu1: Core was reset.
Error: xtensa_wait_algorithm: not halted 0, pc 0x400e264a, ps 0x60920
Error: Failed to wait algorithm (-302)!
Error: Algorithm run failed (-302)!

On the gdb side
Type "apropos word" to search for commands related to "word"...
Reading symbols from build/blink.elf...done.
Ignoring packet error, continuing...
warning: unrecognized item "timeout" in "qSupported" response
Ignoring packet error, continuing...
gdbinit:1: Error in sourced command file:
Remote replied unexpectedly to 'vMustReplyEmpty': timeout

Will carry on. Do I get points for sticking with it. My C++ is miles better!

Who is online

Users browsing this forum: Google [Bot] and 55 guests