Jump to content

Henrik Larsson

Members
  • Posts

    13
  • Joined

  • Last visited

Reputation Activity

  1. Like
    Henrik Larsson reacted to arox in No bluetooth with AP6212a under 4.11 Mainline   
    I suppose that some manufacturer spare money by not registring an address. Nanopi air should anyway have one.
     
    For my part, what I donnot understand is the 115200 in hciattach command : AP62XX is a serial module, and all BT traffic is routed in HCI over serial communication link. So how could someone reach 3 Mb/s of data rate over a 115200 b/s line ?!?. I always change this for 1500000. Otherwise an a2dp link drop packets for example.
     
    Another funny thing is the usage of 11:xx...etc or 43:xx...etc addresses. By default the system load a BNEP module, but dont try to configure a NAP acces point with that : it will try to use the address as an ethernet address in BNEP emulation - and fail with bad reporting because an address with an even first byte is illegal for Ethernet.
     
    I use a Nanopi neo 4.14.14 kernel with btusb dongle to create ppp/rfcomm links. I previously used a Nanopi air or a BPIM2+ 3.4.17 kernel for BNEP links. With nanopis or bpi I crash the kernel every other day. So did you achieve some stability with that ?
     
    Anyway, with BR/EDR mode and bluez, I need to reset the controller periodicaly because it became anable to create basic link (ACL) after some time when forming  multiple piconet. So I also experiment with BLE.
     
    I tested Bluepy - wich can handle "central" (but not peripheral) role in python. But I doubt to achieve stability and low latency in connected mode. So I am now developping my own trivial mesh protocol by advertising/scanning transmission with gatt/paypal in golang on RPI (and chip with some tweak in scan report demux) ...
     
    I didnt try bleno/noble. It seems to shunt BLUEZ insane routing through dbus/xml unstable/undocumented messaging API (as do also gatt/paypal) and handle itself the HCI interface. I am not sure about the difference in socket interface in both implementation ?
     
    I am not sure of the role of 4343A0.hcd or so files downloaded by hciattach. If this is the firmware for BT controller, there certainly is a lot of bugs in this and we need more robust version ?
  2. Like
    Henrik Larsson got a reaction from arox in No bluetooth with AP6212a under 4.11 Mainline   
    I had the same problem with NanoPi Neo Air and bluetooth as mantabernd
     
    hciconfig -a  didn't show any device
    and hciattach timed out:
    hciattach /dev/ttyS3 bcm43xx 115200 flow bdaddr 43:29:B1:55:01:01 bcm43xx_init Initialization timed out.  
    The other replies here by Larry Bank and thc013 helped me solve it. 
     
    uname -a Linux nanopiair 4.14.52-sunxi #581 SMP Fri Jun 29 10:05:07 UTC 2018 armv7l armv7l armv7l GNU/Linux  
    I first used armbian-config to install BT support.
    Then I edited the /boot/armbianEnv.txt to add uart3 overlay and param_uart3_rtscts=1 to enable rts and cts.
    Since I was unsure if it was supposed to be uart1 or uart3 I looked at the schematic here and saw it was connected tu uart3: http://wiki.friendlyarm.com/wiki/images/9/98/NanoPi-NEO-Air-1608-Schematic.pdf
    My armbianEnv.txt:
    verbosity=1 logo=disabled console=both disp_mode=1920x1080p60 overlay_prefix=sun8i-h3 param_uart3_rtscts=1 overlays=uart3 usbhost1 usbhost2 rootdev=UUID=91977eb8-39b7-4db4-ac8b-2eb075f6eef2 rootfstype=ext4 usbstoragequirks=0x2537:0x1066:u,0x2537:0x1068:u  
    Then I edited /etc/default/ap6212 to change from ttyS1 to ttyS3:
    # # Default it is called to be uncertain wich MAC address the chipset has. # Therefore it is recommendable to set the MAC address manually. # This can be done by setting the variable MAC_ADDR with a chosen value. # If this variable is empty or not set the default 11:22:33:44:55:66 will be chosen. MAC_ADDR=43:29:B1:55:01:01 # PORT=ttyS3  
    After a restart I run these commands:
    # rfkill unblock all # echo "0" > /sys/class/rfkill/rfkill0/state # echo "1" > /sys/class/rfkill/rfkill0/state # echo " " > /dev/ttyS3 # devmem2 0x1f00060 b 1 # echo 205 > /sys/class/gpio/export # echo out > /sys/class/gpio/gpio205/direction # echo 0 > /sys/class/gpio/gpio205/value # echo 1 > /sys/class/gpio/gpio205/value # hciattach /dev/ttyS3 bcm43xx 115200 flow bdaddr 43:29:B1:55:01:01 # hciconfig hci0 up From the schematic I found that BT_RST_N is connected to GPIOG13. I didn't find any documentation (anyone know where it is?) saying which gpio number GPIOG13 maps to but I found that GPIOG11 maps to 203 ( http://wiki.friendlyarm.com/wiki/index.php/NanoPi_NEO_Air ).
     
    After running above commands hciconfig -a returns this:
    # hciconfig -a hci0: Type: Primary Bus: UART BD Address: 43:29:B1:55:01:01 ACL MTU: 1021:8 SCO MTU: 64:1 UP RUNNING RX bytes:983 acl:0 sco:0 events:46 errors:0 TX bytes:2719 acl:0 sco:0 commands:46 errors:0 Features: 0xbf 0xfe 0xcf 0xfe 0xdb 0xff 0x7b 0x87 Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3 Link policy: RSWITCH SNIFF Link mode: SLAVE ACCEPT Name: 'nanopiair' Class: 0x000000 Service Classes: Unspecified Device Class: Miscellaneous, HCI Version: 4.0 (0x6) Revision: 0x6a LMP Version: 4.0 (0x6) Subversion: 0x2209 Manufacturer: Broadcom Corporation (15)  
    The last step will be to add the script to /etc/init.d/ap6212-bluetooth (same as above but with the variables for port and mac_option) :
    rfkill unblock all echo "0" > /sys/class/rfkill/rfkill0/state echo "1" > /sys/class/rfkill/rfkill0/state echo " " > /dev/$PORT devmem2 0x1f00060 b 1 echo 205 > /sys/class/gpio/export echo out > /sys/class/gpio/gpio205/direction echo 0 > /sys/class/gpio/gpio205/value echo 1 > /sys/class/gpio/gpio205/value sleep 0.1 hciattach /dev/$PORT bcm43xx 115200 flow bdaddr $MAC_OPTIONS hciconfig hci0 up  
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines