cancel
Showing results for 
Search instead for 
Did you mean: 

Serial callback not call after warm book on NUCLEO-L4A6ZG

phoddie
Associate

I'm using a NUCLEO-L4A6ZG board with the STM32L4A6ZG MCU. My project uses the microSD connector for serial communication with a computerThe microSD connector uses lpuart1. I use uart_irq_callback_user_data_set to install a callback for received data. This works perfectly from a cold boot (power disconnected). The callback is invoked as data is received. From a warm boot (reset without disconnecting power), the receive callback is never invoked. In this state, even though the receive callback is never called, the STM32L4A6ZG can still transmit data over lpuart1.

I changed the Device Tree to use uart3 instead (with an external serial-to-usb bridge). There are no code changes. That works perfectly every time – the receive callback is invoked after both cold and warm reboots.

Any suggestions?

2 REPLIES 2
Guenael Cadier
ST Employee

Hi @phoddie 
Could you check the content of the LPUART1 instance ISR register after warm reboot, to check if OVR bit is set ?
(if set, Overrun bit prevents further reception until it is cleared)

Hey @Guenael Cadier , thanks for the suggestion.

I tried this but the OVR bit is never set:

    #include <stm32l4a6xx.h>

    if (LPUART1->ISR & USART_ISR_ORE) {
        printk("LPUART1 OVR set, clearing...\n");
        LPUART1->ICR = USART_ICR_ORECF;
    }
    else
        printk("LPUART1 OVR CLEAR...\n");

I tried this as well, but there are no bytes read:

	printk("begin pollng\n");
	char c[2] = {0, 0};
	while (0 == uart_poll_in(uart_dev, c))
		printk("poll %s\n", c);
	printk("done polling\n");