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

how to use uart in both dma and int mode? #73

Open
Dandjinh opened this issue Apr 26, 2023 · 0 comments
Open

how to use uart in both dma and int mode? #73

Dandjinh opened this issue Apr 26, 2023 · 0 comments

Comments

@Dandjinh
Copy link

I wanna use DMA RX and RTO/RX END interrupt to get variable length data.

Code is like below

hosal_uart_init()
hosal_uart_callback_set(HOSAL_UART_RX_CALLBACK, _rx_callback)
hosal_uart_ioctl(HOSAL_UART_MODE_SET, HOSAL_UART_MODE_INT)

hosal_uart_ioctl(HOSAL_UART_DMA_RX_START)
... waiting rx int ...
rx_size = DMA_Channel_TranferSize(uart->dma_rx_chan)
hosal_dma_chan_stop(uart->dma_rx_chan)

// rx_size is always the same of config size in dma_config

The log shows rx int was triggered by UART_INT_RX_FIFO_REQ and the buffer dma was being used had nothing with incoming data.

Demo code project here,
bl_uart_test.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant