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

UART failure with CONFIG_UART_ASYNC_API #31711

Closed
eden-desta opened this issue Jan 27, 2021 · 13 comments
Closed

UART failure with CONFIG_UART_ASYNC_API #31711

eden-desta opened this issue Jan 27, 2021 · 13 comments
Assignees
Labels
area: UART Universal Asynchronous Receiver-Transmitter bug The issue is a bug, or the PR is fixing a bug platform: STM32 ST Micro STM32 priority: low Low impact/importance bug Waiting for response Waiting for author's response

Comments

@eden-desta
Copy link
Contributor

Hello!

So i started a very simple project with a NUCLEO_F746ZG. It essentially is responsible for connecting to a serial device and parsing its information. I wanted to use the buffer system in order to wait until the buffer was filled prior to throwing an event. With that I saw the async api configuration and decided to use it

In my prj.conf i have CONFIG_SERIAL = y and CONFIG_UART_ASYNC_API = y.
My actual main simply:

  1. Gets the device binding
  2. Ensures it was found
  3. disables RX
  4. calls uart_callback_set(device, callback, NULL)
    And this is where the failure occurs. This function returns a negative number, which only occurs if it is not supported.
    I took a look src code for uart_callback_set and it has a ifdef around a set of code that needs to run in order to do this. however, it fails to know that it is defined.

Not sure what to do next as it jumps to returning negative due to this failure.

Please let me know if there is something missing.

@eden-desta eden-desta added the bug The issue is a bug, or the PR is fixing a bug label Jan 27, 2021
@erwango erwango added the platform: STM32 ST Micro STM32 label Jan 27, 2021
@erwango erwango self-assigned this Jan 27, 2021
@erwango erwango added the area: UART Universal Asynchronous Receiver-Transmitter label Jan 27, 2021
@erwango
Copy link
Member

erwango commented Jan 27, 2021

@shlomow would you have time to have a look ?

@shlomow
Copy link
Contributor

shlomow commented Jan 27, 2021

@edesta-be did you set the dts bindings of the dma controller to okay? Please make sure that the async api is actually enabled using ninja menuconfig. In addition, the async api works only with dma. Please let me know if this solves the issue

@nashif nashif added the priority: low Low impact/importance bug label Jan 30, 2021
@erwango
Copy link
Member

erwango commented Feb 3, 2021

@edesta-be Could you have a check to the answer from @shlomow and provide feedback please ?

@eden-desta
Copy link
Contributor Author

I apologise! I did not see this! I will respond asap when I get to my setup!

my apologies and thank you for your time!

@erwango
Copy link
Member

erwango commented Feb 8, 2021

@edesta-be any news ? We're in the late stage of V2.5.0, and as a consequence we are tracking bug count.
So some feedback would be welcome

@eden-desta
Copy link
Contributor Author

Not yet I apologise, my team is backlogged on getting the parts back to me after having to do some retesting. So I have been unable to test.

@erwango
Copy link
Member

erwango commented Mar 3, 2021

@edesta-be can you have a try with #32607 ?

@FRASTM
Copy link
Collaborator

FRASTM commented Mar 3, 2021

When disabling the data stm32f7 data cache (with #32607) the test is passed on nucleo board. This only a workaround, that might show this is a pb with cache coherency on the stm32f7 when using DMA.
It seems that a similar approach based on the #27911 could help to clean and invalidate the data Cache when using the DMA for the UART async.
This test fails on Both NUCLEO_F746ZG and NUCLEO_F767ZI in the same manner.

@eden-desta
Copy link
Contributor Author

Hi @erwango!
Should I configure the dma as previously suggested or try again with my original setup of only enabling the a sync api via the configs?

@erwango
Copy link
Member

erwango commented Mar 3, 2021

@edesta-be First, please follow indications provided here: #31711 (comment)
Then also, you can add #32607 on top.

@FRASTM
Copy link
Collaborator

FRASTM commented Mar 3, 2021

I confirm that using a flush command on Tx and invalidate one on Rx, improves the test a lot

void uart_stm32_flush_cache(const void *ptr, uint32_t size)
{
	if ((SCB->CCR & SCB_CCR_DC_Msk) != 0U && size > 0) {
		SCB_CleanDCache_by_Addr((uint32_t *)ptr, size);
	}
}

void uart_stm32_invalidate_cache(void *ptr, uint32_t size)
{
	if ((SCB->CCR & SCB_CCR_DC_Msk) != 0U && size > 0) {
		SCB_InvalidateDCache_by_Addr((uint32_t *)ptr, size);
	}
}

@erwango
Copy link
Member

erwango commented Mar 31, 2021

@eden-desta Should we keep this ticket open ?

@erwango erwango added the Waiting for response Waiting for author's response label Apr 8, 2021
@erwango
Copy link
Member

erwango commented May 10, 2021

No feedback. Closing

@erwango erwango closed this as completed May 10, 2021
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 bug The issue is a bug, or the PR is fixing a bug platform: STM32 ST Micro STM32 priority: low Low impact/importance bug Waiting for response Waiting for author's response
Projects
None yet
Development

No branches or pull requests

5 participants