How to configure two DMA channels (ADC and UART)
Hi I'm using STM32cubeIDE and I use two DMA channels,
DMA1_Channel1 is for ADC1 and DAM1_Channel5 is for USART1_rx.
USART1 is using for RS485 communication.
HAL_ADC_Start_DMA(&hadc1, &adcVal[0], 8);
HAL_UART_Receive_DMA(&huart1, &rxBuffer[0], DMA_RX_BUF_SIZE);
I used these two code to get the value from the communication and analogue date.
I can get the analogue value but I got the wrong value in communication.
static void MX_DMA_Init(void)
{
/* DMA controller clock enable */
__HAL_RCC_DMA1_CLK_ENABLE();
/* DMA interrupt init */
/* DMA1_Channel1_IRQn interrupt configuration */
HAL_NVIC_SetPriority(DMA1_Channel1_IRQn, 0, 0);
HAL_NVIC_EnableIRQ(DMA1_Channel1_IRQn);
/* DMA1_Channel5_IRQn interrupt configuration */
HAL_NVIC_SetPriority(DMA1_Channel5_IRQn, 0, 0);
HAL_NVIC_EnableIRQ(DMA1_Channel5_IRQn);
}
There are no priority set, and I heard that I have to configure the DMA channel and
according to the DMA channel I should have to save the value to that buffer.
How could I configure the channel and save the proper value to the adc_buffer and rx_buffer?