golioth / golioth-firmware-sdk

Firmware SDK enabling any IoT device to connect to Golioth - the Universal Connector for IoT
https://golioth.io
Apache License 2.0
60 stars 11 forks source link

Terminal hangs when running example #82

Closed shanemmattner closed 1 year ago

shanemmattner commented 1 year ago

Golioth Firmware SDK Commit Hash

0040640a3d280be5cf4e50b56664f6bbc918020e

Platform/OS

ESP-IDF v4.4.4-96-gdab3f38f0f

Hardware Target

ESP32C3

What host OS are you using?

MacOS: Version 13.2 (22D49)

Current Behavior

I'm trying to run the example and running into the message below after flashing/connecting. I can't type anything or return. idf.py monitor works with other esp-idf programs I've using.

Type 'help' to get the list of commands.
Use UP/DOWN arrows to navigate through command history.
Press TAB when typing command name to auto-complete.

Your terminal application does not support escape sequences.

Line editing and history features are disabled.

On Windows, try using Putty instead.
esp32> W (1713) golioth_example: WiFi and golioth credentials are not set
W (1713) golioth_example: Use the shell settings commands to set them, then restart

I tried using bash instead of zch but that didn't help.

Expected Behavior

No response

Steps To Reproduce

No response

Logs, console output, or any kind of debug information

Tesss-Personal-MacBook-Pro:golioth_basics Shane$ idf.py -p /dev/tty.usbmodem144301 monitor
Executing action: monitor
Running idf_monitor in directory /Users/Shane/golioth-firmware-sdk/examples/esp_idf/golioth_basics
Executing "/Users/Shane/.espressif/python_env/idf4.4_py3.10_env/bin/python /Users/Shane/esp/esp-idf/tools/idf_monitor.py -p /dev/tty.usbmodem144301 -b 115200 --toolchain-prefix riscv32-esp-elf- --target esp32c3 --decode-panic backtrace /Users/Shane/golioth-firmware-sdk/examples/esp_idf/golioth_basics/build/golioth_basics.elf -m '/Users/Shane/.espressif/python_env/idf4.4_py3.10_env/bin/python' '/Users/Shane/esp/esp-idf/tools/idf.py' '-p' '/dev/tty.usbmodem144301'"...
--- WARNING: Serial ports accessed as /dev/tty.* will hang gdb if launched.
--- Using /dev/cu.usbmodem144301 instead...
--- idf_monitor on /dev/cu.usbmodem144301 115200 ---
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x15 (USB_UART_CHIP_RESET),boot:0xd (SPI_FAST_FLASH_BOOT)
Saved PC:0x420af10e
0x420af10e: cpu_ll_waiti at /Users/Shane/esp/esp-idf/components/hal/esp32c3/include/hal/cpu_ll.h:204
 (inlined by) esp_pm_impl_waiti at /Users/Shane/esp/esp-idf/components/esp_pm/pm_impl.c:837

SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd5810,len:0x16c8
load:0x403cc710,len:0x944
load:0x403ce710,len:0x2e68
entry 0x403cc710
I (24) boot: ESP-IDF v4.4.4-96-gdab3f38f0f 2nd stage bootloader
I (24) boot: compile time 13:41:15
I (25) boot: chip revision: v0.3
I (28) boot.esp32c3: SPI Speed      : 80MHz
I (32) boot.esp32c3: SPI Mode       : DIO
I (37) boot.esp32c3: SPI Flash Size : 4MB
I (42) boot: Enabling RNG early entropy source...
I (47) boot: Partition Table:
I (51) boot: ## Label            Usage          Type ST Offset   Length
I (58) boot:  0 nvs              WiFi data        01 02 00009000 00004000
I (66) boot:  1 otadata          OTA data         01 00 0000d000 00002000
I (73) boot:  2 phy_init         RF data          01 01 0000f000 00001000
I (80) boot:  3 ota_0            OTA app          00 10 00010000 00190000
I (88) boot:  4 ota_1            OTA app          00 11 001a0000 00190000
I (95) boot: End of partition table
I (100) esp_image: segment 0: paddr=00010020 vaddr=3c0e0020 size=28960h (166240) map
I (133) esp_image: segment 1: paddr=00038988 vaddr=3fc94400 size=03648h ( 13896) load
I (136) esp_image: segment 2: paddr=0003bfd8 vaddr=40380000 size=04040h ( 16448) load
I (142) esp_image: segment 3: paddr=00040020 vaddr=42000020 size=d6bc4h (879556) map
I (279) esp_image: segment 4: paddr=00116bec vaddr=40384040 size=102a0h ( 66208) load
I (297) boot: Loaded app from partition at offset 0x10000
I (298) boot: Disabling RNG early entropy source...
I (309) cpu_start: Pro cpu up.
I (318) cpu_start: Pro cpu start user code
I (318) cpu_start: cpu freq: 160000000
I (318) cpu_start: Application information:
I (321) cpu_start: Project name:     golioth_basics
I (327) cpu_start: App version:      v0.5.0-14-g0040640
I (332) cpu_start: Compile time:     Feb  7 2023 13:41:07
I (339) cpu_start: ELF file SHA256:  3ca60e9367c96da2...
I (345) cpu_start: ESP-IDF:          v4.4.4-96-gdab3f38f0f
I (351) heap_init: Initializing. RAM available for dynamic allocation:
I (358) heap_init: At 3FCA11D0 len 0003B540 (237 KiB): DRAM
I (364) heap_init: At 3FCDC710 len 00002950 (10 KiB): STACK/DRAM
I (371) heap_init: At 50000020 len 00001FE0 (7 KiB): RTCRAM
I (378) spi_flash: detected chip: generic
I (382) spi_flash: flash io: dio
I (386) sleep: Configure to isolate all GPIO pins in sleep state
I (392) sleep: Enable automatic switching of GPIO sleep configuration
I (400) coexist: coexist rom version 9387209
I (405) cpu_start: Starting scheduler.
I (413) BTDM_INIT: BT controller compile version [80abacd]
I (413) phy_init: phy_version 950,11a46e9,Oct 21 2022,08:56:12
I (453) system_api: Base MAC address is not set
I (453) system_api: read default base MAC address from EFUSE
I (453) BTDM_INIT: Bluetooth MAC: a0:76:4e:7d:4b:a2

I (463) golioth_ble: BLE Host Task Started
I (473) NimBLE: GAP procedure initiated: stop advertising.

I (473) NimBLE: GAP procedure initiated: advertise; 
I (483) NimBLE: disc_mode=2
I (483) NimBLE:  adv_channel_map=0 own_addr_type=0 adv_filter_policy=0 adv_itvl_min=0 adv_itvl_max=0
I (493) NimBLE: 

Type 'help' to get the list of commands.
Use UP/DOWN arrows to navigate through command history.
Press TAB when typing command name to auto-complete.

Your terminal application does not support escape sequences.

Line editing and history features are disabled.

On Windows, try using Putty instead.
esp32> W (1713) golioth_example: WiFi and golioth credentials are not set
W (1713) golioth_example: Use the shell settings commands to set them, then restart
ncmiller commented 1 year ago

Hi @shanemmattner - I checked out that esp-idf commit, but was unable to recreate the issue on my ESP32C3-MINI-1 (tested on Ubuntu 22.04). The console shell was working normally for me.

It seems like this line from your logs might be related to the issue:

Your terminal application does not support escape sequences.

I don't see that on my logs.

Are you able to use the console shell with this ESP-IDF example? https://github.com/espressif/esp-idf/tree/master/examples/system/console/basic

shanemmattner commented 1 year ago

Thank you for the quick response @ncmiller. The example program did not work so this is definitely not a Goliath problem.

I made a post on the Apple forum if anyone runs into this same issue.

beriberikix commented 1 year ago

@ncmiller this sounds like the issue I was running into on ESP32 boards without a external usb to serial device, like the Adafruit ESP32-S3 Feather. IIRC the fix was enabling USB_SERIAL_JTAG. Can you try the basic console example with it enabled and let us know if that fixes the issue?

shanemmattner commented 1 year ago

@beriberikix that was the solution, thank you so much!

I (428) NimBLE: GAP procedure initiated: advertise; 
I (428) NimBLE: disc_mode=2
I (428) NimBLE:  adv_channel_map=0 own_addr_type=0 adv_filter_policy=0 adv_itvl_min=0 adv_itvl_max=0
I (438) NimBLE: 

Type 'help' to get the list of commands.
Use UP/DOWN arrows to navigate through command history.
Press TAB when typing command name to auto-complete.
I (578) pp: pp rom version: 9387209
I (578) net80211: net80211 rom version: 9387209
                                                                                                                                                                                                                                                           I (588) wifi_init: rx ba win: 6
I (588) wifi_init: tcpip mbox: 32
I (588) wifi_init: udp mbox: 6
I (588) wifi_init: tcp mbox: 6
I (588) wifi_init: tcp tx win: 5744
I (588) wifi_init: tcp rx win: 5744
I (588) wifi_init: tcp mss: 1440
I (588) wifi_init: WiFi IRAM OP enabled
I (588) wifi_init: WiFi RX IRAM OP enabled
esp32> I (3698) esp_netif_handlers: sta ip: 192.168.68.121, mask: 255.255.255.0, gw: 192.168.68.1
I (3698) example_wifi: WiFi Connected. Got IP:192.168.68.121
I (3698) example_wifi: Connected to AP SSID: Shane&Tess_Guest
I (3698) golioth_mbox: Mbox created, bufsize: 2184, num_items: 20, item_size: 104
I (3698) golioth_basics: Waiting for connection to Golioth...
I (3778) golioth_coap_client: Start CoAP session with host: coaps://coap.golioth.io
I (3778) golioth_coap_client: Session PSK-ID: gray-sophisticated-wasp-id@esp32_test-6d9364
I (3778) libcoap: Setting PSK key

I (3788) golioth_coap_client: Entering CoAP I/O loop
I (4188) golioth_coap_client: Golioth CoAP client connected
I (4188) golioth_basics: Golioth client connected
I (4188) golioth_basics: Hello, Golioth!
I (4188) golioth_fw_update: Current firmware version: main - 1.2.5
I (5108) golioth_fw_update: Waiting to receive OTA manifest
I (5438) golioth_fw_update: Received OTA manifest
I (5438) golioth_fw_update: Manifest does not contain different firmware version. Nothing to do.
I (5438) golioth_fw_update: Waiting to receive OTA manifest
I (5618) golioth_basics: Synchronously got my_int = 42
I (5628) golioth_basics: Entering endless loop
I (5628) golioth_basics: Sending hello! 0
I (6128) golioth_basics: Callback got my_int = 42
W (7048) golioth_coap_client: 4.00 (req type: 3, path: .c/status), len 59
esp32> 
esp32> I (15628) golioth_basics: Sending hello! 1
I (25628) golioth_basics: Sending hello! 2