Hi,

On Sunday, 26 March 2017 18:23:52 CEST will sanfilippo wrote:
> Not sure what is going on there, but the command that you show is a BR/EDR
> command and not a LE command, which is why you get a unknownn HCI command.
> The controller does not support that command.

This is simply due to GATT library used by newtmgmr assumes that controller is 
dual mode. See snipped below:

func (h *HCI) resetDevice() error {
        seq := []cmd.CmdParam{
                cmd.Reset{},
                cmd.SetEventMask{EventMask: 0x3dbff807fffbffff},
                cmd.LESetEventMask{LEEventMask: 0x000000000000001F},
                cmd.WriteSimplePairingMode{SimplePairingMode: 1},
                cmd.WriteLEHostSupported{LESupportedHost: 1, 
SimultaneousLEHost: 0},
                cmd.WriteInquiryMode{InquiryMode: 2},
                cmd.WritePageScanType{PageScanType: 1},
                cmd.WriteInquiryScanType{ScanType: 1},
                cmd.WriteClassOfDevice{ClassOfDevice: [3]byte{0x40, 0x02, 
0x04}},
                cmd.WritePageTimeout{PageTimeout: 0x2000},
                cmd.WriteDefaultLinkPolicy{DefaultLinkPolicySettings: 0x5},
                cmd.HostBufferSize{
                        HostACLDataPacketLength:            0x1000,
                        HostSynchronousDataPacketLength:    0xff,
                        HostTotalNumACLDataPackets:         0x0014,
                        HostTotalNumSynchronousDataPackets: 0x000a},
                cmd.LESetScanParameters{
                        LEScanType:           0x01,   // [0x00]: passive, 0x01: 
active
                        LEScanInterval:       0x0010, // [0x10]: 0.625ms * 16
                        LEScanWindow:         0x0010, // [0x10]: 0.625ms * 16
                        OwnAddressType:       0x00,   // [0x00]: public, 0x01: 
random
                        ScanningFilterPolicy: 0x00,   // [0x00]: accept all, 
0x01: ignore 
non-white-listed.
                },
        }
        for _, s := range seq {
                if err := h.c.SendAndCheckResp(s, []byte{0x00}); err != nil {
                        return err
                }
        }
        return nil


For now I suggest using dualmode dongle (ie one from laptop or any stock USB 
BT dongle).


> > On Mar 26, 2017, at 12:45 AM, Lm Chew <lm.c...@free2move.se> wrote:
> > 
> > Hi Vipul,
> > 
> > Thanks, for the suggestion.
> > 
> > 1. changed to using:
> > sudo $(which newtmgr) -c ble image upload slinky.img -ldebug
> > 
> > 2. double checked, i have pulled the latest from develop branch and build
> > it. I have also updated blueZ to the latest 5.44 just in case.
> > 
> > 3. I have physically removed the bluetooth module installed in my laptop
> > to eliminate the complication, so now I got only hci0 available.
> > 
> > For some odd reason I was able to make 2 successful upload, but not
> > sequentially. Since then i can't get it to work again, could this be
> > something to do with USB bluetooth adapter could not get the timing
> > right?
> > 
> > Could you tell me what USB bluetooth adapter are you using?
> > 
> > I also tried setting up a nrf52 DK with blehci app + BlueZ as explained in
> > this tutorial(with a few changes). -
> > http://mynewt.apache.org/latest/os/tutorials/blehci_project/
> > - Use this to connect with btattach instead: sudo btattach -B /dev/ttyACM0
> > -S 1000000 -P h4 - Skip the btmgmt step since in BlueZ 5.44 we no longer
> > need to set the static-address manually and newtmgr will handle the rest.
> > - Used the nrf52 DK onboard USB to UART bridge, did not use a FTDI USB
> > TTL Serial Cable.
> > 
> > But unfortunately I can't get it to work either, in fact it is one step
> > backward.
> > 
> > When i tried sending:
> > sudo $(which newtmgr) -c ble image list -ldebug
> > 
> > I get stuck at:
> > 2017/03/26 15:22:57 [DEBUG] BLE Connection devaddr:[]
> > 2017/03/26 15:22:57 dev: hci0 up
> > 2017/03/26 15:22:57 dev: hci0 down
> > 2017/03/26 15:22:57 dev: hci0 opened
> > 2017/03/26 15:22:57 [DEBUG] State:PoweredOn
> > 2017/03/26 15:22:57 [DEBUG] scanning...
> > 
> > I have also attached the btmon response
> > 
> > I noticed this line in the btmon log that was highlighted in red in the 
terminal:
> > > HCI Event: Command Complete (0x0e) plen 4                   [hci0]
> > > 4309.724132> > 
> >       Write Simple Pairing Mode (0x03|0x0056) ncmd 1
> >       
> >         Status: Unknown HCI Command (0x01)
> > 

-- 
pozdrawiam
Szymon Janc

Reply via email to