cancel
Showing results for 
Search instead for 
Did you mean: 

STM32WB5 BLE UART Not Working

VCasa.3
Associate II

Dear Sirs,

 

I have been developing an Application that runs in the STM32WB5 for a while, the BLE works fine, and it is integrated with a mobile app fine, but I need to communicate it with a coprocessor (STM32H750). For this mean, I would like to use UART (Asyncronous, 115200, 8 bit, no parity...) with DMA. My implementation looks like:

- One task registered in the Sequencer that runs this piece of code:

if (HAL_UART_Transmit_DMA(&huart1, &temp.data[0], temp.data_length) != HAL_OK)
{
	restoreElement(((app_context_t*)context)->sm_queue);
}
else
{
	uart1_tx_busy = 1;
}

The data and the data_length are correct, and stored in the global structure temp (so those are not flushed after the function finishes).

In addition to that, the HAL_UART_Transmit_DMA() returns HAL_OK and so the uart1_tx_busy flag is setted.

- The callback is called:

void HAL_UART_TxCpltCallback(UART_HandleTypeDef *UartHandle)
{
	if (UartHandle->Instance == USART1)
	{
		uart1_tx_busy = 0;
	}
}

and the uart1_tx_busy is reseted.

So up to here the SW seems good, and it works as expected, but the reality is that in the traces, measuring with an Oscilloscope, the lines are kept HIGH.

The configuration on the WB5:

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_16;
  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 */

  /* USER CODE END USART1_Init 2 */

}

The configuration on the H7:

void MX_USART3_UART_Init(void)
{

  /* USER CODE BEGIN USART3_Init 0 */

  /* USER CODE END USART3_Init 0 */

  /* USER CODE BEGIN USART3_Init 1 */

  /* USER CODE END USART3_Init 1 */
  huart3.Instance = USART3;
  huart3.Init.BaudRate = 115200;
  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;
  huart3.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE;
  huart3.Init.ClockPrescaler = UART_PRESCALER_DIV1;
  huart3.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT;
  if (HAL_UART_Init(&huart3) != HAL_OK)
  {
    Error_Handler();
  }
  if (HAL_UARTEx_SetTxFifoThreshold(&huart3, UART_TXFIFO_THRESHOLD_1_8) != HAL_OK)
  {
    Error_Handler();
  }
  if (HAL_UARTEx_SetRxFifoThreshold(&huart3, UART_RXFIFO_THRESHOLD_1_8) != HAL_OK)
  {
    Error_Handler();
  }
  if (HAL_UARTEx_DisableFifoMode(&huart3) != HAL_OK)
  {
    Error_Handler();
  }
  /* USER CODE BEGIN USART3_Init 2 */

  /* USER CODE END USART3_Init 2 */

}

 

The board is a custom board, and the wiring is:

On the WB5 side:

VCasa3_0-1748439898563.png

On the H7 side:

VCasa3_1-1748439920395.png

Conected:

VCasa3_2-1748439939283.png

 

I don't know how to proceed, I have been trying to debug this for a while, but no luck. Can you see something that is wrong?

 

Thank you so much,

Best regards

 

3 REPLIES 3
STTwo-32
ST Employee

Hello @VCasa.3 

I suggest you inspire from the BLE_AT_Server and try to inspire from it to implement the communication between the host MCU (STM32H7) and the STM32WB.

Best Regards.

STTwo-32

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Hi @STTwo-32,

 

Thank you so much for your answer. I have tried to follow the BLE_AT_Server example but got no luck yet.

 

Going through it, I saw that in the end we point to this:

VCasa3_0-1749492301240.png

That sends the data using the Blocking or IT APIs. I tried using them, but did not work either way.

Could you point me to something more specific, please?

 

Thank you,

Best regards

Hi, Can you please point me to a more specific solution?

I have also tried with the hw_uart of the STM32WPAN without luck.

 

Thank you,

Best Regards