Hi Milan,

This S2-Mini board powered by ESP32-S2 seems to use the USB Controller
directed instead of using an external USB/Serial chip like the other
boards you cited.

Also keep in mind that ESP32-S2 chip doesn't have internally the
USB_SERIAL_JTAG Controller that exist on ESP32-C3 and ESP32-S3 chips
and are pretty ease to add support.

So to get the Console working on ESP32-S2 you have two options:

1) Connect a USB/Serial adapter directly the the pins used as UART0,
not ideal because probably you don't want attachment like it to your
board;

2) add support to USB Device on ESP32-S2, fortunately there is a port
done for ESP32-S3 and that could be used as base, because the USB
Controller is basically the same with only some differences related
pins, clock initialization, etc. Probably looking how it is done on
IDF you will get it working.

BR,

Alan

On 6/29/23, Milan Obuch <nuttx-...@dino.sk> wrote:
> Hi,
>
> I got small board - https://www.wemos.cc/en/latest/s2/s2_mini.html -
> and would like to try NuttX on it. I already have some experience with
> NuttX, using Raspberry Pi Pico. I am able to build any configuration,
> upload it to the board and run.
>
> So for ESP32 now... the board uses actually S2 version, it is pretty
> minimal. Unfortunately, there are just two boards with configs at
> present, Kaluga and Saola. Both use UART0 for console, not suitable for
> Mini, because UART0 pins are neither accessible via some pin nor
> connected to some USB-UART bridge (both Kaluga and Saola use the later).
>
> So I tried UART1 with no positive outcome. How I did it:
>
> tools/configure.sh esp32s2-saola-1:nsh
> gmake menuconfig
> (enable UART1, select it as console)
> gmake savedefconfig
>
> Now, diff tells me:
>
> diff -u boards/xtensa/esp32s2/esp32s2-saola-1/configs/nsh/defconfig
> defconfig
>
> --- boards/xtensa/esp32s2/esp32s2-saola-1/configs/nsh/defconfig 2022-10-13
> 07:38:48.000000000 +0200
> +++ defconfig   2023-06-29 17:40:48.902374000 +0200
> @@ -21,6 +21,7 @@
>  CONFIG_BOARD_LOOPSPERMSEC=16717
>  CONFIG_BUILTIN=y
>  CONFIG_ESP32S2_UART0=y
> +CONFIG_ESP32S2_UART1=y
>  CONFIG_FS_PROCFS=y
>  CONFIG_HAVE_CXX=y
>  CONFIG_HAVE_CXXINITIALIZE=y
> @@ -41,4 +42,4 @@
>  CONFIG_START_MONTH=12
>  CONFIG_START_YEAR=2011
>  CONFIG_SYSTEM_NSH=y
> -CONFIG_UART0_SERIAL_CONSOLE=y
> +CONFIG_UART1_SERIAL_CONSOLE=y
>
> After building, I was able to flash binary to Mini as follows:
>
> esptool.py -c esp32s2 -p /dev/cuaU0 -b 921600   write_flash -fs detect -fm
> dio -ff 40m 0x10000 nuttx.bin
> esptool.py v4.5
> Serial port /dev/cuaU0
> Connecting....
> Chip is ESP32-S2FNR2 (revision v0.0)
> Features: WiFi, Embedded Flash 4MB, Embedded PSRAM 2MB, ADC and temperature
> sensor calibration in BLK2 of efuse V2
> Crystal is 40MHz
> MAC: 48:27:e2:57:1c:ee
> Uploading stub...
> Running stub...
> Stub running...
> Changing baud rate to 921600
> Changed.
> Configuring flash size...
> Auto-detected Flash size: 4MB
> Flash will be erased from 0x00010000 to 0x0002ffff...
> Compressed 128816 bytes to 53117...
> Wrote 128816 bytes (53117 compressed) at 0x00010000 in 1.0 seconds
> (effective 1077.3 kbit/s)...
> Hash of data verified.
>
> Leaving...
>
> My USB to serial cable was connected to GPIOs 17 and 18, but I see no
> activity on reset here. Is there anything missing I should do?
>
> One more note - I am somehow stuck with 12.0 sources for now. I am
> building NuttX on FreeBSD, 12.1 did not build for me. I am just playing
> with NuttX occasionally, so I can't really investigate it into detail.
>
> Regards,
> Milan
>

Reply via email to