guild icon
Toit
#Trying to initialize uart on esp32c6
Thread channel in help
addshore
addshore 02/24/2026 03:51 PM
Running

import gpio import uart UART_RX_GPIO ::= 20 UART_TX_GPIO ::= 19 main: port := uart.Port --rx=gpio.Pin UART_RX_GPIO --tx=gpio.Pin UART_TX_GPIO --baud_rate=115200

Getting

Potential deadlock detected: Process: 2 Program: a42ef4b4-b892-6588-9883-ce3d1e1e3b30 BCI: 0x5c6 Primitive: 10:1 fatal: Potential dead-lock abort() was called at PC 0x4202f7fd on core 0 Core 0 register dump: MEPC : 0x40806b76 RA : 0x4081546e SP : 0x40831da0 GP : 0x40824824 TP : 0x40831fe0 T0 : 0x37363534 T1 : 0x7271706f T2 : 0x33323130 S0/FP : 0x40831ddc S1 : 0x40831ddc A0 : 0x40831ddc A1 : 0x40831dbe A2 : 0x00000000 A3 : 0x40831e09 A4 : 0x00000001 A5 : 0x4082d000 A6 : 0x00000000 A7 : 0x76757473 S2 : 0x40831dc0 S3 : 0x00000001 S4 : 0x004c4b40 S5 : 0x00000005 S6 : 0x028e885f S7 : 0x408332c0 S8 : 0x00000000 S9 : 0x00000000 S10 : 0x00000000 S11 : 0x00000000 T3 : 0x6e6d6c6b T4 : 0x6a696867 T5 : 0x66656463 T6 : 0x62613938 MSTATUS : 0x00001881 MTVEC : 0x40800001 MCAUSE : 0x00000002 MTVAL : 0x00000000 MHARTID : 0x00000000

not sure what the Primitive is, and seemignly i can only reproduce it on this hardeware setup.
Got any pointers?
addshore
addshore 02/24/2026 04:12 PM
im starting to guess its the noconsole / console esp defdault UART thing that I vaugly remember from a year ago now, and its just not a very nice error message :๐Ÿ˜„:
addshore
addshore 02/24/2026 04:25 PM
Although I just tried envelopes wiht CONFIG_ESP_CONSOLE_NONE=y etc and didnt solve it!
addshore
addshore 02/24/2026 04:48 PM
10:1 in 189 i believe is PRIMITIVE(create, 11)
floitsch
floitsch 02/24/2026 05:15 PM
It's indeed 'create'. No idea how that one could block...
floitsch
floitsch 02/24/2026 05:18 PM
Since you are building yourself, could you maybe add a few printfs to the function to see where it gets stuck?
https://github.com/toitlang/toit/blob/6d7fc990007289a43b49beec6871e46f73bbaee5/src/resources/uart_esp32.cc#L778
Program your microcontrollers in a fast and robust high-level language. - toitlang/toit
floitschfloitsch
Since you are building yourself, could you maybe add a few printfs to the function to see where it gets stuck? https://github.com/toitlang/toit/blob/6d7fc990007289a43b49beec6871e4...
addshore
addshore 02/24/2026 05:28 PM
oh yes, im deep in these printfs now :๐Ÿ˜›: Getting there
๐Ÿ‘1
addshore
addshore 02/24/2026 06:36 PM
Got a patch that seems to work for me, will make a PR shortly, just walking home
addshore
addshore 02/24/2026 06:36 PM
Quite nice being able to do the full thing end to end now! Maybe I can go back and debug my i2c deadlocks :๐Ÿ˜‚:
addshore
addshore 02/24/2026 07:02 PM
@floitsch so I'm pretty sure this is what ultimately fixed my ESP32c6 https://github.com/toitlang/toit/pull/2999
Add a small HAL wrapper to enable UART source clock and call it before selecting sclk/baud in uart.create. This prevents configuration against a disabled clock domain during bring-up.
addshore
addshore 02/24/2026 07:04 PM
i see conflicts with master, would be hillarious if this is already fixed in the latest release, that id idnt quite try yet, hahaha
addshore
addshore 02/24/2026 07:06 PM
Maybe I'll wait and find that out tommorrow when I have the device again and I can try v2.0.0-alpha.190 which has https://github.com/toitlang/toit/commit/6a9ee388c8c7af25554f352143a3267dfea56618
addshore
addshore 02/24/2026 07:44 PM
yup, i think you fixed the clk issue :๐Ÿ˜›:
floitsch
floitsch 02/24/2026 07:45 PM
Argh. I missed that you were on 189.
๐Ÿคฃ1
addshore
addshore 02/24/2026 07:45 PM
it was a fun journey nonetheless
addshore
addshore 02/24/2026 07:45 PM
and your rewrite did fix some issues then :๐Ÿ˜„: I expect
floitsch
floitsch 02/24/2026 07:45 PM
190 has a completely rewritten uart
addshore
addshore 02/24/2026 07:46 PM
yeah, I vaugly remember it now from when you put the release notes in discord
floitsch
floitsch 02/24/2026 07:46 PM
Hopefully more fixing than breaking :๐Ÿ™‚:(edited)
addshore
addshore 02/24/2026 07:46 PM
i was already so far down the rabbit hole i didnt think about just trying to update xD(edited)
floitsch
floitsch 02/24/2026 07:46 PM
:๐Ÿ™‚:
floitsch
floitsch 02/24/2026 07:48 PM
And well done. I had a look at fixing things with the old UART code and gave up. You actually managed to find a fix.
floitschfloitsch
And well done. I had a look at fixing things with the old UART code and gave up. You actually managed to find a fix.
addshore
addshore 02/24/2026 07:52 PM
maybe not the only one that was needed :๐Ÿ˜›: but either way, I'll be happy to have my device UART working in the morning :๐Ÿ˜„:
๐Ÿ‘1
addshore
addshore 02/25/2026 09:29 AM
Aaaah, @floitsch 190 is not yet in a jaguar release? :๐Ÿ™:
floitsch
floitsch 02/25/2026 09:30 AM
No. Not yet.
190 had some big changes (like UART and esptool) and I wanted to test it a bit more before shipping it to our users with Jaguar.
๐Ÿ‘1
addshore
addshore 02/25/2026 09:32 AM
"cleanest" way to easily use the default 190 envelope with the existing jag?
addshoreOPaddshore
"cleanest" way to easily use the default 190 envelope with the existing jag?
floitsch
floitsch 02/25/2026 09:46 AM
Probably using toit-repo-path.
But I can do a 190 release soon (today?).
Especially since you have confirmed that 190 works for you.
addshore
addshore 02/25/2026 09:52 AM
Especially since you have confirmed that 190 works for you.
Still need to do that, i havnt run it just, just read the code!
(edited)
addshore
addshore 02/25/2026 09:55 AM
I wonder if you might be able to look at https://github.com/toitlang/toit/pull/2998 for the same reelase? :๐Ÿ˜‰:
Cant use our c3 pins without it (but again fine as I have a cyustom build for that already)
As far as I can tell from the data sheet, ths configuration should allow usage of these pins.
floitsch
floitsch 02/25/2026 09:57 AM
That would require a new SDK release.
Note that you can use the pins with a flag. (And your PR is for s3 not c3).
addshore
addshore 02/25/2026 09:58 AM
Note that you can use the pins with a flag
ooh, that skips the check?
(edited)
floitsch
floitsch 02/25/2026 09:59 AM
Yes. The "restricted" can be forced
๐Ÿ’Ÿ1
floitschfloitsch
Yes. The "restricted" can be forced
addshore
addshore 02/25/2026 12:25 PM
looks like I need / want my own envelope anyway to set the ESP with SRAM off so that I dont get warnings!
๐Ÿ‘1
33 messages in total