guild icon
Toit
#Device unregisters with `jag` (esp32s3)
Thread channel in help
bpmct
bpmct 05/04/2025 03:29 PM
I'm noticing that sometimes, I have to manually specify jag flash --port /dev/cu.usbmodem2101 but it otherwise does not show up on jag port, jag flash, or jag monitor.

I am also finding cases where it lets me manually specify the port with jag flash, but jag monitor isn't able to pick it up... Any ideas? I'm using an esp32s3 and this version:

➜ toit-zygote git:(fixes) ✗ jag version Version: v1.50.3 SDK version: v2.0.0-alpha.179 Build date: 2025-04-01T08:09:19Z
floitsch
floitsch 05/04/2025 03:30 PM
The mechanism behind jag scan is responsible for finding devices
floitsch
floitsch 05/04/2025 03:30 PM
Devices that have Jaguar installed broadcast a UDP package every few ms.
floitsch
floitsch 05/04/2025 03:31 PM
The CLI waits a short moment to see if it receives one for the device you are interested it
floitsch
floitsch 05/04/2025 03:32 PM
You can also shortcut the finding by specifying the IP of the device: jag scan 192.168.0.42 (for example)
bpmct
bpmct 05/04/2025 03:33 PM
Hmm... So I am running into this now and I was able to flash and monitor, but jag scan seems to be failing and I cannot visit the HTTP server of it broadcasting:

My flash command:
[jaguar.http] INFO: running Jaguar device 'vigilant-photo' (id: 'a8e4b36b-7d2b-4caf-9152-884514ae379a') on 'http://192.168.5.37:9000'
floitsch
floitsch 05/04/2025 03:33 PM
Iirc, once you have done a jag scan it should remember the IP and finding the device should be more stable.
floitsch
floitsch 05/04/2025 03:34 PM
There can be many reasons why upd broadcast packets don't make it (firewalls, ...), but it is rare that it works sometimes but not always.
bpmct
bpmct 05/04/2025 03:34 PM
➜ toit-zygote git:(fixes) ✗ jag scan 192.168.5.37 Scanning for device with address: '192.168.5.37' Error: Get "http://192.168.5.37:9000/identify": context deadline exceeded
bpmct
bpmct 05/04/2025 03:34 PM
It seems like the server itself on the device isn't working, yet it claims to be broadcasting properly...
floitsch
floitsch 05/04/2025 03:35 PM
Ah. Ok
floitsch
floitsch 05/04/2025 03:35 PM
Yes. If the server isn't responding fast enough that could also be a reason.
bpmct
bpmct 05/04/2025 03:35 PM
I have reset and re-flashed several times.
floitsch
floitsch 05/04/2025 03:35 PM
Maybe you are running a computationally expensive program or are running out of memory.
floitsch
floitsch 05/04/2025 03:36 PM
What does the output of the serial port show?
bpmct
bpmct 05/04/2025 03:36 PM
This seems to only happen when jag is natively unaware of the device but I have to hardcode the port.

Some combination of re-setting and un-plugging the device often gets it back into shape for a period.
(edited)
floitsch
floitsch 05/04/2025 03:37 PM
Btw: I increased the timeout just last week. So hopefully things will be more stable with the next release
👍1
bpmct
bpmct 05/04/2025 03:37 PM
One moment... I will do one more jag flash and jag monitor
bpmct
bpmct 05/04/2025 03:38 PM
Ah here is one other thing I am noticing! My initial jag monitor after jag flash shows:

waiting for download

So I have been pressing the reset button for around 1.5s and that seems to consistently run jaguar as opposed to the esp32 "base" firmware...
bpmct
bpmct 05/04/2025 03:38 PM
So after the ~1-1.5s "reset":

➜ toit-zygote git:(fixes) ✗ jag monitor --port /dev/cu.usbmodem2101 Starting serial monitor of port '/dev/cu.usbmodem2101' ... [toit] INFO: starting <v2.0.0-alpha.179> ESP-ROM:esp32s3-20210327 Build:Mar 27 2021 rst:0x15 (USB_UART_CHIP_RESET),boot:0x8 (SPI_FAST_FLASH_BOOT) Saved PC:0x403851c6 SPIWP:0xee mode:DIO, clock div:1 load:0x3fce2810,len:0xdc load:0x403c8700,len:0x4 load:0x403c8704,len:0xa08 load:0x403cb700,len:0x257c entry 0x403c8854 [toit] INFO: starting <v2.0.0-alpha.179> [toit] DEBUG: clearing RTC memory: powered on by hardware source [toit] INFO: running on ESP32S3 - revision 0.1 [toit] INFO: using SPIRAM for heap metadata and heap [wifi] DEBUG: connecting [wifi] DEBUG: connected [wifi] INFO: network address dynamically assigned through dhcp {ip: 192.168.5.37} [wifi] INFO: dns server address dynamically assigned through dhcp {ip: [192.168.5.1]} [jaguar.http] INFO: running Jaguar device 'ultimate-noise' (id: '46198077-b96b-47d1-acf6-6fdff231c2db') on 'http://192.168.5.37:9000'
floitsch
floitsch 05/04/2025 03:38 PM
The duration of pressing the reset button doesn't matter.
bpmct
bpmct 05/04/2025 03:38 PM
However, that HTTP server is not responding.
floitsch
floitsch 05/04/2025 03:39 PM
Weird.
bpmct
bpmct 05/04/2025 03:39 PM
Its strange, because for whatever reason when I briefly press it, it shows "waiting for download" but pressing for longer seems to "shock" it into running jaguar(edited)
floitsch
floitsch 05/04/2025 03:39 PM
Does it work if you go to the URL in a browser?
bpmct
bpmct 05/04/2025 03:39 PM
nope
bpmct
bpmct 05/04/2025 03:40 PM
For example, I just briefly pressed "reset" and I see this now

➜ toit-zygote git:(fixes) ✗ jag monitor --port /dev/cu.usbmodem2101 Starting serial monitor of port '/dev/cu.usbmodem2101' ... ESP-ROM:esp32s3-20210327 Build:Mar 27 2021 rst:0x15 (USB_UART_CHIP_RESET),boot:0x0 (DOWNLOAD(USB/UART0)) Saved PC:0x40041a76 waiting for download
floitsch
floitsch 05/04/2025 03:40 PM
That sounds like a network problem then. It sounds unlikely to me that the browser can't open the page when no other container is running
👍1
bpmctOPbpmct
For example, I just briefly pressed "reset" and I see this now ```sh ➜ toit-zygote git:(fixes) ✗ jag monitor --port /dev/cu.usbmodem2101 Starting serial monitor of port '/dev/cu....
floitsch
floitsch 05/04/2025 03:41 PM
That's when the boot was also pressed
floitsch
floitsch 05/04/2025 03:41 PM
This is the message when the device gets flashed
👍1
floitsch
floitsch 05/04/2025 03:42 PM
Maybe your board does this automatically for short resets. It's not a common design
bpmct
bpmct 05/04/2025 03:42 PM
I see.
bpmct
bpmct 05/04/2025 03:43 PM
Hmmm.... I'll do some network troubleshooting
bpmct
bpmct 05/04/2025 03:44 PM
Thanks for the prompt response!
floitsch
floitsch 05/04/2025 03:44 PM
Let us know if you find something
bpmct
bpmct 05/04/2025 03:47 PM
Btw: I increased the timeout just last week. So hopefully things will be more stable with the next release

Do you think it would be worth me building jag from source and trying that?
floitsch
floitsch 05/04/2025 03:47 PM
It's super easy to do. So yes. You can try
bpmct
bpmct 05/04/2025 03:47 PM
However, the device appears totally unreachable on my network. ping doesn't seem to work...

Will give it a shot :👍:
floitsch
floitsch 05/04/2025 03:47 PM
It's just a go executable
bpmctOPbpmct
However, the device appears totally unreachable on my network. ping doesn't seem to work... Will give it a shot :👍:
floitsch
floitsch 05/04/2025 03:48 PM
I'm not 100% certain the devices respond to ping, but I would assume so
👍1
bpmct
bpmct 05/04/2025 04:04 PM
Hmm... so one other thing I am noticing is this does not show up on jag port at alll... Any idea why that is?

➜ toit-zygote git:(fixes) ✗ ls /dev/cu.* /dev/cu.Bluetooth-Incoming-Port /dev/cu.usbmodem2101 /dev/cu.debug-console ➜ toit-zygote git:(fixes) ✗ jag port /dev/cu.debug-console ➜ toit-zygote git:(fixes) ✗
floitsch
floitsch 05/04/2025 04:06 PM
Does your board have an extra usb-serial chip or does it use the esp USB functionality?
floitsch
floitsch 05/04/2025 04:07 PM
Could be that Jaguar filters the ports incorrectly
floitschfloitsch
Does your board have an extra usb-serial chip or does it use the esp USB functionality?
floitsch
floitsch 05/04/2025 04:09 PM
Cp2101 indicates a separate chip. That should always work
bpmct
bpmct 05/04/2025 04:09 PM
It used to show up naturally... I am honestly **not sure what changed(edited)
floitsch
floitsch 05/04/2025 04:10 PM
I have never seen this behavior.
bpmct
bpmct 05/04/2025 04:10 PM
Part of me wonders if this is all related...
bpmct
bpmct 05/04/2025 04:11 PM
Yesterday, through combination of re-setting, flashing, and un-plugging, jag became aware of it, I didn't have to manually specify port and web server worked
floitsch
floitsch 05/04/2025 04:11 PM
Maybe try to connect the device to a reliable USB source with a known good cable.
👍1
bpmct
bpmct 05/04/2025 04:12 PM
Yes, I'll try another cable
floitsch
floitsch 05/04/2025 04:12 PM
Not really sure what could be wrong but cables have been frequent sources of annoyance(edited)
👍1
bpmct
bpmct 05/04/2025 04:49 PM
Ok I discovered something I should have discovered earlier...

The DHCP/DNS is all wrong... All other devices on my network are 192.168.1.x however this IP is 192.168.5.x

➜ toit-zygote git:(fixes) ✗ jag monitor --port /dev/cu.usbmodem2101 ✔ /dev/cu.usbmodem101 Starting serial monitor of port '/dev/cu.usbmodem101' ... [toit] INFO: starting <v2.0.0-alpha.179> ESP-ROM:esp32s3-20210327 Build:Mar 27 2021 rst:0x15 (USB_UART_CHIP_RESET),boot:0x8 (SPI_FAST_FLASH_BOOT) Saved PC:0x403851c6 SPIWP:0xee mode:DIO, clock div:1 load:0x3fce2810,len:0xdc load:0x403c8700,len:0x4 load:0x403c8704,len:0xa08 load:0x403cb700,len:0x257c entry 0x403c8854 [toit] INFO: starting <v2.0.0-alpha.179> [toit] DEBUG: clearing RTC memory: powered on by hardware source [toit] INFO: running on ESP32S3 - revision 0.1 [toit] INFO: using SPIRAM for heap metadata and heap [wifi] DEBUG: connecting [wifi] DEBUG: connected [wifi] INFO: network address dynamically assigned through dhcp {ip: 192.168.5.37} [wifi] INFO: dns server address dynamically assigned through dhcp {ip: [192.168.5.1]} [jaguar.http] INFO: running Jaguar device 'musing-neck' (id: '84db983d-f661-4aba-9d53-2bfcd5019e0d') on 'http://192.168.5.37:9000'

I was playing around with the captive portal stuff that messes with DNS, but I would have assumed a jag flash would have reset everything
(edited)
bpmct
bpmct 05/04/2025 04:57 PM
Hmm ok something super odd is happening...

The jag flash doesn't really seem to be doing anything (or respecting my wifi config) and its connected to a secondary network I have that I configured on my captive portal a while ago
(edited)
bpmct
bpmct 05/04/2025 04:57 PM
Will sort it out and share an update
bpmct
bpmct 05/04/2025 05:14 PM
esptool erase_flash did the trick... The jag flash didn't seem to erase the WiFi credentials I already had set via my captive portal code(edited)
bpmct
bpmct 05/04/2025 05:14 PM
regarding the jag port thing, it's no big deal and happening less frequently. I did set up a local build of jag so if I repro again I'll investigate and put up a PR(edited)
bpmct
bpmct 05/04/2025 05:15 PM
So I'm up and running again with esptool erase_flash :☑️:
floitsch
floitsch 05/04/2025 06:59 PM
Interesting. I will try to remember it in case someone else runs into a similar issue. Thanks for the feedback
59 messages in total