Transmit multiple data using UART & FREE RTOS
Hi,
Iam using STM32 NUCLEO F401RE BOARD to send multiple data to PC using UART Printf.
I have created different tasks(4 tasks) for different computations and finally one dedicated task to send all the data computed to be sent via UART using Printf.
for example one task is running PWM & ADC, other task is using I2C, third task is using UART1.
The issue is that sending multiple data causes tasks to misbehave and not do the computations properly.
In all I have 8 integer values, 1 floating value. for example, when I try to send all this data using multiple printf commands , The task with ADC gives incorrect ADC sampled values.
When Iam not using printf command the tasks work properly , but I need to send all the data to PC via UART.
To use Printf , Iam using below code
#ifdef __GNUC__
#define PUTCHAR_PROTOTYPE int __io_putchar(int ch)
#else
#define PUTCHAR_PROTOTYPE int fputc(int ch, FILE *f)
#endif /* __GNUC__ */
PUTCHAR_PROTOTYPE
{
HAL_UART_Transmit(&huart2, (uint8_t *)&ch, 1, 0xFFFF);
return ch;
}
