Problem with Reading UART

I’m using UART to communicate with another device, I can write data but problem in reading the data, I’m calling the function read(uart_fd, read_buf, size) but after some time it stops receiving data.
In the terminal I see:

irq 50, desc: cefcd780, depth: 0, count: 0, unhandled: 0
->handle_irq(): c026f6d4, msm_gpio_irq_handler+0x0/0x150
->irq_data.chip(): c0f4eb98, gic_chip+0x0/0x74
->action(): (null)
IRQ_NOPROBE set
IRQ_NOREQUEST set
IRQ_NOTHREAD set

Which module are you using ?
I remember in WP77 R8, the UART will go to sleep mode after some time.
Maybe you can have a try on R9 FW.
Or you can try using a timer to periodically wake up the UART;

#define TIMER_INTERVAL_SEC 1
#define TIMER_INTERVAL_uSEC 100000
int fd1;
static void tmrHandler(le_timer_Ref_t timerRef) {
//LE_INFO(“INSIDE TIMER”);
tcflow(fd1,TCION );

}
COMPONENT_INIT
{

	fd1=OpenPort("/dev/ttyHS0");



	le_clk_Time_t clk = { .sec = TIMER_INTERVAL_SEC, .usec = TIMER_INTERVAL_uSEC };
	    le_timer_Ref_t adxlPollingTimer = le_timer_Create("ADXL_TIMER");
	    le_timer_SetRepeat(adxlPollingTimer, 1000);
	    le_timer_SetInterval(adxlPollingTimer, clk);
	    le_timer_SetHandler(adxlPollingTimer, tmrHandler);
	    le_timer_Start(adxlPollingTimer);

Thanks It worked.
Earlier i tried at+ksleep=2 but did not work.
I was looking for method like this to keep uart awake.

You can also try the following command to disable the UART auto suspend behavior :

echo -1 > /sys/devices/78b0000.uart/power/autosuspend_delay_ms

2 Likes