cancel
Showing results for 
Search instead for 
Did you mean: 

No signal on LPUART1 TX Signal on NUCLEO-L476RG

Benjamin Brammer
Senior II

Hello Everybody,

i am trying to use LPUART1 on the NUCLEO board. I attsched an oscilloscope probe on the TX pin and tried to send a simple "Hello world\n". But I don't get any signal from the pin. The data is correct transmitted in TDR register.

Does anybody have a hint on what is wrong there?

Here is my LPUART init routine:

/* USER CODE BEGIN 0 */
uint8_t LPUARTBufferTx[] = "Hallo Welt\n";
 
/* USER CODE END 0 */
 
UART_HandleTypeDef hlpuart1;
 
/* LPUART1 init function */
 
void MX_LPUART1_UART_Init(void)
{
 
  hlpuart1.Instance = LPUART1;
  hlpuart1.Init.BaudRate = 9600;
  hlpuart1.Init.WordLength = UART_WORDLENGTH_8B;
  hlpuart1.Init.StopBits = UART_STOPBITS_1;
  hlpuart1.Init.Parity = UART_PARITY_NONE;
  hlpuart1.Init.Mode = UART_MODE_TX_RX;
  hlpuart1.Init.HwFlowCtl = UART_HWCONTROL_NONE;
  hlpuart1.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE;
  hlpuart1.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT;
  if (HAL_UART_Init(&hlpuart1) != HAL_OK)
  {
    Error_Handler();
  }
 
}
 
void HAL_UART_MspInit(UART_HandleTypeDef* uartHandle)
{
 
  GPIO_InitTypeDef GPIO_InitStruct = {0};
  if(uartHandle->Instance==LPUART1)
  {
  /* USER CODE BEGIN LPUART1_MspInit 0 */
 
  /* USER CODE END LPUART1_MspInit 0 */
    /* LPUART1 clock enable */
    __HAL_RCC_LPUART1_CLK_ENABLE();
  
    __HAL_RCC_GPIOC_CLK_ENABLE();
    /**LPUART1 GPIO Configuration    
    PC0     ------> LPUART1_RX
    PC1     ------> LPUART1_TX 
    */
    GPIO_InitStruct.Pin = GPIO_PIN_0|GPIO_PIN_1;
    GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
    GPIO_InitStruct.Pull = GPIO_NOPULL;
    GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
    GPIO_InitStruct.Alternate = GPIO_AF8_LPUART1;
    HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
 
  /* USER CODE BEGIN LPUART1_MspInit 1 */
 
  /* USER CODE END LPUART1_MspInit 1 */
  }
}

and this is the transmit call:

if(HAL_UART_Transmit(&hlpuart1, &LPUARTBufferTx[0], 11, 100) != HAL_OK)
{
	Error_Handler();
}

best regards

Benjamin

1 ACCEPTED SOLUTION

Accepted Solutions
Benjamin Brammer
Senior II

OK. found the problem. I have a custom pin header attached. For some reason it has no connection...the simple fault here :)

View solution in original post

1 REPLY 1
Benjamin Brammer
Senior II

OK. found the problem. I have a custom pin header attached. For some reason it has no connection...the simple fault here :)