The driver presents a single channel space of GPIOTE_CHANNELS entries across the application core's two GPIOTE peripherals, and splits it: inst = (channel < GPIOTE_PER_CHANNEL) ? 0 : 1; rchan = (inst == 1) ? channel : (channel - GPIOTE_PER_CHANNEL); rchan is the channel index within the selected instance, used to build the per-channel register offsets, so it must be rchan = channel - GPIOTE_PER_CHANNEL * inst The ternary has the two arms the other way round: a channel on instance 0 gets rchan = channel - GPIOTE_PER_CHANNEL, which is negative, and a channel on instance 1 gets an index still offset by a full instance. The interrupt handler in this same file already applies that mapping in the opposite direction, converting a per-instance channel back to the global one: off = i + GPIOTE_PER_CHANNEL * inst; so the two were inconsistent, and it is the rchan sites that were wrong. Per the nRF5340 Product Specification, 'GPIOTE - GPIO tasks and events', the application core has two GPIOTE instances, GPIOTE0 (secure, base 0x5000D000) and GPIOTE1 (non-secure, base 0x4002F000), each with eight channels and its own CONFIG[n] array at offset 0x510 + 4n for n = 0..7. This matches GPIOTE_PER_CHANNEL == 8, the two base addresses in hardware/nrf53_memorymap_cpuapp.h, and NRF53_GPIOTE_CONFIG_OFFSET() in hardware/nrf53_gpiote.h, so rchan is required to be in 0..7 and a negative value cannot address a CONFIG register. With a negative rchan the CONFIG register write for a channel on instance 0 lands below the instance base instead of in CONFIG[n], so the channel is never configured and its GPIOTE interrupt is never enabled. On nrf5340-dk this makes the board buttons dead. Both call sites are corrected. Signed-off-by: AlmAck <gluca86@gmail.com> |
||
|---|---|---|
| .github | ||
| arch | ||
| audio | ||
| binfmt | ||
| boards | ||
| cmake | ||
| crypto | ||
| Documentation | ||
| drivers | ||
| dummy | ||
| fs | ||
| graphics | ||
| include | ||
| libs | ||
| mm | ||
| net | ||
| openamp | ||
| pass1 | ||
| sched | ||
| syscall | ||
| tools | ||
| video | ||
| wireless | ||
| .asf.yaml | ||
| .codespell-ignore-lines | ||
| .codespellrc | ||
| .editorconfig | ||
| .gitignore | ||
| .gitmessage | ||
| .pre-commit-config.yaml | ||
| .yamllint | ||
| AUTHORS | ||
| CMakeLists.txt | ||
| CONTRIBUTING.md | ||
| INVIOLABLES.md | ||
| Kconfig | ||
| LICENSE | ||
| Makefile | ||
| NOTICE | ||
| README.md | ||
| ReleaseNotes | ||
Apache NuttX is a real-time operating system (RTOS) with an emphasis on standards compliance and small footprint. Scalable from 8-bit to 64-bit microcontroller environments, the primary governing standards in NuttX are POSIX and ANSI standards. Additional standard APIs from Unix and other common RTOSs (such as VxWorks) are adopted for functionality not available under these standards, or for functionality that is not appropriate for deeply-embedded environments (such as fork()).
For brevity, many parts of the documentation will refer to Apache NuttX as simply NuttX.
Getting Started
First time on NuttX? Read the Getting Started guide! If you don't have a board available, NuttX has its own simulator that you can run on terminal.
Documentation
You can find the current NuttX documentation on the Documentation Page.
Alternatively, you can build the documentation yourself by following the Documentation Build Instructions.
The old NuttX documentation is still available in the Apache wiki.
Supported Boards
NuttX supports a wide variety of platforms. See the full list on the Supported Platforms page.
Contributing
If you wish to contribute to the NuttX project, read the Contributing guidelines for information on Git usage, coding standard, workflow and the NuttX principles.
License
The code in this repository is under either the Apache 2 license, or a license compatible with the Apache 2 license. See the License Page for more information.