November 09, 2024, 05:09:18 AM

STM32-E407 FreeRTOS uart3 debug-printout

Started by olebenny, June 22, 2021, 05:07:53 PM

Previous topic - Next topic

olebenny

Hello Olimex
I am using Olimex-E407 with FreeRTOS and LWIP, and the LED-demo using LWIP-example is working great. I am now trying to do some debug-printout-text on uart3(boot-port), but it looks like garbage. I have connected a USB-ttl adapter too the boot pins, and I am using HAL_UART_Transmit() like this:

//Setup
/* USART3 init function */
static void MX_USART3_UART_Init(void)
{

  huart3.Instance = USART3;
  huart3.Init.BaudRate = 9600;
  huart3.Init.WordLength = UART_WORDLENGTH_8B;
  huart3.Init.StopBits = UART_STOPBITS_1;
  huart3.Init.Parity = UART_PARITY_NONE;
  huart3.Init.Mode = UART_MODE_TX_RX;
  huart3.Init.HwFlowCtl = UART_HWCONTROL_NONE;
  huart3.Init.OverSampling = UART_OVERSAMPLING_16;
  if (HAL_UART_Init(&huart3) != HAL_OK)
  {
    _Error_Handler(__FILE__, __LINE__);
  }

}

//Print
static void printMsg(char *msg, ...)
{
char buff[80];

va_list args;
va_start(args, msg);
vsprintf(buff, msg, args);

HAL_UART_Transmit(&huart3, (uint8_t*)buff, strlen(buff),HAL_MAX_DELAY);
}

'buff' seems to contain my string from 'vsprint', but the characters printed on my terminal-program looks wrong.
I have tried to connect Tx to Rx of my USB-ttl-cable, and then I see what I type on the keyboard.
I am running 115200 Baud , and changang baudrate to 9600 Baud shows same characters for the same string printed, so I does not seem to be baudrate mismatch.
I always see same pattern, for same string sent:
0123456789 --> ÀÃÄÇÈËÌÏðó;4 --> HEX: 0xC0 0xC3 0xC4 0xC7 0xC8 0xCB 0xCC 0xCF 0xF0 0xF3 0x3B 0x34

Best regards

olebenny