-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Fix NRF52840_DK UART driver and adapt FPGA test #12368
Conversation
It is required by Mbed HAL API to generate TxIrq interrupt when TXD register is empty (also after enabling TxIrq interrupt): https://github.com/ARMmbed/mbed-os/blob/f73a62afbf4052b4da8c5b862ffb4708a80c1b6e/hal/serial_api.h#L144-L147 The driver uses DMA to perform uart transfer and TxIrq is generated after the transfer is finished. While enabling TxIrq we will check if TXD reg is empty and manually trigger the interrupt.
…0_DK target According to the documentation, `NRF52840_DK` does not support odd parity and 2 stop bits. Skip these test case using #if !defined(TARGET_NRF52840) directive. This is temporary solution. In the future we shell consider adding `uart_get_capabilities()` function. -
@mprse, thank you for your changes. |
@0xc0170 Looks like something went wrong:
|
@mprse It is. I checked other tools jobs in Travis, they passed the same command. I restarted the subjob (if it does not help, will restart entire pipeline). One PR after this one passed Travis, so this was a hiccup somewhere in the CI. |
@@ -338,7 +338,9 @@ Case cases[] = { | |||
Case("38400, 8N1, FC off", one_peripheral<UARTNoFCPort, DefaultFormFactor, fpga_uart_test_common_no_fc<38400, 8, ParityNone, 1, false> >), | |||
Case("115200, 8N1, FC off", one_peripheral<UARTNoFCPort, DefaultFormFactor, fpga_uart_test_common_no_fc<115200, 8, ParityNone, 1, false> >), | |||
// stop bits | |||
#if !defined(TARGET_NRF52840) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i really don't like this per board exceptions. I'd rather have a macro defined in the target definition, something like UART_WHATEVER_NOT_SUPPORTED. It's way clearer and also gives you a clear answer to "why".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like I mentioned in the description I consider this as a temporary solution that should be replaced by get_capabilities()
function when @fkjagodzinski is back.
But using UART_WHATEVER_NOT_SUPPORTED
should be easy to change. I will do it later today.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
targets/targets.json
Outdated
@@ -8,7 +8,8 @@ | |||
"components": [ | |||
"PSA_SRV_IMPL", | |||
"PSA_SRV_EMUL", | |||
"NSPE" | |||
"NSPE", | |||
"FPGA_CI_TEST_SHIELD" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mprse adding this is intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch. 👍
I will remove this. I added this to be able to run FPGA tests and also added this to commit by mistake.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
ecf9ce1
to
8fda5a4
Compare
Pull request has been modified.
CI started |
Test run: SUCCESSSummary: 11 of 11 test jobs passed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this fix 👍
This PR does not contain release version label after merging. |
Summary of changes
The goal of this PR is to make
tests-mbed_hal_fpga_ci_test_shield-uart
passing onNRF52840_DK
.The test is failing because of the following reasons:
NRF52840_DK
uart driver does not use pooling mode instead for all transfers DMA/Interrupt mode is used. According to the requirements, we assume thatTxIrq
interrupt is triggered when TXD register is empty (also after enablingTxIrq
interrupt):mbed-os/hal/serial_api.h
Lines 144 to 147 in f73a62a
The driver fires interrupt when the whole DMA buffer is transmitted, but the interrupt is not fired after enabling the
TxIrq
interrupt when the TXD register is empty. To fix that we will trigger the interrupt manually.NRF52840_DK
does not support odd parity bit and 2 stop bits. This PR will skip these test cases using!defined(TARGET_NRF52840)
directive.This should be temporary solutions since we need a fast fix. But in my opinion, we should consider adding something like
uart_get_capabilities()
function and use it to skip the unsupported test case instead of!defined(TARGET_NRF52840)
directive. This requires discussion with @fkjagodzinski who is an author of the UART FPGA test and has wide knowledge about UART drivers and hardware limitations across different platforms.Test results:
Impact of changes
Migration actions required
Documentation
Pull request type
Test results
Reviewers
@jamesbeyond @maciejbocianski @0xc0170 @fkjagodzinski