Question
STM32F4 UART DMA
Hello all,
I have a project using UART DMA for receive datas from Nextion HMI. When i touch a button on Nextion Screen, data should be received a buffer via UART DMA.
First five hour it works good but after five hours no data flows. It is like the button doesnt work. I checked wire and other hardware stuff. They are all OK. It seems my code is wrong. Can anyone help to find where is the mistake? Shold i arrange flags?
Thanks in advance. You can find the code below.
void HAL_UARTEx_RxEventCallback(UART_HandleTypeDef *huart, uint16_t Size)
{
if(huart->Instance == USART3)
{
HAL_UARTEx_ReceiveToIdle_DMA(&huart3, rx_data_ekran, sizeof(rx_data_ekran));
__HAL_DMA_DISABLE_IT(&hdma_usart3_rx, DMA_IT_HT);
if(rx_data_ekran[2] == 2){ // ON-OFF button control
if((rx_data_ekran[3] == 0)) // ON-OFF IKB OFF
{
bIKB_On_manuel = false;
//NEXTION_SendNum("n1", 0);
}
else if((rx_data_ekran[3] == 1)) // IKB ON
{
bIKB_On_manuel = true;
//NEXTION_SendNum("n1", 1);
}
}
//
//
if(rx_data_ekran[2] == 3 && rx_data_ekran[3] == 1){ // Oto Mod Kontrol
bOtoModAktif_manuel = true;
bManuelModAktif_manuel = false;
bMod2= false;
}
else if(rx_data_ekran[2] == 47 && rx_data_ekran[3] == 1){ // Mod2 Kontrol
bMod2 = true;
bOtoModAktif_manuel = false;
bOtoModAktif_manuel = false;
}
}
}
