stm32wb55 printf redirect not functional with WPAN debugging enabled
Struggling with an issue with the WB55. I'm attempting to see BLE stack debugging through the UART. I've tested the redirect without WPAN being enabled and found the hardware is functional. When I enable WPAN debugging, redirect function is never called.
main.c
int __io_putchar(int ch);
int __io_putchar(int ch)
{
/* e.g. write a character to the USART1 and Loop until the end of transmission */
HAL_UART_Transmit(&huart1, (uint8_t *)&ch, 1, 0xFFFF);
return ch;
} Setting up the debugging for WPAN has been done to setup guide:
MX_USART1_UART_Init() isn't called in the main() function but called in the DbgOutputInit() function:
/* USER CODE BEGIN APPE_Init_1 */
#ifdef DEBUG
DbgOutputInit();
#endif
/* USER CODE END APPE_Init_1 */I've verified the initialization code is being called:
void MX_USART1_UART_Init(void)
{
/* USER CODE BEGIN USART1_Init 0 */
/* USER CODE END USART1_Init 0 */
/* USER CODE BEGIN USART1_Init 1 */
/* USER CODE END USART1_Init 1 */
huart1.Instance = USART1;
huart1.Init.BaudRate = 115200;
huart1.Init.WordLength = UART_WORDLENGTH_8B;
huart1.Init.StopBits = UART_STOPBITS_1;
huart1.Init.Parity = UART_PARITY_NONE;
huart1.Init.Mode = UART_MODE_TX_RX;
huart1.Init.HwFlowCtl = UART_HWCONTROL_NONE;
huart1.Init.OverSampling = UART_OVERSAMPLING_8;
huart1.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE;
huart1.Init.ClockPrescaler = UART_PRESCALER_DIV1;
huart1.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT;
if (HAL_UART_Init(&huart1) != HAL_OK)
{
Error_Handler();
}
if (HAL_UARTEx_SetTxFifoThreshold(&huart1, UART_TXFIFO_THRESHOLD_1_8) != HAL_OK)
{
Error_Handler();
}
if (HAL_UARTEx_SetRxFifoThreshold(&huart1, UART_RXFIFO_THRESHOLD_1_8) != HAL_OK)
{
Error_Handler();
}
if (HAL_UARTEx_DisableFifoMode(&huart1) != HAL_OK)
{
Error_Handler();
}
/* USER CODE BEGIN USART1_Init 2 */
HAL_UART_Transmit(&huart1, "Start\r\n", 7, 0xff); // Works
printf("System Start\r\n"); // Does not work
/* USER CODE END USART1_Init 2 */
}Output is seen from the HAL_UART_Transmit() function but nothing from the printf call.
If I disable WPAN debugging, then printf does work.
So strange. Hoping that others might have seen this issue as well.