Hi Milan,

On 6/30/23, Milan Obuch <nuttx-...@dino.sk> wrote:
> On Thu, 29 Jun 2023 19:29:39 -0300
> "Alan C. Assis" <acas...@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

Reply via email to