AnsweredAssumed Answered

BlueNRG: what HCI Packet Protocol to use over SPI

Question asked by robitzki.torsten on May 5, 2015
Latest reply on May 11, 2015 by robitzki.torsten
the Bluetooth Core Specification defines how the different HCI Command, HCI ACL Data and HCI Events are transported over rs232, USB and 3 wire Uart. There is no definition for SPI and unfortunately I was not able to find a way, how the BlueNRG could differentiate between and HCI Command and HCI ACL Data. How are HCI Commands Packages transported (I don’t mean the framing as defined in Vol. 2 of the BL Spec. but as defined for Uart, USB, etc. in vol. 4 of the BL Spec)?

But first things first: I want to use only the HCI layer of the BlueNRG. I’ve tried to send the HCI_LE_Set_Event_Mask to the BlueNRG. First by sending a write header: 0x0A, 0x00, 0x00, 0x00, 0x00. Doing so in a loop until the BlueNRG response with a header with the SPI READY indication and a write buffer size > 0. This is what I get after a couple of loops : 0x02, 0x00, 0x06, 0x00, 0x00. So there is room for 0x600 Bytes. 

Now I send the HCI_LE_Set_Event_Mask command as following sequence: 0x01, 0x20, 0x08, 0xff, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00. And start to poll the SPI for a response, by sending a read header: 0x0B, 0x00, 0x00, 0x00, 0x00. Doing so in loop until the BlueNRG response with a header with SPI READY indication and a read buffer size > 0. And this loops for ever, as the read buffer remains zero. Event when the HCI Command is not correctly encoded, shouldn’t be there at least some kind of error response?

Are there any examples, that use pure HCI?

Thank you for every feedback,