Error Transmitting data via UART when using ADC & DMA (works separately)
Hi All,
I have been a little confused about my code and would appreciate some help greatly...
I have a basic program where I would like to read the ADC values from a sensor, and transmit them via UART for later signal processing and whatnot.
The structure is simple, and when I tested out reading the values from the ADC, as well as sending strings via UART - they both work perfectly fine. But now when I merge the two, the UART does not work anymore... I do not see anything in my serial monitor (Putty)
I feel like I am missing something big, but cannot find it. I would appreciate it if someone pointed me in the right direction :)
in my main, I have:
uint32_t value[2]; // start adc in DMA mode
int isSent = 1;
uint8_t tx_buffer[] = "Welcome to BinaryUpdates!\n\r";
int main(void)
{
HAL_Init();
SystemClock_Config();
MX_GPIO_Init();
MX_DMA_Init();
MX_ADC1_Init();
MX_TIM3_Init();
MX_TIM4_Init();
MX_TIM2_Init();
MX_USART6_UART_Init();
HAL_ADC_Start_DMA(&hadc1, value, 2);
while (1)
{
if (isSent == 1)
{
HAL_UART_Transmit_DMA(&huart6, tx_buffer, 27);
// HAL_UART_Transmit_DMA(&huart6, value[0], sizeof(value[0]));
isSent = 0;
}
HAL_Delay(1000);
}
}void HAL_UART_TxCpltCallback(UART_HandleTypeDef *huart)
{
isSent = 1;
}
