-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
serial: uart_irq_tx_ready() needs better documentation or correction of the test #11535
Comments
I've tried to get this clarified from Nordic before. Why should the UART fifo be ready to receive bytes if TX interrupts are disabled? That makes no sense. The API specifies clearly that calling Out of curiosity, would ANY samples/tests relying on interrupt-driven UART currently not fail horribly with the current nRF implementation? |
@jarz-nordic or @Mierunski could you take a stab at this one please? |
Well the situation isn't as bad as I originally thought, I was under the impression that Nordic had misimplemented the API and then abandoned a broken implementation with the justification that "a new API is upcoming anyway". But it's not so bad. |
@tautologyclub : I apologize once more for being rude before. Now lets digg into your concerns. First:
According to old Zephyr UART API description function
Clearly. But there is no API function to check this readiness outside of interrupt context.
May you please elaborate a it more about that? What example? We are trying to fix all bugs as soon as possible. |
Yes, new API has been introduced to avoid future misunderstandings. |
@jarz-nordic You can call |
@tautologyclub : yes it is inconsistency. |
During a PR review, some confusion about the expected behavior of the
uart_irq_tx_ready
function popped out, see this comment and replies to it.Apparently, some existing Zephyr code expects this function to return
true
only when the TX interrupt is enabled (see for instance drivers/bluetooth/hci/h4.c or subsys/shell/shell_uart.c) and this function returningtrue
is even treated as an indication that some TX action should be done, while from reading the API description one can conclude that this only indicates that TX action is possible because "UART TX buffer can accept at least one character for transmission".Indeed, most of UART drivers implement this function in the way described above, but some exceptions seems to be also present (see uart_stm32.c). And the basic UART API test seems to also not follow this approach.
To avoid further confusion, it should be clarified what is the actually required behavior of the function.
The text was updated successfully, but these errors were encountered: