Read UART RX: how to add a handler?


#1

Hey guys,

I’m using UART to communicate with another device, I can write data but I don’t know how to read the data, I’m calling the function read(uart_fd, read_buf, size) after write when it supossed to be a response but it seems the data that I read is wrong.
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

How can I add a handler so when data is ready to be read I can call the function for reading it?
Hope you can help me, thanks!


#2

Hi
Did you manage to resolve this issue?

I am seeing similar issue - log (logread -f)

Jul  3 09:43:47 swi-mdm9x28 user.warn kernel: [  274.414076] irq 50, desc: cefdb000, depth: 0, count: 0, unhandled: 0
Jul  3 09:43:47 swi-mdm9x28 user.warn kernel: [  274.414112] ->handle_irq():  c025ac68, msm_gpio_irq_handler+0x0/0x150
Jul  3 09:43:47 swi-mdm9x28 user.warn kernel: [  274.414153] ->irq_data.chip(): c0ed0e68, gic_chip+0x0/0x74
Jul  3 09:43:47 swi-mdm9x28 user.warn kernel: [  274.414179] ->action():   (null)
Jul  3 09:43:47 swi-mdm9x28 user.warn kernel: [  274.414192]    IRQ_NOPROBE set
Jul  3 09:43:47 swi-mdm9x28 user.warn kernel: [  274.414204]  IRQ_NOREQUEST set
Jul  3 09:43:47 swi-mdm9x28 user.warn kernel: [  274.414215]   IRQ_NOTHREAD set
root@swi-mdm9x28:~# cm info
Device:                WP7607
IMEI:                  359779080100312
IMEISV:                4
FSN:                   VN737485171602
Firmware Version:      SWI9X07Y_02.16.02.00 000000 jenkins 2018/04/19 19:59:02
Bootloader Version:    SWI9X07Y_02.16.02.00 000000 jenkins 2018/04/19 19:59:02
MCU Version:           002.009
PRI Part Number (PN):  9907327
PRI Revision:          001.000
Carrier PRI Name:      GENERIC
Carrier PRI Revision:  002.032_000
SKU:                   1103511
Last Reset Cause:      Reset, User Requested
Resets Count:          Expected: 15     Unexpected: 4
root@swi-mdm9x28:~# legato version
18.03.0_b463e04cf08fb8d8f1ea5ee00d7894c0_modified

I haven’t yet checked which part of my app is causing this issue - the apps use I2C, UART2 and cellular data. The app is running ok but the system reboots every so often. Will a full log cause the reboot?


#3

I used the File Descriptor Monitor API:

https://docs.legato.io/latest/c_fdMonitor.html - has a serial port example

https://docs.legato.io/latest/le__fd_monitor_8h.html