2024-07-26 02:13 AM
I just started out a project with FreeRtos and followed this and managed to get it to work.
How to redirect the printf function to a UART for debug messages
I can also printF from the freertos.c StartXXXTask functions.
But one of the start task functions i call my own method in my custom .C file i can't seem to printF from it. Within that function i can run this and it works, but not printF.
HAL_UART_Transmit(&huart2, buf, strlen((char*)buf), HAL_MAX_DELAY);
Wondering what am I doing wrong?
Solved! Go to Solution.
2024-07-28 09:22 PM
Not sure what I did, but it's working now.
2024-07-26 02:23 AM
2024-07-26 02:56 AM
Apologies, that is my typo, it's not a custom wrapper.
It doesn't work as in no output. It compiles. Tried putting a HAL uart transmit before and after the printf statement, those work and I get output, just no output from printf.
2024-07-26 03:00 AM
Does FreeRTOS have separate streams for each Task? Or require each Task to setup its own printf redirection?
If so, that would be a FreeRTOS question - not specific to STM32 ...
https://www.freertos.org/Documentation/RTOS_book.html
https://www.freertos.org/RTOS-contact-and-support.html
2024-07-26 04:56 AM
I think I'm unable to answer that. I'm new to STM32, C and embedded. Only have background in web frontend JS.
2024-07-26 01:19 PM
Likely you haven't got the plumbing setup properly via _write() and __io_putchar()
Could try
char buf[64];
HAL_UART_Transmit(&huart2, (void *)buf, sprintf(buf, "%d\n", 123), HAL_MAX_DELAY);
2024-07-28 09:22 PM
Not sure what I did, but it's working now.