variants: portenta_c33: enable port_irq6 external interrupt #665
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #665"
general
weight: 0.35
facchinm
One commit, one change to
variants/arduino_portenta_c33_r7fa6m5bh3cfc/arduino_portenta_c33_r7fa6m5bh3cfc.overlay:enable ICU external interrupt channel 6 (
port_irq6) on NVIC line 36.What it fixes
Channel 6 serves four pins: P000 (D22/A7), P301 (D40), P409 (D28) and
PA08 (D75).
port_irq6isstatus = "disabled"in the SoC devicetree, andneither the board devicetree nor this variant enables it. So on these pins
attachInterrupt()arms nothing:gpio_pin_interrupt_configure()returns-EWOULDBLOCK;attachInterrupt()returnsvoidand does not report the error(
cores/arduino/WInterrupts.cpp);D28 is the IRQ line of the Portenta UWB Shield (Truesense DCU150, NXP SR150).
Its library currently has to poll that line on this board.
The change
one of ten lines (36, 37, 52, 53, 60, 61, 62, 73, 86, 95) with no device
assigned. In the generated devicetree with this change,
port_irq6is theonly user of line 36.
port_irq9andport_irq10in the boarddevicetree.
port_irq6node already exists in the SoCdevicetree, so enabling it renumbers nothing. The generated devicetree
ordinals are identical with and without this change. The loader exports one
more device,
__device_dts_ord_40; every other exported symbol isunchanged. Sketches built against a core without this change keep working.
_image_ram_end: 105,760 B onmain, 105,720 B with this change).Kconfig is identical.
time, so one of D22, D28, D40 and D75.
Base and test builds
The branch is on
mainat e56d394. The test loaders were built withextra/build.sh portentac33on 39f8354, which uses Zephyr 1743741760e(
zephyr-arduino-v4.4.1+). Between 39f8354 and e56d394 the only change to thebuild is
west.ymlmoving tozephyr-arduino-v4.4.2. Compared with1743741760e, that branch does not change the RA6M5 SoC devicetree, the
Portenta C33 board devicetree, the RA external interrupt driver or the RA GPIO
driver. The only GPIO changes are in the GPIO emulator and in the userspace
syscall handlers (
gpio_handlers.c);hal_renesasis at the same revision.Tested on hardware
Portenta C33, dynamic (llext) mode. Each test flashed the same sketch image
on both loaders, so only the loader differs.
1. No shield, no wire. The test sketch calls
attachInterrupt()on D28,then
gpio_pin_interrupt_configure()on the same pin, and prints the returncode. D16 (
port_irq10, enabled onmain) is the control.| loader | D28
gpio_pin_interrupt_configure()| D16 (control) ||---|---|---|
|
main39f8354 | -11 (-EWOULDBLOCK) | 0 ||
main39f8354 + this commit | 0 | 0 |The sketch's other test pins, on disabled channels (D0, D2, D4, D12, D18),
returned -11 on both loaders. With no wire, no edges were expected, and every
count stayed 0.
2. UWB shield, SR150 IRQ as the signal. The shield's two-way ranging
example needs the larger llext heap from #655, so both loaders here include
#655: 39f8354 + #655, and 39f8354 + #655 + this commit. The sketch is the
library's
UWB_RangingControllerplus anattachInterrupt()on D28 thatcounts rising edges (the SR150 IRQ is active high). It prints the count every
second next to the number of ranging notifications. The library still polls
D28, so ranging does not depend on this change. The peer was a second
Portenta C33 with the shield, running
UWB_RangingControleeon core 1.0.0with a 192 KB-heap loader.
| loader | D28 attach return | D28 rising edges per second | ranging notifications per second | distances |
|---|---|---|---|---|
| 39f8354 + #655 | -11 | 0 in every second for 32 s | 5 in every second (160 in 32 s) | 18-68 cm |
| 39f8354 + #655 + this commit | 0 | 28 in the first line, then 9-11 per second (119 in 10 s) | 5 in every second (50 in 10 s) | 49-57 cm |
Edges per notification. After the first line, D28 shows 9-11 rising edges
per second against 5 ranging notifications, about two per notification. The
host's read path expects two IRQ assertions per UCI packet.
uwb_uwbs_tml_data_rx()in the NXP UWB SDK (uwb_uwbs_tml_interface.c, notchanged for this board) works like this:
1. It waits for the IRQ (line 185).
2. It raises the host's read-ready line (line 254).
3. It waits for the IRQ again (line 262, "IRQ asserted again").
4. It reads the packet.
5. It waits for the IRQ to drop (line 305).
Two rising edges per packet give 10 per second if the ranging notification is
the only packet the SR150 sends in each round. The log does not record which
packets were read, so that part is not shown.
The first line is higher (28) because it covers more than one second. The
sketch attaches the interrupt before it initialises and starts the ranging
session, so the first line counts everything from the attach to the end of
the first second, session setup included.
Other channels (not in this PR)
The same change would work for more channels. Of the 16 channels, only 9 and
10 are enabled today. The other 14 are disabled, and 44 pins in
digital-pin-gpiossit on them.unassigned NVIC lines. In a devicetree-only build with all ten enabled,
the ordinals are identical to
main, so nothing is renumbered. On theboard, the test sketch above on a loader with all ten enabled got 0 from
gpio_pin_interrupt_configure()on D2, D4, D12, D18 and D28, and -11 onlyon D0 (channel 0, still disabled). Together the ten channels would cover
34 pins in
digital-pin-gpios(33 pads: D29 and D60 are the same pad).This PR covers 4 of those pins; the other nine channels would add 30.
Eight of the 34 are on the MKR edge: D2, D4, D7, D12, D15, D18, D19 and
D20 (channel 6 has none there).
line, changes the devicetree ordinals of four exported devices:
ioport8,the ESP32 download node, the QSPI NOR flash and the PCLKA clock node
(checked for each of the four channels alone). Dynamic sketches refer to
devices by ordinal (
__device_dts_ord_<N>), so a sketch built against thecurrent core that uses one of those devices would have to be rebuilt.
There are also no free lines left for them once the other ten are used;
they would need lines that belong to disabled devices (for example sci0's).
If this change is accepted, I can prepare the other nine channels the same
way.