cancel
Showing results for 
Search instead for 
Did you mean: 

Nucleo-L011K4 LPUART not working with some pin configurations

TFuch.1
Associate

Hello,

currently I'm trying to use the LPUART of the MCU using the LL drivers but I encountered an annoying issue.

In short:

LPUART1_TX = PB6

LPUART1_RX = PB7

-> Tx not working, pin always low; Rx fine

LPUART1_TX = PA1

LPUART1_RX = PB7

-> Everything working as it should

More details:

For project setup and development I use the STM32CubeIDE on Linux. On the forums I found an older entry that LL drivers don't enable the LPUART so Il had to set CR1->UE to 1.

Thus I managed to get Rx to work, yet Tx is not working on PB6 of my MCU. Changing Tx to PA1 in the device configuration tool and regenerating the code is making it work; But this is not the solution I want.

According to the schematics of the Nucleo board, PB6 is not used by anything. So I don't know if this is an issue with the MCU, Software or something else.

So if someone had prior experiences with such issues, I would be glad to hear from you.

Best regards,

Thorsten F.

PS: The generated code is below. CTS is currently grounded, but I don't think this is a problem since PA1 works.

void MX_LPUART1_UART_Init(void)
{
  LL_LPUART_InitTypeDef LPUART_InitStruct = {0};
 
  LL_GPIO_InitTypeDef GPIO_InitStruct = {0};
 
  /* Peripheral clock enable */
  LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_LPUART1);
  
  LL_IOP_GRP1_EnableClock(LL_IOP_GRP1_PERIPH_GPIOA);
  LL_IOP_GRP1_EnableClock(LL_IOP_GRP1_PERIPH_GPIOB);
  /**LPUART1 GPIO Configuration  
  PA6   ------> LPUART1_CTS
  PB6   ------> LPUART1_TX
  PB7   ------> LPUART1_RX 
  */
  GPIO_InitStruct.Pin = LL_GPIO_PIN_6;
  GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
  GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_VERY_HIGH;
  GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
  GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
  GPIO_InitStruct.Alternate = LL_GPIO_AF_4;
  LL_GPIO_Init(GPIOA, &GPIO_InitStruct);
 
  GPIO_InitStruct.Pin = LL_GPIO_PIN_6;
  GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
  GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_VERY_HIGH;
  GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
  GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
  GPIO_InitStruct.Alternate = LL_GPIO_AF_6;
  LL_GPIO_Init(GPIOB, &GPIO_InitStruct);
 
  GPIO_InitStruct.Pin = LL_GPIO_PIN_7;
  GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
  GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_VERY_HIGH;
  GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
  GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
  GPIO_InitStruct.Alternate = LL_GPIO_AF_6;
  LL_GPIO_Init(GPIOB, &GPIO_InitStruct);
 
  LPUART_InitStruct.BaudRate = 115200;
  LPUART_InitStruct.DataWidth = LL_LPUART_DATAWIDTH_8B;
  LPUART_InitStruct.StopBits = LL_LPUART_STOPBITS_1;
  LPUART_InitStruct.Parity = LL_LPUART_PARITY_NONE;
  LPUART_InitStruct.TransferDirection = LL_LPUART_DIRECTION_TX_RX;
  LPUART_InitStruct.HardwareFlowControl = LL_LPUART_HWCONTROL_CTS;
  LL_LPUART_Init(LPUART1, &LPUART_InitStruct);
}

0 REPLIES 0