Skip to content
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

Mcux lpuart async fixes #79325

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

hakehuang
Copy link
Collaborator

@hakehuang hakehuang commented Oct 2, 2024

uart_async_api for NXP RT11xx series async testing failure, and after check the uart_mcux_lpuart.c, there are several issues found.
and the uart_async_api test need also some change to fit in DMA context.

fixes: #79323

@zephyrbot zephyrbot added area: UART Universal Asynchronous Receiver-Transmitter platform: NXP Drivers NXP Semiconductors, drivers labels Oct 2, 2024
@hakehuang
Copy link
Collaborator Author

hakehuang commented Oct 2, 2024

@EmilioCBen please help to review, this is a hidden issue after your fixes. Thanks.

test on mimxrt1170_evk/*/cm7

*** Booting Zephyr OS build v3.7.0-3804-g4d3f246abd65 ***
Running TESTSUITE uart_async_chain_read
===================================================================
E: No buffers to release from RX DMA!
E: No buffers to release from RX DMA!
START - test_chained_read
 PASS - test_chained_read in 0.426 seconds
===================================================================
TESTSUITE uart_async_chain_read succeeded
Running TESTSUITE uart_async_chain_write
===================================================================
E: No buffers to release from RX DMA!
START - test_chained_write
E: No buffers to release from RX DMA!
E: No buffers to release from RX DMA!
 PASS - test_chained_write in 0.009 seconds
===================================================================
TESTSUITE uart_async_chain_write succeeded
Running TESTSUITE uart_async_double_buf
===================================================================
E: No buffers to release from RX DMA!
START - test_double_buffer
 PASS - test_double_buffer in 3.397 seconds
===================================================================
TESTSUITE uart_async_double_buf succeeded
Running TESTSUITE uart_async_long_buf
===================================================================
E: No buffers to release from RX DMA!
START - test_long_buffers
 PASS - test_long_buffers in 0.162 seconds
===================================================================
TESTSUITE uart_async_long_buf succeeded
Running TESTSUITE uart_async_multi_rx
===================================================================
E: No buffers to release from RX DMA!
START - test_multiple_rx_enable
E: No buffers to release from RX DMA!
E: No buffers to release from RX DMA!
 PASS - test_multiple_rx_enable in 0.709 seconds
===================================================================
TESTSUITE uart_async_multi_rx succeeded
Running TESTSUITE uart_async_read_abort
===================================================================
E: No buffers to release from RX DMA!
START - test_read_abort
 PASS - test_read_abort in 1.120 seconds
===================================================================
TESTSUITE uart_async_read_abort succeeded
Running TESTSUITE uart_async_single_read
===================================================================
E: No buffers to release from RX DMA!
START - test_single_read
 PASS - test_single_read in 0.352 seconds
===================================================================
TESTSUITE uart_async_single_read succeeded
Running TESTSUITE uart_async_timeout
===================================================================
E: No buffers to release from RX DMA!
START - test_forever_timeout
E: No buffers to release from RX DMA!
E: No buffers to release from RX DMA!
 PASS - test_forever_timeout in 3.004 seconds
===================================================================
TESTSUITE uart_async_timeout succeeded
Running TESTSUITE uart_async_write_abort
===================================================================
E: No buffers to release from RX DMA!
START - test_write_abort
 PASS - test_write_abort in 0.102 seconds
===================================================================
TESTSUITE uart_async_write_abort succeeded

------ TESTSUITE SUMMARY START ------

SUITE PASS - 100.00% [uart_async_chain_read]: pass = 1, fail = 0, skip = 0, total = 1 duration = 0.426 seconds
 - PASS - [uart_async_chain_read.test_chained_read] duration = 0.426 seconds

SUITE PASS - 100.00% [uart_async_chain_write]: pass = 1, fail = 0, skip = 0, total = 1 duration = 0.009 seconds
 - PASS - [uart_async_chain_write.test_chained_write] duration = 0.009 seconds

SUITE PASS - 100.00% [uart_async_double_buf]: pass = 1, fail = 0, skip = 0, total = 1 duration = 3.397 seconds
 - PASS - [uart_async_double_buf.test_double_buffer] duration = 3.397 seconds

SUITE PASS - 100.00% [uart_async_long_buf]: pass = 1, fail = 0, skip = 0, total = 1 duration = 0.162 seconds
 - PASS - [uart_async_long_buf.test_long_buffers] duration = 0.162 seconds

SUITE PASS - 100.00% [uart_async_multi_rx]: pass = 1, fail = 0, skip = 0, total = 1 duration = 0.709 seconds
 - PASS - [uart_async_multi_rx.test_multiple_rx_enable] duration = 0.709 seconds

SUITE PASS - 100.00% [uart_async_read_abort]: pass = 1, fail = 0, skip = 0, total = 1 duration = 1.120 seconds
 - PASS - [uart_async_read_abort.test_read_abort] duration = 1.120 seconds

SUITE PASS - 100.00% [uart_async_single_read]: pass = 1, fail = 0, skip = 0, total = 1 duration = 0.352 seconds
 - PASS - [uart_async_single_read.test_single_read] duration = 0.352 seconds

SUITE PASS - 100.00% [uart_async_timeout]: pass = 1, fail = 0, skip = 0, total = 1 duration = 3.004 seconds
 - PASS - [uart_async_timeout.test_forever_timeout] duration = 3.004 seconds

SUITE PASS - 100.00% [uart_async_write_abort]: pass = 1, fail = 0, skip = 0, total = 1 duration = 0.102 seconds
 - PASS - [uart_async_write_abort.test_write_abort] duration = 0.102 seconds

------ TESTSUITE SUMMARY END ------

===================================================================
PROJECT EXECUTION SUCCESSFUL

1. optimized the logic for buffer usage in async api
2. skip timeout flush when the remaining counts is 0,
   as this will trigger dma_callback to process.
3. remove scatter mode, as we are not using this mode
4. trigger after dma_reload.

Signed-off-by: Hake Huang <[email protected]>
1. ensure the two dma buffers all aligned with 32 bits
2. clean the rx_data_idx at test begin

Signed-off-by: Hake Huang <[email protected]>
@@ -584,7 +585,7 @@ static void prepare_rx_dma_block_config(const struct device *dev)
head_block_config->dest_address = (uint32_t)rx_dma_params->buf;
head_block_config->source_address = LPUART_GetDataRegisterAddress(lpuart);
head_block_config->block_size = rx_dma_params->buf_len;
head_block_config->dest_scatter_en = true;
head_block_config->dest_scatter_en = false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this true for all calls to perpare_rx_dma_block_config,
can we verify that this does not break other sample/tests?

(uint32_t)data->async.next_rx_buffer,
data->async.next_rx_buffer_len);
rx_dma_params->buf = data->async.next_rx_buffer;
rx_dma_params->buf_len = data->async.next_rx_buffer_len;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand the logic of getting the next buffer this way, but is this not the responsibility of the hardware?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: UART Universal Asynchronous Receiver-Transmitter platform: NXP Drivers NXP Semiconductors, drivers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

tests: uart: uart_async_api: test failure on mimxrt1170/1160 /1180
5 participants