cancel
Showing results for 
Search instead for 
Did you mean: 

stm32 h747 uart8 hal_uart_init wrong

wjian.2
Associate II

If when i use hal_uart_init(&huart8) get result Details:HAL_ERROR Default:HAL_ERROR,Decimal:1,Hex:0x1,Binary:1,Octal:01.When i use step into ,reach at final while(sets-- !=0u)and no more what does this mean ? how could i solve this problem?

wjian2_0-1691841082867.png

 

static void MX_USART8_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 */
huart8.Instance = UART8;
huart8.Init.BaudRate = 115200;
huart8.Init.WordLength = UART_WORDLENGTH_8B;
huart8.Init.StopBits = UART_STOPBITS_1;
huart8.Init.Parity = UART_PARITY_NONE;
huart8.Init.Mode = UART_MODE_TX_RX;
huart8.Init.HwFlowCtl = UART_HWCONTROL_NONE;
huart8.Init.OverSampling = UART_OVERSAMPLING_16;
huart8.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE;
huart8.Init.ClockPrescaler = UART_PRESCALER_DIV1;
huart8.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT;

if (HAL_UART_Init(&huart8) != HAL_OK)
{
Error_Handler();
}

3 REPLIES 3
Pavel A.
Evangelist III

The GDB debugger is unable to step through SCB_EnableDCache and other SDB...Cache inline functions. This is a known issue, I don't know the exact reason. Just do not step into these functions, leave them alone.

This is not related to your UART problem. If in doubt, just do not enable the caches yet.

Are there other issues with your UART?

so what is the posible reason for hal_uart_init(&huart8) get HAL_ERROR?

All the source is available, review the exit paths.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..