You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@nuttx.apache.org by Milan Obuch <nu...@dino.sk> on 2023/06/29 21:40:49 UTC

ESP32 question

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

Re: ESP32 question

Posted by Tomek CEDRO <to...@cedro.info>.
On Fri, Jun 30, 2023 at 7:53 AM Milan Obuch wrote:
> Problem here is not using additional USB/serial cable, I do it
> regularly if necessary or useful, but pins for UART0 (GPIOs 43 and 44)
> are not available on any pin, thus my attempt to use UART1. GPIOs 17
> and 18 are accessible on this board, is it not possible to use them for
> console?

Hey there Milan :-)

I just tested 12.2.0-RC0 on ESP32S2 WEMOS S2 Mini and Pico boards.. I
had to update UART pins in the config so use console over external
UART-to-USB converter.

./tools/configure.sh -B esp32s2-saola-1:coremark

You may want to use :nsh defconfig :-)

Then:

kconfig-tweak --set-val CONFIG_ESP32S2_UART0_TXPIN 2
kconfig-tweak --set-val CONFIG_ESP32S2_UART0_RXPIN 3
gmake olddefconfig

Then:

gmake -j8
gmake flash

In order to flash keep Button 0 pressed while RST then MCU will switch
into a Bootloader mode via USB-C connection. After flash press RST and
you should have console on selected pins :-)

I am working on a priority project right now, after its done I will
add board configurations for WEMOS boards that we have (you can try
that yourself its a good learning path) and some BSD build related
fixes (i.e. you need to change sed to gsed in some places).

Have fun! :-)

-- 
CeDeROM, SQ7MHZ, http://www.tomek.cedro.info

Re: ESP32 question

Posted by "Alan C. Assis" <ac...@gmail.com>.
The JTAG pins are between pins 43 and 47 (page 12) here:

https://www.espressif.com/sites/default/files/documentation/esp32-s2_datasheet_en.pdf

BR,

Alan

On 7/30/23, Alan C. Assis <ac...@gmail.com> wrote:
> Hi Milan,
>
> On 7/30/23, Milan Obuch <nu...@dino.sk> wrote:
> sic
>>> I got an S2 Mini V1.0.0 WEMOS.CC like yours and confirmed the issue.
>>> After changing the pins to 33 and 34 (as you noticed pins 43 and 44
>>> are not available, Wemos' mistake) the serial console is not showing
>>> up.
>>
>> Hi,
>>
>> do you see any possible solution to this problem? Now, as you can test
>> it locally, it should be easier for you to test it.
>>
>
> Yes, now I can help you!
>
>>> This board use the ESP32-S2 with internal SPI flash, so there are some
>>> small differences in relation to the original ESP32-S2 with external
>>> SPI flash.
>>
>> What kind of differences? What impact do they cause to NuttX
>> configuration and build?
>>
>
> I think there are some incompatibility with current ESP32S2
> initialization, but I cannot test with JTAG because they also didn't
> extern the JTAG pins.
>
>>> The ESP32-S2 and S3 USB IP is the same DWC USB controller used on
>>> Raspberry and some STM32 chips. So we could use the existing driver on
>>> NuttX as starting point.
>>
>> That's fine. Do we need some glue to use existing driver? Working USB
>> would make this board more useful.
>>
>
> Exactly! We already have ESP32-S3 USB Dev support, but S2 uses
> different initialization.
>
> We need to compare with ESP-IDF to understand what they are doing to
> initialize the USB on ESP32-S2.
>
> BR,
>
> Alan
>

Re: ESP32 question

Posted by "Alan C. Assis" <ac...@gmail.com>.
Hi Milan,

On 7/30/23, Milan Obuch <nu...@dino.sk> wrote:
sic
>> I got an S2 Mini V1.0.0 WEMOS.CC like yours and confirmed the issue.
>> After changing the pins to 33 and 34 (as you noticed pins 43 and 44
>> are not available, Wemos' mistake) the serial console is not showing
>> up.
>
> Hi,
>
> do you see any possible solution to this problem? Now, as you can test
> it locally, it should be easier for you to test it.
>

Yes, now I can help you!

>> This board use the ESP32-S2 with internal SPI flash, so there are some
>> small differences in relation to the original ESP32-S2 with external
>> SPI flash.
>
> What kind of differences? What impact do they cause to NuttX
> configuration and build?
>

I think there are some incompatibility with current ESP32S2
initialization, but I cannot test with JTAG because they also didn't
extern the JTAG pins.

>> The ESP32-S2 and S3 USB IP is the same DWC USB controller used on
>> Raspberry and some STM32 chips. So we could use the existing driver on
>> NuttX as starting point.
>
> That's fine. Do we need some glue to use existing driver? Working USB
> would make this board more useful.
>

Exactly! We already have ESP32-S3 USB Dev support, but S2 uses
different initialization.

We need to compare with ESP-IDF to understand what they are doing to
initialize the USB on ESP32-S2.

BR,

Alan

Re: ESP32 question

Posted by Milan Obuch <nu...@dino.sk>.
On Sun, 30 Jul 2023 09:56:36 -0300
"Alan C. Assis" <ac...@gmail.com> wrote:

> Hi Milan,
> 
> On 6/30/23, Milan Obuch <nu...@dino.sk> wrote:
> ...
> >> 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;  
> >
> > Problem here is not using additional USB/serial cable, I do it
> > regularly if necessary or useful, but pins for UART0 (GPIOs 43 and
> > 44) are not available on any pin, thus my attempt to use UART1.
> > GPIOs 17 and 18 are accessible on this board, is it not possible to
> > use them for console?
> >  
> 
> I got an S2 Mini V1.0.0 WEMOS.CC like yours and confirmed the issue.
> After changing the pins to 33 and 34 (as you noticed pins 43 and 44
> are not available, Wemos' mistake) the serial console is not showing
> up.

Hi,

do you see any possible solution to this problem? Now, as you can test
it locally, it should be easier for you to test it.

> This board use the ESP32-S2 with internal SPI flash, so there are some
> small differences in relation to the original ESP32-S2 with external
> SPI flash.

What kind of differences? What impact do they cause to NuttX
configuration and build?

> >> 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.  
> >
> > Should I take it as there is no USB support for ESP-S2 at the
> > moment? From ESP32-S3, which files are to be ported? I am not sure
> > I can do it myself as I am only starting to learn Espressif
> > devices... and, to be honest, I am still learning basics of NuttX
> > as well. 
> 
> The ESP32-S2 and S3 USB IP is the same DWC USB controller used on
> Raspberry and some STM32 chips. So we could use the existing driver on
> NuttX as starting point.

That's fine. Do we need some glue to use existing driver? Working USB
would make this board more useful.

regards,
Milan

Re: ESP32 question

Posted by "Alan C. Assis" <ac...@gmail.com>.
Hi Milan,

On 6/30/23, Milan Obuch <nu...@dino.sk> wrote:
...
>> 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;
>
> Problem here is not using additional USB/serial cable, I do it
> regularly if necessary or useful, but pins for UART0 (GPIOs 43 and 44)
> are not available on any pin, thus my attempt to use UART1. GPIOs 17
> and 18 are accessible on this board, is it not possible to use them for
> console?
>

I got an S2 Mini V1.0.0 WEMOS.CC like yours and confirmed the issue.
After changing the pins to 33 and 34 (as you noticed pins 43 and 44
are not available, Wemos' mistake) the serial console is not showing
up.

This board use the ESP32-S2 with internal SPI flash, so there are some
small differences in relation to the original ESP32-S2 with external
SPI flash.

>> 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.
>
> Should I take it as there is no USB support for ESP-S2 at the moment?
> From ESP32-S3, which files are to be ported? I am not sure I can do it
> myself as I am only starting to learn Espressif devices... and, to be
> honest, I am still learning basics of NuttX as well.
>

The ESP32-S2 and S3 USB IP is the same DWC USB controller used on
Raspberry and some STM32 chips. So we could use the existing driver on
NuttX as starting point.

BR,

Alan

Re: ESP32 question

Posted by "Alan C. Assis" <ac...@gmail.com>.
Hi Milan,

On 6/30/23, Milan Obuch <nu...@dino.sk> wrote:
> On Thu, 29 Jun 2023 19:29:39 -0300
> "Alan C. Assis" <ac...@gmail.com> wrote:
>
>> 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;
>
> Problem here is not using additional USB/serial cable, I do it
> regularly if necessary or useful, but pins for UART0 (GPIOs 43 and 44)
> are not available on any pin, thus my attempt to use UART1. GPIOs 17
> and 18 are accessible on this board, is it not possible to use them for
> console?
>

I think you spot an issue in our Kconfig, by default UART1 TXD and RXD
should be 17 and 18, but it was 37 and 38.

So, if you apply this patch:

diff --git a/boards/xtensa/esp32s2/esp32s2-saola-1/configs/nsh/defconfig
b/boards/xtensa/esp32s2/esp32s2-saola-1/configs/nsh/defconfig
index 9465c7706a..92f0a8dad1 100644
--- a/boards/xtensa/esp32s2/esp32s2-saola-1/configs/nsh/defconfig
+++ b/boards/xtensa/esp32s2/esp32s2-saola-1/configs/nsh/defconfig
@@ -19,7 +19,9 @@ CONFIG_ARCH_STACKDUMP=y
 CONFIG_ARCH_XTENSA=y
 CONFIG_BOARD_LOOPSPERMSEC=16717
 CONFIG_BUILTIN=y
-CONFIG_ESP32S2_UART0=y
+CONFIG_ESP32S2_UART1=y
+CONFIG_ESP32S2_UART1_RXPIN=18
+CONFIG_ESP32S2_UART1_TXPIN=17
 CONFIG_FS_PROCFS=y
 CONFIG_HAVE_CXX=y
 CONFIG_HAVE_CXXINITIALIZE=y
@@ -41,4 +43,4 @@ CONFIG_START_MONTH=12
 CONFIG_START_YEAR=2011
 CONFIG_SYSLOG_BUFFER=y
 CONFIG_SYSTEM_NSH=y
-CONFIG_UART0_SERIAL_CONSOLE=y
+CONFIG_UART1_SERIAL_CONSOLE=y

Compile:

$ make distclean
$ ./tools/configure.sh esp32s2-saola-1:nsh
$ make -j

Flash the nuttx.bin in your board at position 0x10000 to skip
bootloader anf partitions.

Then using a USB/Serial adapter in the pins 17 and 18 and you will see
the terminal:

NuttShell (NSH) NuttX-12.1.0
nsh> uname -a
NuttX 12.1.0 9603288c80-dirty Jun 30 2023 10:03:48 xtensa esp32s2-saola-1

>> 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.
>
> Should I take it as there is no USB support for ESP-S2 at the moment?
> From ESP32-S3, which files are to be ported? I am not sure I can do it
> myself as I am only starting to learn Espressif devices... and, to be
> honest, I am still learning basics of NuttX as well.
>

This file: arch/xtensa/src/esp32s3/esp32s3_otg_device.c

You can see the patch here: https://github.com/apache/nuttx/pull/9525

BR,

Alan

Re: ESP32 question

Posted by Tomek CEDRO <to...@cedro.info>.
On Sat, Jul 1, 2023 at 8:32 PM Milan Obuch wrote:
> Maybe it has something to do I am still using 12.0.0 sources

Can you try with master? 12.2.0 will show up soon :-)

> maybe it
> has something to do with the way I am using FreeBSD as host OS

I am also working on FreeBSD that example worked on ESP32-S2 + NuttX
12.1.0 + FreeBSD 13.2-RELEASE :-)

Flashing is done over internal ESP32-S2 USB-SerialJtag (onboard
connector). Console is done with external UART-to-USB adapter attached
to pins selected in the CONFIG.

You can try the UART-to-USB setup on something that you are sure to
work, then update UART pin mapping for ESP32-S2 build and it should
work :-) Note that only GND, VCC, RX, TX signals are needed, no
control lines as you need to reset and switch to bootloader by hand.

> some more investigation is needed. This all takes some time, so do not
> expect anything some time soon. I am still in testing phase

No worries, take your time, and enjoy learning new stuff :-)

-- 
CeDeROM, SQ7MHZ, http://www.tomek.cedro.info

Re: ESP32 question

Posted by "Alan C. Assis" <ac...@gmail.com>.
On 7/1/23, Milan Obuch <nu...@dino.sk> wrote:
> On Sat, 1 Jul 2023 10:27:11 -0300
> "Alan C. Assis" <ac...@gmail.com> wrote:
>
>> Hi Milan,
>>
>> Please verify if fix in the upstream solved your issue.
>>
>> BR,
>>
>> Alan
>>
>

Actually you don't need to user UART1, if you just use the default
configuration and change the UART0 TX pin to 17 and RX pin to 18 also
will work.

I tested both approach and all worked fine.

I don't use FreeBSD, but Tomek and one or other guy here uses it and
it works for them!

Try also to run:

make bootloader

make flash ESPTOOL_BINDIR=.

BR,

Alan
BR,

Alan

Re: ESP32 question

Posted by Milan Obuch <nu...@dino.sk>.
On Sat, 1 Jul 2023 10:27:11 -0300
"Alan C. Assis" <ac...@gmail.com> wrote:

> Hi Milan,
> 
> Please verify if fix in the upstream solved your issue.
> 
> BR,
> 
> Alan
>

Hi,

at the moment, neither solution presenetd in this thread works for me.
Maybe it has something to do I am still using 12.0.0 sources, maybe it
has something to do with the way I am using FreeBSD as host OS, maybe
some more investigation is needed. This all takes some time, so do not
expect anything some time soon. I am still in testing phase, maybe I'll
check another board available to me before I try again, so it could
look a little chaotic from outside...

Regards,
Milan

Re: ESP32 question

Posted by Milan Obuch <nu...@dino.sk>.
On Sat, 1 Jul 2023 20:31:39 +0200 I wrote:

> On Sat, 1 Jul 2023 10:27:11 -0300
> "Alan C. Assis" <ac...@gmail.com> wrote:
> 
> > Hi Milan,
> > 
> > Please verify if fix in the upstream solved your issue.
> > 
> > BR,
> > 
> > Alan
> >
> 
> Hi,
> 
> at the moment, neither solution presenetd in this thread works for me.
> Maybe it has something to do I am still using 12.0.0 sources, maybe it
> has something to do with the way I am using FreeBSD as host OS, maybe
> some more investigation is needed. This all takes some time, so do not
> expect anything some time soon. I am still in testing phase, maybe
> I'll check another board available to me before I try again, so it
> could look a little chaotic from outside...
> 
> Regards,
> Milan

[ Follow-up to my mail ]

And now, just for fun, I tried building NuttX after

tools/configure.sh esp32-ethernet-kit:nsh

and flash it to another board, T-Internet-POE, for more info look to
https://www.lilygo.cc/products/t-internet-poe, and the result is:

ets Jul 29 2019 12:21:46

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:1044
load:0x40078000,len:10044
load:0x40080400,len:5900
entry 0x400806ac
�
NuttShell (NSH) NuttX-12.0.0
nsh>

Not perfect, but it's in state allowing more experiments now. So, when
time permits, I am going to try more with this board.

Regards,
Milan

Re: ESP32 question

Posted by "Alan C. Assis" <ac...@gmail.com>.
Hi Milan,

Please verify if fix in the upstream solved your issue.

BR,

Alan

On 6/30/23, Milan Obuch <nu...@dino.sk> wrote:
> On Thu, 29 Jun 2023 19:29:39 -0300
> "Alan C. Assis" <ac...@gmail.com> wrote:
>
>> 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;
>
> Problem here is not using additional USB/serial cable, I do it
> regularly if necessary or useful, but pins for UART0 (GPIOs 43 and 44)
> are not available on any pin, thus my attempt to use UART1. GPIOs 17
> and 18 are accessible on this board, is it not possible to use them for
> console?
>
>> 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.
>
> Should I take it as there is no USB support for ESP-S2 at the moment?
> From ESP32-S3, which files are to be ported? I am not sure I can do it
> myself as I am only starting to learn Espressif devices... and, to be
> honest, I am still learning basics of NuttX as well.
>
> Regards,
> Milan
>

Re: ESP32 question

Posted by Milan Obuch <nu...@dino.sk>.
On Thu, 29 Jun 2023 19:29:39 -0300
"Alan C. Assis" <ac...@gmail.com> wrote:

> 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;

Problem here is not using additional USB/serial cable, I do it
regularly if necessary or useful, but pins for UART0 (GPIOs 43 and 44)
are not available on any pin, thus my attempt to use UART1. GPIOs 17
and 18 are accessible on this board, is it not possible to use them for
console?

> 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.

Should I take it as there is no USB support for ESP-S2 at the moment?
From ESP32-S3, which files are to be ported? I am not sure I can do it
myself as I am only starting to learn Espressif devices... and, to be
honest, I am still learning basics of NuttX as well.

Regards,
Milan

Re: ESP32 question

Posted by "Alan C. Assis" <ac...@gmail.com>.
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 <nu...@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
>