STM32F4 is having problems with printf function in standallone mode
Hi!
I have STM32F469ZGT6 which is having problems with printf function.
If I connect debugger probe STLINK-V3SET all my code runs OK.
If I disconnect probe my code does not run at all. It does not even start to run.
After further investigation, I came to conclusion that my MCU does not like prinf.
So after I commented out all printfs from my code, everything started working in standalone mode (without connected probe).
Code was created with CubeMX, with KEIL toolchain.
I have stripped my code to bare bone which demonstrates the issue.
This is my main function:
….
#include "stdio.h"
…..
int main(void)
{
HAL_Init();
SystemClock_Config();
MX_GPIO_Init();
MX_USART6_UART_Init();
HAL_GPIO_WritePin(GPIOD, GPIO_PIN_4, GPIO_PIN_SET);
while (1)
{
printf("TEST_");
HAL_Delay(1000);
}
}
……
int fputc(int ch, FILE *f)
{
HAL_UART_Transmit(&huart6, (uint8_t *)&ch, 1, HAL_MAX_DELAY);
return ch;
}
This line of code:
HAL_GPIO_WritePin(GPIOD, GPIO_PIN_4, GPIO_PIN_SET);
…. turns on a LED on a PCB.
If MCU is running in standalone mode, LED is never lit. If I connect probe to MCU, LED gets lit and serial monitor sees test messages. If I comment out printf, LED is lit in standalone mode.
Huart6 is connected to STLINK-V3SET, which emulates VCP on PC. So, if probe is disconnected, there is no way of knowing whether serial traffic occurs. I only see LED is not lit.
Any suggestions what to do next?
