0

I'm testing out nanoframework for ESP32 and I've hit a snag.

The ESP32 is mounted on a custom board for an existing product so I need to debug it with an Olimex or a Segger JTAG debugger.

I've been looking for some guide on how to setup this. The only clue I've found so far is a note on docs.nanoframework.net that says

If you want to debug the nanoCLR code on the ESP32 chip you'll need an JTAG debugging adapter. ESP32 WROVER KIT already includes one. For other boards you can use the Olimex ARM-USB-OCD-H JTAG debugging adapter or a Segger JLink. There are preset configurations for these adapters.

No further text about those preset configurations.

I've found lots of guides on how to setup it manually it with the ESP-IDF framework, but I don't see how that can work for nanoframework. Today I'm running an application where I use VisualGDB to setup the environment and debug and that's working great, but once again, no nanoframework.

I'm not used to working with .NET, normally being an embedded C developer, so perhaps I'm missing something so basic that guides don't even mention it.

Anyone know of any good guides?

threviel
  • 1
  • 1

1 Answers1

1

I wasn't sure if you're looking to debug the native code (the CLR and execution engine) or the .NET C# code that you'll deploy on the board... If it's the later then you don't need any JTAG nor any fancy connection, just a plain COM port.

José Simões
  • 606
  • 1
  • 5
  • 12
  • Thank you for your answer. I'm looking at debugging my deployed code. Do you know of any guide on how to do it? I only have serial RX and TX connected, so I can't use reset signals or anything like that. – threviel May 05 '22 at 11:13
  • Also, to clarify, my serial connection is through a regular CP210x USB to UART bridge. – threviel May 05 '22 at 11:48
  • That's perfectly fine and enough. – José Simões May 05 '22 at 13:47
  • Check a tutorial here: https://docs.nanoframework.net/content/getting-started-guides/getting-started-managed.html – José Simões May 05 '22 at 13:48
  • I have some doubts as to whether one really can program the ESP32 through the serial line without it being in bootloader mode, and seeing as I can't easily put it in bootloader mode I haven't even attempted it, but I will try. – threviel May 05 '22 at 13:52
  • I've tried to connect and I get the following result from nanoff: – threviel May 06 '22 at 05:36
  • nanoff --platform esp32 --serialport COM5 --baud 115000 --update --preview .NET nanoFramework Firmware Flasher v2.0.58+a800bf6cc1 Copyright (C) 2019 ... Using COM5 @ 115000 baud to connect to ESP32. Reading details from chip... Error E4000: Error executing esptool command. (esptool.py v3.3 Serial port COM5 Connecting...................................... A fatal error occurred: Failed to connect to Espressif device: No serial data received. For troubleshooting steps visit: https://docs.espressif.com/projects/esptool/en/latest/troubleshooting.html ) – threviel May 06 '22 at 05:37
  • Looking at [link](https://docs.nanoframework.net/content/building/build-esp32.html) it's explicit that the ESP32 needs to be in bootloader mode "download mode" in order to flash it through serial, which makes sense. I have no easy way of doing that, I would need to solder and modify to enable that (GPIO_0 to ground). – threviel May 06 '22 at 05:42
  • With JTAG I have no issues right now using VisualGDB. Is there any way of making Nanoframework work over JTAG? – threviel May 06 '22 at 05:43
  • To debug C# code deployed to a device JTAG can't be used. And for deploying an application from Visual Studio, you don't have to do anything and no bootloader or esptool is involved. – José Simões May 06 '22 at 14:19
  • The command should be nanoff --platform esp32 --serialport COM5 --update. Nothing more nothing less. Also make sure you have the latest Silabs drivers installed. – José Simões May 06 '22 at 14:21
  • nanoff --platform esp32 --serialport COM5 --update .NET nanoFramework Firmware Flasher v2.0.58+a800bf6cc1 Copyright (C) 2019 .NET Foundation and nanoFramework project contributors ******************** EXCEPTION ****************** Exception occurred while trying to open : The maximum baud rate for the device is 1000000. (Parameter 'baudRate') ************************************************* Error E4005: Failed to open specified COM port. – threviel May 09 '22 at 06:21
  • I then updated the SIlabs drivers to 11.1.0.53, from 18/222 and that seemed to help a bit: nanoff --platform esp32 --serialport COM5 --update .NET nanoFramework Firmware Flasher v2.0.58+a800bf6cc1 Copyright (C) 2019 .NET Foundation and nanoFramework project contributors Using COM5 @ 1500000 baud to connect to ESP32. Reading details from chip... Error E4000: Error executing esptool command. (Can't read flash size from device) – threviel May 09 '22 at 06:23
  • And that was with me having put the ESP32 in bootloader mode. I have also tried it when not in bootloader mode: – threviel May 09 '22 at 06:25
  • nanoff --platform esp32 --serialport COM5 --update ... Copyright (C) 2019 .NET Foundation and nanoFramework project contributors Using COM5 @ 1500000 baud to connect to ESP32. Reading details from chip... Error E4000: Error executing esptool command. (esptool.py v3.3 Serial port COM5 Connecting...................................... A fatal error occurred: Failed to connect to Espressif device: No serial data received. For troubleshooting steps visit: https://docs.espressif.com/projects/esptool/en/latest/troubleshooting.html ) – threviel May 09 '22 at 06:25
  • Then I hooked up an Olimex ESP32 POE development board to the same USB cable and everything worked fine. – threviel May 09 '22 at 06:32
  • nanoff --platform esp32 --serialport COM6 --update .NET nanoFramework Firmware Flasher v2.0.58+a800bf6cc1 Copyright (C) 2019 .NET Foundation and nanoFramework project contributors Using COM6 @ 1500000 baud to connect to ESP32. Reading details from chip... OK Connected to: ESP32 (ESP32-D0WD (revision 1)) Features WiFi, BT, Dual Core, VRef calibration in efuse, Coding Scheme None Flash size 4MB GD25Q32 from GIGADEVICE (manufacturer 0x200 device 0x16406) PSRAM: not available Crystal 40MHz MAC 24:0A:C4:26:DC:54...... – threviel May 09 '22 at 06:33
  • Still haven't been able to solve this. There seems to be no way of getting nanoframework to debug unless one uses a development board setup. – threviel Jun 03 '22 at 11:43
  • Like I've tried to explain above, if you're trying to debug C# you DO NOT need a JTAG adapter. In fact that won't be possible. – José Simões Jun 04 '22 at 13:00
  • Yes, but it does not seem to work with just RX/TX either, from what I can gather you need the circuit shown here: https://github.com/OLIMEX/ESP32-POE/blob/master/HARDWARE/ESP32-PoE-hardware-revision-I/ESP32-PoE_Rev_I.pdf – threviel Jun 07 '22 at 06:23
  • The right side connection in the USB to UART frame, otherwise you won't be able to reset the ESP as needed by the debugging. – threviel Jun 07 '22 at 06:24
  • There is no need to reset the ESP32 to debug C# code being executed by the CLR and execution engine. – José Simões Jun 08 '22 at 07:40
  • Are you talking about some kind of hot attach process perhaps? My setup works flawlessly on an ESP32-POE card and it does not work at all on my custom hardware with only RX/TX. – threviel Jun 08 '22 at 13:04
  • Suggest that you go over our Discord server here https://discordapp.com/invite/gCyBu8T for a more streamlined support. – José Simões Jun 08 '22 at 16:47