Lora-net/picoGW_mcu

No response on first serial call

Closed this issue · 1 comments

When the first serial frame is send to the mcu it is always ignored and doesn't send an ACK or NACK back which locks lora_pkt_fwd (or any of the utils apps )in a forever loop.

if y send a 8 bytes right after opening the serial communication .

  int  bytes_written  = 0; 
  write(fd,write_buffer,sizeof(write_buffer));/

all next calls work fine .

strace from the issue :

execve("./util_chip_id", ["./util_chip_id", "-d", "/dev/loragw"], 0x7ffc1fdf20f0 /* 14 vars */) = 0
arch_prctl(ARCH_SET_FS, 0x7f8c0b67dd48) = 0
set_tid_address(0x7f8c0b67e31c)         = 1328
mprotect(0x7f8c0b67a000, 4096, PROT_READ) = 0
mprotect(0x56302091f000, 4096, PROT_READ) = 0
open("/dev/loragw", O_RDWR|O_NOCTTY|O_SYNC) = 3
ioctl(3, TCGETS, {B9600 opost isig icanon echo ...}) = 0
ioctl(3, SNDCTL_TMR_START or TCSETS, {B115200 -opost -isig -icanon -echo ...}) = 0
ioctl(3, TCGETS, {B115200 -opost -isig -icanon -echo ...}) = 0
ioctl(3, SNDCTL_TMR_START or TCSETS, {B115200 -opost -isig -icanon -echo ...}) = 0
write(3, "l\0\4\0\1\n\0\6", 8)          = 8
read(3, 0x7ffc21d36420, 4)              = ? ERESTARTSYS (To be restarted if SA_RESTART is set)
--- SIGINT {si_signo=SIGINT, si_code=SI_KERNEL} ---
+++ killed by SIGINT +++

strace after I send a dummy 8 bytes first:

execve("./util_chip_id", ["./util_chip_id", "-d", "/dev/loragw"], 0x7ffcd8be3260 /* 14 vars */) = 0
arch_prctl(ARCH_SET_FS, 0x7fc1dbf96d48) = 0
set_tid_address(0x7fc1dbf9731c)         = 1332
mprotect(0x7fc1dbf93000, 4096, PROT_READ) = 0
mprotect(0x55eaa8074000, 4096, PROT_READ) = 0
open("/dev/loragw", O_RDWR|O_NOCTTY|O_SYNC) = 3
ioctl(3, TCGETS, {B115200 -opost -isig -icanon -echo ...}) = 0
ioctl(3, SNDCTL_TMR_START or TCSETS, {B115200 -opost -isig -icanon -echo ...}) = 0
ioctl(3, TCGETS, {B115200 -opost -isig -icanon -echo ...}) = 0
ioctl(3, SNDCTL_TMR_START or TCSETS, {B115200 -opost -isig -icanon -echo ...}) = 0
write(3, "l\0\4\0\1\n\0\6", 8)          = 8
read(3, "l\0\10\1", 4)                  = 4
read(3, "3830E\0Y\0", 8)                = 8
write(3, "r\0\1\1\0", 5)                = 5
read(3, "r\0\1\1", 4)                   = 4
read(3, "g", 1)                         = 1
write(3, "w\0\1\0\0", 5)                = 5
read(3, "w\0\0\1", 4)                   = 4
write(3, "l\0\4\0\1\n\0\6", 8)          = 8
read(3, "l\0\10\1", 4)                  = 4
read(3, "3830E\0Y\0", 8)                = 8
ioctl(1, TIOCGWINSZ, {ws_row=0, ws_col=0, ws_xpixel=0, ws_ypixel=0}) = 0
writev(1, [{iov_base="3338333045005900", iov_len=16}, {iov_base="\n", iov_len=1}], 2) = 17
write(3, "m\0\0\0", 4)                  = 4
read(3, "m\0\0\1", 4)                   = 4
close(3)                                = 0
clock_nanosleep(CLOCK_MONOTONIC, 0, {tv_sec=1, tv_nsec=200000000}, 0x7ffcdf299ac0) = 0
exit_group(0)                           = ?
+++ exited with 0 +++

Same as #10