-
Notifications
You must be signed in to change notification settings - Fork 236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UART interrupt is not enabled #1147
Comments
You are absolutely right. However, the interrupt configuration is designed differently. Let's say you want to enable the UART's "RX FIFO not empty" interrupt by setting bit 22 of the control register: neorv32/sw/lib/include/neorv32_uart.h Line 65 in b3418fd
You should call up the UART setup function as follows: neorv32/sw/example/processor_check/main.c Line 1078 in b3418fd
So you need to pass the actual control register bit mask. I don't think the software documentation is really clear here though.... 🙈 Do you have any suggestions on how to improve this? Or should we change the way interrupts are passed/configured? |
Ah clear. Thanks for your quick response. However you do not shift the baudrate in the function call. My proposal to make it clear and unambiguous would be like this:
and in the uart setup
|
Right. That's just a number and not a bit mask.
That's a nice idea. However, the UART provides 5 individual interrupt sources (logically OR-ed). So we would need 5 binary arguments - one for each interrupt condition to be enabled or not. With so many arguments we cannot use plain registers to pass everathing to the function - the compiler will have to use the stack which slows things down and increases code size 🙈 (yes, I'm from the embedded world where each byte and each cycle counts 😅). However, maybe your proposal would make things much clearer... 🤔 |
Maybe the following will support the case to have the same approach to all functions ;) Both the timer and neoled module have a similar approach.
|
Describe the bug
Please see:
neorv32/sw/lib/source/neorv32_uart.c
Line 106 in b3418fd
As it is implemented right now the URT interrupt will never be enabled.
irq_mask will be assigned a 1. Doing a logic or of 1 (0x1) with 0x00400000 (0x1fU << UART_CTRL_IRQ_RX_NEMPTY) will never result in a 1 at position 22.
It should have been:
Environment:
OS:
GCC-Version native
GCC-Version RISCV
Hardware:
UART, GPTMR, TWI, DMA, GPIO, WDT, SPI, Extions C, M
The text was updated successfully, but these errors were encountered: