My exepriences with the esp32s2 kaluga dev board
I was able to order one of 10 kaluga boards from Digikey on the 13/5-2020. I could not find much documentation about what I had actually ordered, however I did find the schematics located here. https://github.com/espressif/esp-dev-kits/tree/master/esp32-s2-kaluga-1/docs It seems like we have an FT2232HL on board. Also I expect the LCD to be in the box. Actually it has arrived 15/5 and it contained the ESP32-S2-WROVER module. The touch board, and camera was also included. Nice.
1. Pay attention that Module may use OSPI mode. Thus, 33-37 can not be used as other function.
2. If psram was soldered, GPIO26 will be used as CS, which can't be used as other functions
I assume these instructions will help. https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/api-guides/jtag-debugging/index.html I would assume there is support in for the https://github.com/espressif/openocd-esp32 . It does not seem like that so we, have to create the configuration file ourselfs.
ESP32-S2 Pin |
JTAG Signal |
|
---|---|---|
1 |
CHIP_PU |
TRST_N |
2 |
MTDO / GPIO40 |
TDO |
3 |
MTDI / GPIO41 |
TDI |
4 |
MTCK / GPIO39 |
TCK |
5 |
MTMS / GPIO42 |
TMS |
6 |
GND |
GND |
USB to serial drivers found.
[ 401.064721] usbcore: registered new interface driver ftdi_sio
[ 401.064738] usbserial: USB Serial support registered for FTDI USB Serial Device
[ 401.065190] ftdi_sio 2-2.3:1.0: FTDI USB Serial Device converter detected
[ 401.065256] usb 2-2.3: Detected FT2232H
[ 401.067172] usb 2-2.3: FTDI USB Serial Device converter now attached to ttyUSB0
[ 401.067222] ftdi_sio 2-2.3:1.1: FTDI USB Serial Device converter detected
[ 401.067249] usb 2-2.3: Detected FT2232H
[ 401.067871] usb 2-2.3: FTDI USB Serial Device converter now attached to ttyUSB1
screen /dev/ttyUSB1 115200
ESP-ROM:esp32s2-rc4-20191025
Build:Oct 25 2019
rst:0x1 (POWERON),boot:0x8 (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3ffe8100,len:0x4
load:0x3ffe8104,len:0x1974
load:0x40050000,len:0x1898
load:0x40054000,len:0x210c
entry 0x40050314
I (46) boot: ESP-IDF v4.2-dev-1035-ge07eb8eca-dirty 2nd stage bootloader
I (46) boot: compile time 21:05:26
I (46) boot: chip revision: 0
I (50) qio_mode: Enabling default flash chip QIO
I (55) boot.esp32s2: SPI Speed : 80MHz
I (60) boot.esp32s2: SPI Mode : QIO
I (64) boot.esp32s2: SPI Flash Size : 4MB
I (69) boot: Enabling RNG early entropy source...
I (75) boot: Partition Table:
I (78) boot: ## Label Usage Type ST Offset Length
I (85) boot: 0 nvs WiFi data 01 02 00009000 00006000
I (93) boot: 1 phy_init RF data 01 01 0000f000 00001000
I (100) boot: 2 factory factory app 00 00 00010000 00100000
I (108) boot: End of partition table
I (112) esp_image: segment 0: paddr=0x00010020 vaddr=0x3f000020 size=0x1b43c (111676) map
I (141) esp_image: segment 1: paddr=0x0002b464 vaddr=0x3ffc01e0 size=0x02050 ( 8272) load
I (143) esp_image: segment 2: paddr=0x0002d4bc vaddr=0x40024000 size=0x00404 ( 1028) load
I (148) esp_image: segment 3: paddr=0x0002d8c8 vaddr=0x40024404 size=0x02750 ( 10064) load
I (159) esp_image: segment 4: paddr=0x00030020 vaddr=0x40080020 size=0x308a8 (198824) map
I (202) esp_image: segment 5: paddr=0x000608d0 vaddr=0x40026b54 size=0x0968c ( 38540) load
I (218) boot: Loaded app from partition at offset 0x10000
I (218) boot: Disabling RNG early entropy source...
I (219) cache: Instruction cache : size 8KB, 4Ways, cache line size 32Byte
I (226) cache: Data cache : size 8KB, 4Ways, cache line size 32Byte
I (233) spiram: Found 16MBit SPI RAM device
I (238) spiram: SPI RAM mode: sram 80m
I (238) spiram: SPI RAM mode: sram 80m
I (242) spiram: PSRAM initialized, cache is in normal (1-core) mode.
I (249) cpu_start: Pro cpu up.
I (253) cpu_start: Application information:
I (258) cpu_start: Project name: esp32-s2-hmi
I (263) cpu_start: App version: 338cedb-dirty
I (269) cpu_start: Compile time: Apr 13 2020 21:05:17
I (275) cpu_start: ELF file SHA256: 1a45da0eedee610c...
I (281) cpu_start: ESP-IDF: v4.2-dev-1035-ge07eb8eca-dirty
I (288) cpu_start: Single core mode
I (511) spiram: SPI SRAM memory test OK
I (511) heap_init: Initializing. RAM available for dynamic allocation:
I (511) heap_init: At 3FFD8BA8 len 00023458 (141 KiB): D/IRAM
I (517) heap_init: At 3FFFC000 len 00003A10 (14 KiB): DRAM
I (524) cpu_start: Pro cpu start user code
I (528) spiram: Adding pool of 2048K of external SPI memory to heap allocator
I (536) spiram: Reserving pool of 32K of internal memory for DMA/internal allocations
I (597) spi_flash: detected chip: generic
I (597) spi_flash: flash io: qio
I (597) cpu_start: Starting scheduler on PRO CPU.
I (601) cam: cam_xclk_pin setup
I (601) cam: cam_buffer_size: 51200, cam_dma_size: 3200, cam_dma_node_cnt: 16, cam_total_cnt: 6
. ~/esp/esp-idf/export.sh
I have prepared a bord config file in the openpcd dir
openocd -f openocd/board/esp32-kaluga-1-3.3v.cfg
Failed log
Open On-Chip Debugger v0.10.0-esp32-20200420 (2020-04-20-16:15)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : ftdi: if you experience problems at higher adapter clocks, try the command "ftdi_tdo_sample_edge falling"
Info : clock speed 20000 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: esp32s2.cpu: IR capture error; saw 0x1f not 0x01
Warn : Bypassing JTAG setup events due to errors
Info : Listening on port 3333 for gdb connections
To get even more debug information, try
openocd -l openocd_log.txt -d3 -f openocd/board/esp32-kaluga-1-3.3v.cfg
This indicates that I have not configured the switches yes. The switches are markd JTAG and must be put to ON position. To attach debugger to openocd, xtensa-esp32s2-elf-gdb build/led.elf -ex 'target remote:3333'
https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/api-guides/jtag-debugging/index.html You can put these in .gdbinit or enterr manually mon reset halt flushregs set remote hardware-watchpoint-limit 2 thb app_main c
idf.py set-target esp32s2
idf.py menuconfig
Set use SPI-flash if you want to use 2MB of RAM
(→ Component config → ESP32S2-specific)
idf.py build
At first I was not able to set breakpoints in app_main
Continuing.
Warning:
Cannot insert breakpoint 1.
Cannot access memory at address 0x40083354
But after some time, it started to work.
(gdb) b app_main
Breakpoint 1 at 0x40083324: file ../main/main.c, line 143.
(gdb) c
Continuing.
Note: automatically using hardware breakpoints for read-only addresses.
esp32s2: Target halted, PC=0x40083324, debug_reason=00000001
esptool.py -p /dev/ttyUSB1 --chip esp32s2 --baud 115200 read_flash 0 0x400000 backup.bin
Why not? If you want to restore the factory installe flash
If you already have installe the bootloader and partion table you can flash only application with
openocd -f openocd/board/esp32-kaluga-1-3.3v.cfg -c "program_esp examples/led/build/led.bin 0x10000 verify exit"
This one was not mounted on my board. https://www.espressif.com/sites/default/files/documentation/esp32-s2-wroom_esp32-s2-wroom-i_datasheet_en.pdf
This was found on my board. 4MB of flash and 2MB of PSRAM. https://www.espressif.com/sites/default/files/documentation/esp32-s2-wrover_esp32-s2-wrover-i_datasheet_en.pdf
Pins are broken out on the board, but an USB connector would have been nice. The ESP32-S2 chip needs to be in bootloader mode for the detection as a DFU device and flashing. I find that 5V is on the opposite side on PIN 19 & 20. Now this is inonvenient. Mhy did they not put an USB OTG connector on the board?
GPIO |
USB |
---|---|
20 |
D- (green) |
19 |
D+ (white) |
GND |
GND (black) |
+5V |
+5V (red) |