2021-03-04 12:38 AM
Hi,
I created a project in STM32CubeMX tool for USART1(Asynchronous) with DMA channels for both Tx and Rx. But in the UART initialization I do not see anything which indicates that DMA for this UART is enabled. There are two variables defined as follows
DMA_HandleTypeDef hdma_usart1_tx;
DMA_HandleTypeDef hdma_usart1_rx;
so in the UART initialization I used them as
huart1.hdmatx = &hdma_usart1_tx;
huart1.hdmarx = &hdma_usart1_rx;
So if I use HAL_UART_Transmit_DMA and HAL_UART_Receive_DMA functions then the contents of the structures hdma_usart1_tx and hdma_usart1_rx will be populated and the DMA mode should work, is that correct?
Also I wanted to know, In my application I need to set the priority of the Tx and Rx interrupts of UART need to be set to 10, and in HAL_NVIC_SetPriority() function there are two types of priorities, a preempt priority and a subpriority.
So I dont know what both these values have to be set to? I understand that the preempt priority needs to be 10 as per my requirement but what should be the subpriority??
Thanks