btattach

hci/btattach flow:

  • bluez (bluetoothd service) is running
  • hciattach
  • hci0 interface appears
  • bluez is configuring it
    • NOTE: w/o blues try to call hciconfig hci0 up returns error: Can't init device hci0: Cannot assign requested address (99)
  • now possible put inteface up:
    • hciconfig hci0 up or
    • bluetoothctl – power on

EUNATCH (Protocol driver not attached)

Search tags:

  • EUNATCH (Protocol driver not attached)
  • Failed to get device id: Protocol driver not attached) = 54
  • No controller attached) = 23

Btattach is not working in 3wire aka H:5 mode.

# strace btattach -B /dev/ttymxc1 -S 1000000 -P 3wire
...
write(1, "Attaching Primary controller to "..., 45Attaching Primary controller to /dev/ttymxc1) = 45
openat(AT_FDCWD, "/dev/ttymxc1", O_RDWR|O_NOCTTY) = 4
ioctl(4, TCFLSH, TCIOFLUSH)             = 0
ioctl(4, TIOCGETD, [0])                 = 0
ioctl(4, SNDCTL_TMR_START or TCSETS, {c_iflag=, c_oflag=NL0|CR0|TAB0|BS0|VT0|FF0|, c_cflag=B1000000|CS8|CREAD|CLOCAL|CRTSCTS, c_lflag=, ...}) = 0
ioctl(4, TIOCSETD, [15])                = 0
write(1, "Switched line discipline from 0 "..., 38Switched line discipline from 0 to 15) = 38
ioctl(4, _IOC(_IOC_WRITE, 0x55, 0xcb, 0x4), 0x2) = 0
ioctl(4, _IOC(_IOC_WRITE, 0x55, 0xc8, 0x4), 0x2) = 0
ioctl(4, _IOC(_IOC_READ, 0x55, 0xca, 0x4), 0x2) = -1 EUNATCH (Protocol driver not attached)
...
write(5, "Failed to get device id: Protoco"..., 54Failed to get device id: Protocol driver not attached) = 54
...
write(2, "No controller attached\n", 23No controller attached) = 23

old hciattach works well !

strace hciattach -n /dev/ttymxc1 3wire 1000000 flow
  • -n Don't detach from controlling terminal.
openat(AT_FDCWD, "/dev/ttymxc1", O_RDWR|O_NOCTTY) = 3
ioctl(3, TCFLSH, TCIOFLUSH)             = 0
ioctl(3, TCGETS, {c_iflag=, c_oflag=NL0|CR0|TAB0|BS0|VT0|FF0|, c_cflag=B1000000|CS8|CREAD|CLOCAL, c_lflag=, ...}) = 0
ioctl(3, SNDCTL_TMR_START or TCSETS, {c_iflag=, c_oflag=NL0|CR0|TAB0|BS0|VT0|FF0|, c_cflag=B1000000|CS8|CREAD|CLOCAL|CRTSCTS, c_lflag=, ...}) = 0
ioctl(3, SNDCTL_TMR_START or TCSETS, {c_iflag=, c_oflag=NL0|CR0|TAB0|BS0|VT0|FF0|, c_cflag=B115200|CS8|CREAD|CLOCAL|CRTSCTS, c_lflag=, ...}) = 0
ioctl(3, TCFLSH, TCIOFLUSH)             = 0
ioctl(3, TCFLSH, TCIOFLUSH)             = 0
ioctl(3, SNDCTL_TMR_START or TCSETS, {c_iflag=, c_oflag=NL0|CR0|TAB0|BS0|VT0|FF0|, c_cflag=B1000000|CS8|CREAD|CLOCAL|CRTSCTS, c_lflag=, ...}) = 0
ioctl(3, TIOCSETD, [15])                = 0
ioctl(3, _IOC(_IOC_WRITE, 0x55, 0xc8, 0x4), 0x2) = 0
fstat(1, {st_mode=S_IFCHR|0600, st_rdev=makedev(0xcf, 0x13), ...}) = 0
ioctl(1, TCGETS, {c_iflag=ICRNL|IXON|IXOFF|IUTF8, c_oflag=NL0|CR0|TAB0|BS0|VT0|FF0|OPOST|ONLCR, c_cflag=B115200|CS8|CREAD|HUPCL|CLOCAL, c_lflag=ISIG|ICANON|ECHO|ECHOE|ECHOK|ECHOCTL|ECHOKE, ...}) = 0
...
write(1, "Device setup complete\n", 22Device setup complete) = 22

Headline

It is not working since 2017 :(

Issue was posted on mailing list but without any deep look from developer. Problem is not related to connected nrF52 device. It can be reproduced on any UART. Problem is during UART configuration before any data transmission!