aanon4 / BlueBasic

BASIC interpreter for CC2540 and CC2541 Bluetooth LE chips
https://gitlab.com/timwilkinson/BlueBasic
97 stars 55 forks source link

Blue Basic IOS not connecting #10

Closed paulsponagl closed 9 years ago

paulsponagl commented 9 years ago

hi tim, now i had the chance to test with an ipad (ios 8) The HM-10 (in fact this seems to be a copycat - according to the HM-10 pdf) shows up as BASIC@DC, but no connection can be made - Connecting ... and nothing more ... I used the BLE Packet Sniffer from TI (with the USB Dongle) to get a better idea whats happening. Unfortunately i do not have an IAR EW (puh - the price is tough stuff) to try to debug the code itself... But may be you can read somethin out of the BLE Sniffer Log... up to [4] is the scan - the rest is the quick connection - disconnection ...

[1] : <Tx> - 10:25:57.023
-Type       : 0x01 (Command)
-Opcode     : 0xFE04 (GAP_DeviceDiscoveryRequest)
-Data Length    : 0x03 (3) byte(s)
 Mode       : 0x03 (All)
 ActiveScan : 0x01 (Enable)
 WhiteList      : 0x00 (Disable)
Dump(Tx):
01 04 FE 03 03 01 00 
------------------------------------------------------------------------------------------------------------------------
[2] : <Rx> - 10:25:57.038
-Type       : 0x04 (Event)
-EventCode  : 0xFF (HCI_LE_ExtEvent)
-Data Length    : 0x06 (6) bytes(s)
 Event      : 0x067F (GAP_HCI_ExtentionCommandStatus)
 Status     : 0x00 (Success)
 OpCode     : 0xFE04 (GAP_DeviceDiscoveryRequest)
 DataLength : 0x00 (0)
Dump(Rx):
04 FF 06 7F 06 00 04 FE 00 
------------------------------------------------------------------------------------------------------------------------
[3] : <Rx> - 10:25:57.647
-Type       : 0x04 (Event)
-EventCode  : 0xFF (HCI_LE_ExtEvent)
-Data Length    : 0x2C (44) bytes(s)
 Event      : 0x060D (GAP_DeviceInformation)
 Status     : 0x00 (Success)
 EventType  : 0x00 (Connectable Undirect Advertisement)
 AddrType   : 0x00 (Public)
 Addr       : 7C:66:9D:9A:72:DC
 Rssi       : 0xC5 (197)
 DataLength : 0x1F (31)
 Data       : 02:01:05:11:06:3A:A7:BD:64:0A:F7:A3:B5:8D:44:16:
          16:91:9E:FB:25:09:09:42:41:53:49:43:23:44:43
Dump(Rx):
04 FF 2C 0D 06 00 00 00 DC 72 9A 9D 66 7C C5 1F 
02 01 05 11 06 3A A7 BD 64 0A F7 A3 B5 8D 44 16 
16 91 9E FB 25 09 09 42 41 53 49 43 23 44 43 
------------------------------------------------------------------------------------------------------------------------
[4] : <Rx> - 10:26:07.303
-Type       : 0x04 (Event)
-EventCode  : 0xFF (HCI_LE_ExtEvent)
-Data Length    : 0x0C (12) bytes(s)
 Event      : 0x0601 (GAP_DeviceDiscoveryDone)
 Status     : 0x00 (Success)
 NumDevs    : 0x01 (1)
 Device #0
 EventType  : 0x00 (Connectable Undirect Advertisement)
 AddrType   : 0x00 (Public)
 Addr       : 7C:66:9D:9A:72:DC
Dump(Rx):
04 FF 0C 01 06 00 01 00 00 DC 72 9A 9D 66 7C 
------------------------------------------------------------------------------------------------------------------------
[5] : <Tx> - 10:26:12.575
-Type       : 0x01 (Command)
-Opcode     : 0xFE09 (GAP_EstablishLinkRequest)
-Data Length    : 0x09 (9) byte(s)
 HighDutyCycle  : 0x00 (Disable)
 WhiteList      : 0x00 (Disable)
 AddrTypePeer   : 0x00 (Public)
 PeerAddr       : DC:72:9A:9D:66:7C
Dump(Tx):
01 09 FE 09 00 00 00 DC 72 9A 9D 66 7C 
------------------------------------------------------------------------------------------------------------------------
[6] : <Rx> - 10:26:12.607
-Type       : 0x04 (Event)
-EventCode  : 0xFF (HCI_LE_ExtEvent)
-Data Length    : 0x06 (6) bytes(s)
 Event      : 0x067F (GAP_HCI_ExtentionCommandStatus)
 Status     : 0x00 (Success)
 OpCode     : 0xFE09 (GAP_EstablishLinkRequest)
 DataLength : 0x00 (0)
Dump(Rx):
04 FF 06 7F 06 00 09 FE 00 
------------------------------------------------------------------------------------------------------------------------
[7] : <Info> - 10:26:13.387
Device Connected
Handle = 0x0000
Addr Type = 0x00 (Public)
BDAddr = 7C:66:9D:9A:72:DC
------------------------------------------------------------------------------------------------------------------------
[8] : <Rx> - 10:26:13.387
-Type       : 0x04 (Event)
-EventCode  : 0xFF (HCI_LE_ExtEvent)
-Data Length    : 0x13 (19) bytes(s)
 Event      : 0x0605 (GAP_EstablishLink)
 Status     : 0x00 (Success)
 DevAddrType    : 0x00 (Public)
 DevAddr        : 7C:66:9D:9A:72:DC
 ConnHandle : 0x0000 (0)
 ConnInterval   : 0x0050 (80)
 ConnLatency    : 0x0000 (0)
 ConnTimeout    : 0x07D0 (2000)
 ClockAccuracy  : 0x00 (0)
Dump(Rx):
04 FF 13 05 06 00 00 DC 72 9A 9D 66 7C 00 00 50 
00 00 00 D0 07 00 
------------------------------------------------------------------------------------------------------------------------
[9] : <Info> - 10:26:13.932
Device Disconnected
Handle = 0x0000
Addr Type = 0x00 (Public)
BDAddr = 7C:66:9D:9A:72:DC
------------------------------------------------------------------------------------------------------------------------
[10] : <Rx> - 10:26:13.932
-Type       : 0x04 (Event)
-EventCode  : 0xFF (HCI_LE_ExtEvent)
-Data Length    : 0x06 (6) bytes(s)
 Event      : 0x0606 (GAP_TerminateLink)
 Status     : 0x00 (Success)
 ConnHandle : 0x0000 (0)
 Reason     : 0x3E (Failed To Establish)
Dump(Rx):
04 FF 06 06 06 00 00 00 3E 
------------------------------------------------------------------------------------------------------------------------
paulsponagl commented 9 years ago

btw. i testet the nov and dec hex files cc

paulsponagl commented 9 years ago

And another test with the NRF2739. (Using the nrf8001 is Plan B in case the BlueBasic is not working for me)

[08:57:09.8] Loading...
[08:57:10.6] Device address: 0x68D44DC3AE42
[08:57:19.2] Ready
[08:57:19.4] SERVER: Server has started
[08:58:11.4] Device discovery started
[08:58:24.2] Device discovery stopped
[08:58:27.6] ConnectToDevice()
[08:58:28.7] SERVER: Received packet <HciEvent: eventCode=0x05> - <HciEvent: eventCode=0x05>
[08:58:28.7] ----------------------------
[08:58:28.7] Connected to device
[08:58:28.7] Role: 0
[08:58:28.7] PeerAddressType: 0
[08:58:28.7] PeerAddress (MSB): 7C669D9A72DC
[08:58:28.7] Connection Interval: 20.0ms
[08:58:28.7] Connection Latency: 0
[08:58:28.7] Supervision Timeout: 3000ms
[08:58:28.7] Clock Accuracy: (1)
[08:58:28.7] ----------------------------
[08:58:28.7] Connected to 7C669D9A72DC
[08:58:28.8] Lost connection to device. Reason: BTLE_CONN_FAILED_TO_BE_ESTABLISHED
[08:58:28.8] SERVER: Received packet <HciEvent: eventCode=0x0A> - <HciEvent: eventCode=0x0A>
[08:58:28.8] SERVER: Received Link Loss
aanon4 commented 9 years ago

Well I've not heard of this problem before. Can you try connecting with a different BLE program. For example, can you try the LightBlue program from Punch Through Design (should be on the AppStore somewhere) and see how well, or not, it connects?

paulsponagl commented 9 years ago

i recieved the original HM-10 from fasttech and i am happy to say that the pairing works now. if you're interested i'll send you the copycat version to examination.