STM32F4 UART NOT WORKING CORRECTLY
In the code I have written here, I am trying to send data from UART4 within the main function and simultaneously receive data through interrupts if data arrives. However, the data transmission part works for a very short time and then stops, and the data received from the interrupt is corrupted. I am providing the code from the main.c and stm32f4xx_it.c files below. Can you help me?
main.c:
#include "main.h"
#include "kibar_nextion.h"
#include <string.h>
uint8_t main_buffer[5];
uint8_t main_buffer1[8];
int main(void)
{
__HAL_UART_ENABLE_IT(&huart4, UART_IT_RXNE);
uint8_t last_data[] = {255, 255, 255};
while (1)
{
for(int i = 0; i < 360; i++) {
HAL_UART_Transmit(&huart4, (uint8_t*)"main_screen.z0.val=", 19, 100);
HAL_UART_Transmit(&huart4, (uint8_t*)kibar_return_array_char_from_32_t(i),
kibar_size_integer_data_32_t(i), 100);
HAL_UART_Transmit(&huart4, last_data, 3, 100);
}
}
}
stm32f4xx_it.c:
#include "main.h"
#include "stm32f4xx_it.h"
extern UART_HandleTypeDef huart4;
extern uint8_t main_buffer[5];
extern uint8_t main_buffer1[8];
void UART4_IRQHandler(void)
{
HAL_UART_Receive(&huart4, main_buffer, 5, 100);
HAL_UART_Receive(&huart4, main_buffer1, 8, 100);
HAL_UART_IRQHandler(&huart4);
}
