Communication with external USB device
-
Yes, J102 is connected to the USB OTG peripheral of the esp32. I can be used in host or device mode depending on the application requirements. The MicroPython firmware configures it in device mode with serial REPL support.
Please note that the starter kit cannot be powered via J102.
Updated in regards to powering connected devices
-
By default, MicroPython firmware configures J202 in device mode with an alternate serial REPL.
I would like to disable the REPL on the J202 port and use that USB port to talk to a device (probably in udp)
I tried to disable the REPL using micropython:- I loaded a boot.py file with os.dupterm(None,1)
- I loaded main.py script with uart_usb = machine.UART(0, baudrate=115200)
- I rebooted the board
- I opened a terminal with screen /dev/ttyACM0 115200
The problem is that when I try to call the:
uart_usb = machineUART(0,baudrate=115200)
I get the following error
Guru Meditation Error: Core 1 panic’ed (Interrupt wdt timeout on CPU1).
Core 1 register dump:
PC : 0x40376868 PS : 0x00050034 A0 : 0x4212a396 A1 : 0x3fca2790
A2 : 0x00000208 A3 : 0x3fcf4b80 A4 : 0x40379f50 A5 : 0x3fca2770
A6 : 0x60000000 A7 : 0x00050021 A8 : 0x82014f05 A9 : 0x403845f2
A10 : 0x00060123 A11 : 0x00000000 A12 : 0x00000000 A13 : 0x00000100
A14 : 0x00060023 A15 : 0x00000001 SAR : 0x0000001d EXCCAUSE: 0x00000006
EXCVADDR: 0x00000000 LBEG : 0x00000000 LEND : 0x00000000 LCOUNT : 0x00000000
Core 1 was running in ISR context:
EPC1 : 0x4212aa47 EPC2 : 0x00000000 EPC3 : 0x00000000 EPC4 : 0x40376868
Backtrace: 0x40376865:0x3fca2790 0x4212a393:0x3fcf4b80 0x4201af13:0x3fcf4ba0 0x40385750:0x3fcf4bc0
Core 0 register dump:
PC : 0x4212a396 PS : 0x00060e34 A0 : 0x8201af16 A1 : 0x3fcf4420
A2 : 0x3fca6958 A3 : 0x00060e20 A4 : 0x00060420 A5 : 0x3fcf3930
A6 : 0x00ffffff A7 : 0x00000003 A8 : 0x82014f05 A9 : 0x3fcf4410
A10 : 0x00060e23 A11 : 0x00000000 A12 : 0x00060e20 A13 : 0x3fcf4330
A14 : 0x00060023 A15 : 0x00000003 SAR : 0x0000001d EXCCAUSE: 0x00000006
EXCVADDR: 0x00000000 LBEG : 0x00000000 LEND : 0x00000000 LCOUNT : 0x00000000
-
To modify the functionality of J102, which is the USB OTG peripheral of the esp32s3, you need to modify ext/micropython/ports/esp32/usb.c
The REPL on UART0 is enabled by default, you cannot just re-assign the UART peripheral, which is why the board crashes.
If you want to disable the REPL on UART0, you can modify https://github.com/sg-wireless/sg-sdk/blob/40dbabba63db543aeeaa9a313fc00faebd0169cb/src/platforms/F1/sdk-main/micropython/mpconfigboard.h#L7