https://toitlang.org/ logo
Device unregisters with `jag` (esp32s3)
# help
b
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:
Copy code
➜  toit-zygote git:(fixes) ✗ jag version
Version:         v1.50.3
SDK version:     v2.0.0-alpha.179
Build date:      2025-04-01T08:09:19Z
f
The mechanism behind
jag scan
is responsible for finding devices
Devices that have Jaguar installed broadcast a UDP package every few ms.
The CLI waits a short moment to see if it receives one for the device you are interested it
You can also shortcut the finding by specifying the IP of the device:
jag scan 192.168.0.42
(for example)
b
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:
Copy code
[jaguar.http] INFO: running Jaguar device 'vigilant-photo' (id: 'a8e4b36b-7d2b-4caf-9152-884514ae379a') on 'http://192.168.5.37:9000'
f
Iirc, once you have done a
jag scan
it should remember the IP and finding the device should be more stable.
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.
b
Copy code
sh
➜  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
It seems like the server itself on the device isn't working, yet it claims to be broadcasting properly...
f
Ah. Ok
Yes. If the server isn't responding fast enough that could also be a reason.
b
I have reset and re-flashed several times.
f
Maybe you are running a computationally expensive program or are running out of memory.
What does the output of the serial port show?
b
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.
f
Btw: I increased the timeout just last week. So hopefully things will be more stable with the next release
b
One moment... I will do one more
jag flash
and
jag monitor
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...
So after the ~1-1.5s "reset":
Copy code
sh
➜  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'
f
The duration of pressing the reset button doesn't matter.
b
However, that HTTP server is not responding.
f
Weird.
b
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
f
Does it work if you go to the URL in a browser?
b
nope
For example, I just briefly pressed "reset" and I see this now
Copy code
sh
➜  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
f
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
That's when the boot was also pressed
This is the message when the device gets flashed
Maybe your board does this automatically for short resets. It's not a common design
b
I see.
Hmmm.... I'll do some network troubleshooting
Thanks for the prompt response!
f
Let us know if you find something
b
> 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?
f
It's super easy to do. So yes. You can try
b
However, the device appears totally unreachable on my network.
ping
doesn't seem to work... Will give it a shot 👍
f
It's just a go executable
I'm not 100% certain the devices respond to ping, but I would assume so
b
Hmm... so one other thing I am noticing is this does not show up on
jag port
at alll... Any idea why that is?
Copy code
sh
➜  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) ✗
f
Does your board have an extra usb-serial chip or does it use the esp USB functionality?
Could be that Jaguar filters the ports incorrectly
Cp2101 indicates a separate chip. That should always work
b
It used to show up naturally... I am honestly **not sure what changed
f
I have never seen this behavior.
b
Part of me wonders if this is all related...
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
f
Maybe try to connect the device to a reliable USB source with a known good cable.
b
Yes, I'll try another cable
f
Not really sure what could be wrong but cables have been frequent sources of annoyance
b
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
Copy code
sh
➜  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
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
Will sort it out and share an update
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
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
So I'm up and running again with
esptool erase_flash
☑️
f
Interesting. I will try to remember it in case someone else runs into a similar issue. Thanks for the feedback