ESP32 : Preparation step 1, Jtag debugger, FTDI 2232
Arduino are fun, but they have 2 major problems :
And then the usual
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: Debug controller 0 was reset.
Info : esp32: Core 0 was reset.
Info : esp32: Debug controller 1 was reset.
Info : esp32: Core 1 was reset.
Info : cpu0: Detected debug stubs @ 3ffc0c84
Info : Listening on port 3333 for gdb connections
- All is in the IDE, and the arduino IDE is good for beginners, not for "normal" use
- Lack of debugging capabilities
The arduino-cmake-stm32 deals with the first issue, for both Arm cores and Atmel cores.
The stm32 has SWD capabilities, so at least when using stm32, you can debug (plus they are much more powerful than the Atmel Arduino boards)
Stm32 + arduino-cmake-stm32+ your favorite IDE+ ST LINK/Black Magic = :)
Now let's have a look a the ESP32 from espressif.
They are a bit more expensive, but they contain a LOT of hardware features (ADC/DAC/Bluetooth/Wifi/....)
They do support the arduino API, back to square 1.
First thing first, debugging.
The ESP32s do not support SWD interface, but they do support the jtag interface.
You can uses a FTTDI 2232 H board , available for ~ 10$ on ebay to do jtag/usb conversion.
I bought that one a few months back : Ebay link (it is not sponsored, buy wherever you want)
Hardware setup
I've used the following wiring scheme :
Signal | Wire | FT PIN | ESP32 Pin
- TCK: WHITE : AD0 : IO13
- TDI : GREY : AD1 : IO12
- TMS : BLUE : AD3 : IO14
- TDO : PINK : AD2 : IO15
So let's remove the usb connector and solder instead an old USB cable
Additionally, 3D print a small enclosure to put everything in
There is some spare wires to use the 2nd uart later on
Software Setup -1 : Arduino
We'll use the pure arduino setup for now, and switch to arduino-cmake-stm32 later on
Add "https://dl.espressif.com/dl/package_esp32_index.json" to preferences->Additional Board Manager
You can now select Esp32 dev as device. Let's upload a random example and check it works.
It does.
Software Setup -2 : Open OCD
Now we have to install the espressif version of open ocd that can be downloaded from here :
https://github.com/espressif/openocd-esp32
bash bootstrap
./configure --prefix=/usr/local
make
It does not compile, you need to remove "-Werror" from Makefile
make install
Rename /usr/local/bin/openocd to /usr/local/bin/openocd-esp32
Put the following file in /usr/local/share/openocd/scripts/interface/ftdo/esp32_2232.cfg (i copied it from here )
interface ftdi
ftdi_vid_pid 0x0403 0x6010
ftdi_channel 0
ftdi_layout_init 0x0038 0x003b
transport select jtag
adapter_khz 5000
ftdi_vid_pid 0x0403 0x6010
ftdi_channel 0
ftdi_layout_init 0x0038 0x003b
transport select jtag
adapter_khz 5000
and test. 5000 is 5MHz jtag speed, lower it if you have too much troubles.
/usr/local/bin/openocd_esp32 -f interface/ftdi/esp32_2232.cfg -f board/esp-wroom-32.cfg
And it seems to work
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: Debug controller 0 was reset.
Info : esp32: Core 0 was reset.
Info : esp32: Debug controller 1 was reset.
Info : esp32: Core 1 was reset.
Info : cpu0: Detected debug stubs @ 3ffc0c84
Info : Listening on port 3333 for gdb connections
Next is to update arduino-cmake-stm32 to be able to use a nicer development environment.
Comments
Post a Comment