[Bug]: SX126xInterface.cpp -- gpio_isr_handler_remove() call when "… GPIO isr service is not installed …"
Category
Other
Hardware
Other
Is this bug report about any UI (https://meshtastic.org/docs/configuration/device-uis/) component firmware?
- [ ] Meshtastic UI aka MUI
- [ ] InkHUD
- [ ] BaseUI
Firmware Version
2.8.0 daily + local debug stanzas
Description
src/mesh/SX126xInterface.cpp includes a sequence-stackup of:
startReceive()
setStandby()
disableInterrupt()
lora.clearDio1Action()
… but on cold boot or warm reset on hardware with an SX1262 radio (e.g. M5Stack Unit C6L), the interrupt hasn't been registered yet the first time this executes. This results in an Error log entry reading:
E (1199) gpio: gpio_isr_handler_remove(576): GPIO isr service is not installed, call gpio_install_isr_service() first
---^^^^--- these numbers may vary -----^^^-- based on build / hardware.
Starting with develop at commit de6b23190a512ff578ed144cb4d06fb1128df5ae, I added some LOG_DEBUG() instrumentation to locate the relevant gpio_isr_handler_remove() call.
Within template <typename T> void SX126xInterface<T>::setStandby() is the call to disableInterrupt(), which in turn calls lora.clearDio1Action() in RadioLib, which eventually cascades to ESP-IDF ESP HAL gpio_isr_handler_remove().
I'm not clear on how one would pre-check for interrupt registration in a quiet manner to avoid the spurious disable attempt, but I figured this was worth capturing.
disableInterrupt() and enableInterrupt() are called frequently during routine radio operation, and I've only seen the error on the first instance, as noted above.
Relevant log output
INFO | ??:??:?? 1 numFreqSlots: 104 x 250.000kHz
INFO | ??:??:?? 1 channel_num: 45
INFO | ??:??:?? 1 frequency: 913.125000
INFO | ??:??:?? 1 Slot time: 12 msec, preamble time: 32 msec
INFO | ??:??:?? 1 Final Tx power: 20 dBm
INFO | ??:??:?? 1 SX126x init result 0
INFO | ??:??:?? 1 Frequency set to 913.125000
INFO | ??:??:?? 1 Bandwidth set to 250.000000
INFO | ??:??:?? 1 Power output set to 20
DEBUG | ??:??:?? 1 Current limit set to 140.000000
DEBUG | ??:??:?? 1 Current limit set result 0
DEBUG | ??:??:?? 1 Set DIO2 as RF switch, result: 0
DEBUG | ??:??:?? 1 SX126X_RXEN not defined, defaulting to RADIOLIB_NC
DEBUG | ??:??:?? 1 SX126X_TXEN not defined, defaulting to RADIOLIB_NC
DEBUG | ??:??:?? 1 Use MCU pin -1 as RXEN and pin -1 as TXEN to control RF switching
INFO | ??:??:?? 1 Set RX gain to boosted mode; result: 0
INFO | ??:??:?? 1 Applied SX1262 register 0x8B5 patch for RX improvement
DEBUG | ??:??:?? 1 Before calling lora.setCRC()
DEBUG | ??:??:?? 1 After calling lora.setCRC()
DEBUG | ??:??:?? 1 Before calling startReceive()
DEBUG | ??:??:?? 1 Entering setStandby()
DEBUG | ??:??:?? 1 Before calling disableInterrupt()
E (1199) gpio: gpio_isr_handler_remove(576): GPIO isr service is not installed, call gpio_install_isr_service() first
DEBUG | ??:??:?? 1 After calling disableInterrupt()
DEBUG | ??:??:?? 1 Exiting setStandby()
DEBUG | ??:??:?? 1 Before calling enableInterrupt()
DEBUG | ??:??:?? 1 After calling enableInterrupt()
DEBUG | ??:??:?? 1 After calling startReceive()
DEBUG | ??:??:?? 1 Exiting SX126xInterface<T>::init()
INFO | ??:??:?? 1 SX1262 init success, TCXO, Vref 3.000000V
@virtualjmills, Welcome to Meshtastic! :wave:
Thanks for opening your first issue. If it's helpful, an easy way to get logs is the "Open Serial Monitor" button on the Web Flasher.
If you have ideas for features, note that we often debate big ideas in the discussions tab first. This tracker tends to be for ideas that have community consensus and a clear implementation.
We're very active on discord, especially the #firmware and #alphanauts-testing channels. If you'll be around for a while, we'd love to see you there!
Welcome to the community! :heart:
SX126xInterface__DEBUG.cpp SX126xInterface.cpp
LOG_DEBUG() additions, for context on boot log output.
Built develop @ ad1dd14b6cd977dfcc1ab11cb112d7ce9cfedf52 ( after commit 80d16234e500ad9cfcf9e66393d2d3a0632e2cfd )
Verified error message reporting ( … gpio_isr_handler_remove(… ) no longer occurs on M5Stack Unit C6L (SX1262 based radio) during radio initialization.
Firmware prior to develop commit 80d16234e500ad9cfcf9e66393d2d3a0632e2cfd was able to reliably reproduce the error.
Addressed: • https://github.com/meshtastic/firmware/issues/11371 • https://github.com/meshtastic/firmware/pull/11386
Boot log snippet:
DEBUG | ??:??:?? 1 SX126xInterface(cs=23, irq=7, rst=-1, busy=19)
DEBUG | ??:??:?? 1 SX126X_DIO3_TCXO_VOLTAGE defined, DIO3 as TCXO Vref 3.000000 V
INFO | ??:??:?? 1 Start meshradio init
INFO | ??:??:?? 1 Using custom Coding Rate 8
INFO | ??:??:?? 1 Radio freq=913.125, config.lora.frequency_offset=0.000
INFO | ??:??:?? 1 Set radio: region=US, name=MediumFast, config=4, ch=44, power=22
INFO | ??:??:?? 1 newRegion->freqStart -> newRegion->freqEnd: 902.000000 -> 928.000000 (26.000000 MHz)
INFO | ??:??:?? 1 numFreqSlots: 104 x 250.000kHz
INFO | ??:??:?? 1 channel_num: 45
INFO | ??:??:?? 1 frequency: 913.125000
INFO | ??:??:?? 1 Slot time: 12 msec, preamble time: 32 msec
INFO | ??:??:?? 1 Final Tx power: 22 dBm
INFO | ??:??:?? 1 SX126x init result 0
INFO | ??:??:?? 1 Frequency set to 913.125000
INFO | ??:??:?? 1 Bandwidth set to 250.000000
INFO | ??:??:?? 1 Power output set to 22
DEBUG | ??:??:?? 1 Current limit set to 140.000000
DEBUG | ??:??:?? 1 Current limit set result 0
DEBUG | ??:??:?? 1 Set DIO2 as RF switch, result: 0
DEBUG | ??:??:?? 1 SX126X_RXEN not defined, default RADIOLIB_NC
DEBUG | ??:??:?? 1 SX126X_TXEN not defined, default RADIOLIB_NC
DEBUG | ??:??:?? 1 Use MCU pin -1 as RXEN, pin -1 as TXEN for RF switching
INFO | ??:??:?? 1 Set RX gain to boosted mode; result: 0
INFO | ??:??:?? 1 Applied SX1262 reg 0x8B5 RX patch
INFO | ??:??:?? 1 SX1262 init success, TCXO, Vref 3.000000V