boards/mps2-an521: Correct the swapped UART0 TX and RX interrupts#19538
Open
casaroli wants to merge 1 commit into
Open
boards/mps2-an521: Correct the swapped UART0 TX and RX interrupts#19538casaroli wants to merge 1 commit into
casaroli wants to merge 1 commit into
Conversation
The SSE-200 subsystem the AN521 image implements lists the UART interrupts receive first: UART0 RX is external interrupt 32 and UART0 TX is 33, which in NuttX numbering are 48 and 49. The configuration had those two the wrong way round, so the TX interrupt was dispatched to uart_cmsdk_rx_interrupt. That handler clears only UART_INTSTATUS_RX, so the asserted TX status bit survived the acknowledgement and the interrupt re-fired immediately. The board live-locked in the interrupt handler as soon as the console emitted its first character: the NSH banner appeared, and nothing ran afterwards, console input included. Note that the overflow interrupt already sits at 63, external 47, which is where the SSE-200 map puts it only if the pair below it is receive first -- the two corrected values are the ones consistent with it. mps2-an500 already follows the same order with RX at 16 and TX at 17. Assisted-by: Claude Code:claude-opus-5 Signed-off-by: Marco Casaroli <marco.casaroli@gmail.com>
acassis
approved these changes
Jul 25, 2026
Contributor
|
@anjiahao1 please review this patch. |
Contributor
Author
|
Table 7-1 : FPGA Expansion Interrupt Map. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
boards/arm/mps/mps2-an521/configs/nsh/defconfighasCONFIG_CMSDK_UART0_TX_IRQand
CONFIG_CMSDK_UART0_RX_IRQthe wrong way round.The SSE-200 subsystem the AN521 image implements lists the UART interrupts
receive first: UART0 RX is external interrupt 32 and UART0 TX is 33, which in
NuttX numbering are 48 and 49. The configuration had 49 for RX and 48 for TX, so
the TX interrupt was dispatched to
uart_cmsdk_rx_interrupt().That handler acknowledges only
UART_INTSTATUS_RX:so the asserted TX status bit survived the acknowledgement and the interrupt
re-fired immediately. The board live-locked in the interrupt handler as soon as
the console emitted its first character.
Two things corroborate the ordering rather than just the symptom:
47, which is where the SSE-200 map puts it only if the pair below it is
receive first;
mps2-an500already follows the same convention, RX at 16 and TX at 17.Impact
mps2-an521:nshonly. No source changes, no API or build changes, and no otherboard is touched.
Before this change the board is unusable at runtime under QEMU: the NSH greeting
appears and nothing runs afterwards, console input included. After it, NSH is
interactive. Anyone who has been building this configuration in CI would not
have noticed, since it was never run.
Testing
Host: macOS 15 (Darwin 25.5.0, arm64),
arm-none-eabi-gcc14.2.Rel1,QEMU 10.1.0. Board:
mps2-an521:nsh, run withBefore
The greeting is printed and the console is dead. Typing
helpproduces nothing;the run below sat for 30 s after the prompt:
Attaching gdb shows why. The board is in an interrupt entered from the very
first console write, and stays there:
Sampling repeatedly always lands in the same place, and with the earlier build
the frame below
exception_directisuart_cmsdk_rx_interrupt (irq=49, ...),which is the TX interrupt arriving at the RX handler.
After
The board reaches the idle loop and NSH is interactive.
helpwas driven over apty three times in a row and produced its output every time:
and a gdb sample now lands in the idle loop rather than in the handler:
Wider run
The same corrected interrupt numbers were used to run a full filesystem test
suite on this board to completion, 90 checks including power-loss injection
sweeps, over the NSH console:
The identical suite passes on
mps2-an500with its existing, already-correctinterrupt numbers, which is the cross-check that the two boards now agree.
tools/checkpatch.sh -g origin/master..HEADpasses.