cancel
Showing results for 
Search instead for 
Did you mean: 

NucleoL4R5ZI - Virtual COM PORT works and LPUART Tx(PG7) Works but Rx(PG8) Not working

Dinesh Rangaswamy
Associate II

Virtual COM port & LPUART Tx(PG7) Works fine, but LPUART Rx(PG8) is not working.

Tried in both Int & polling mode, able to send and receive via Virtual COM port.

Configuration:

static struct MCU_UART_S testIf_UARTStruct =

{

   .TxMode = KISO_HAL_TRANSFER_MODE_POLLING,

   .RxMode = KISO_HAL_TRANSFER_MODE_POLLING,

   .Datarate = 115200U,

   .huart.Instance = LPUART1,

   .huart.Init.BaudRate = 115200U,

   .huart.Init.WordLength = UART_WORDLENGTH_8B,

   .huart.Init.StopBits = UART_STOPBITS_1,

   .huart.Init.Parity = UART_PARITY_NONE,

   .huart.Init.Mode = UART_MODE_TX_RX,

   .huart.Init.HwFlowCtl = UART_HWCONTROL_NONE,

   .huart.Init.OverSampling = UART_OVERSAMPLING_16,

   .huart.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE,

   .huart.Init.ClockPrescaler = UART_PRESCALER_DIV1,

   .huart.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT,

};

Setup Code:

      __HAL_RCC_PWR_CLK_ENABLE();

      HAL_PWREx_EnableVddIO2();

      GPIO_InitTypeDef GPIO_InitStruct = { 0 };

      __LPUART1_CLK_ENABLE();

      __GPIOG_CLK_ENABLE();

      /* UART RX/TX GPIO pin configuration */

       GPIO_OpenClockGate(GPIO_PORT_G, PING_LPUART_TX | PING_LPUART_RX);

      GPIO_InitStruct.Pin      = PING_LPUART_TX | PING_LPUART_RX;

      GPIO_InitStruct.Mode     = GPIO_MODE_AF_PP;

      GPIO_InitStruct.Pull     = GPIO_NOPULL;

      GPIO_InitStruct.Speed    = GPIO_SPEED_HIGH;

      GPIO_InitStruct.Alternate = GPIO_AF8_LPUART1;

      HAL_GPIO_Init(GPIOG, &GPIO_InitStruct);

Read value in gState & RxState of uart handle both seems to be fine (no error codes). Both gState and RxState has value 32 (initialized state).

1 ACCEPTED SOLUTION

Accepted Solutions
Dinesh Rangaswamy
Associate II

Used USART3 with pin configurations PD8 and PD9 with GPIO_AF7_USART3, this works fine.

View solution in original post

1 REPLY 1
Dinesh Rangaswamy
Associate II

Used USART3 with pin configurations PD8 and PD9 with GPIO_AF7_USART3, this works fine.