I want to use the dongle of the CY8CKIT-042-BLE development kit to communicate with a BLE device. This dongle is visible as a com-port on Windows. I have understood that you need to send HCI commands on this com port to communicate with the dongle and I am looking for a specification of these HCI commands. I assume that Cypress has defined it's own HCI commands (Vendor Specific) and also uses them in applications such as CySmart
The command/response sent over the COM port to communicate with Dongle is not HCI commands (as per BLE SIG). This is Cypress specific command structure that allows to talk to Dongle through a software tool over COM port.
Currently, we don't have such a document detailing these commands. We are working on getting one such out.
The UART you are seeing the the USB-UART bridge on the CySmart dongle (part of the KitProg on the dongle). It used by the firmware on the dongle (see the BLE_Dongle_CySmart example project , which should be under C:\Program Files (x86)\Cypress\CY8CKIT-042-BLE Kit\1.0\Firmware\BLE Dongle). This FW uses the BLE component in GATT client mode, and the UART for talking with the PC host. So its not a HCI interface.
You can always look at the source code for that project and figure out the commands - but it seems to be binary based protocol from a first glance.
You can configure the BLE component in your project in HCI mode . In HCI mode, the component exposes UART interface as HCI. Try this on kit instead on dongle, as you will need to interface UART pins externally.
Over this UART, you can send any BLE HCI command. All BLE HCI commands as defined in BLE spec are supported by the component.
For a project I have realized a serial communication (UART) with MATLAB to the Cypress BLE Dongle.
To determine the commands which has to be sent I have used the:
"Free Device Monitoring Studio" Download => http://freeserialanalyzer.com/features
You can use this tool to observe the communication between Cy-Smart and the BLE Dongle step by step.
The file: protocol.h (of the Dongle Firmware) contains some of the commands
Combining the results of this tool and the Cy-Smart log, you should be able to create your own application 🙂
The picture shows an example
According to previous posts, Psoc 4 BLE module should support HCI commands. I am using CY8CKIT-142 module and I am trying to attach it directly to linux (with bluez stack) via UART. I am using hciattach command on serial port, but when i do hciconfig up on module, it doesn't respond. Is it really possible to communicate with module like that? Maybe there is some pre-compiled hex (I am not sure I am programming module correctly...) that I can flash on module and use UART on some pins?
My aim is to use cypress BLE module directly with standard linux stack, so it would be my central BLE device.
Please ensure that the PSoC 4 BLE is programmed with the HCI enabled firmware. You can find one project as part of the CY8CKIT-042-BLE Kit content (http://www.cypress.com/CY8CKIT-042-BLE). Install the kit content and program the HEX file from location <installed_path>\Cypress\CY8CKIT-042-BLE Kit\1.0\Firmware\PSoC 4 BLE\Hex Files -> PSoC_4_BLE_DTM.hex using PSoC Programmer.
Refer section 4.6 of the Kit User guide for UART connection. The UG is at <installed_path>\Cypress\CY8CKIT-042-BLE Kit\1.0\Documentation. Baud rate set is 115200 bps.
Also, if you are not using hardware flow control, then ensure that RTS line on the PSoC 4 BLE module is left open and CTS line is grounded.
has there been any progress on the HCI documentation?
We are very interested in this as well since we need a host side which can interface with several BLE devices at the same time.
I was able to get the dongle (5677) to connect to a linux box (ubuntu 16.04) by programming the HCI_DTM project with a few changes:
Set Device to: CYBL11173-56LQXI
Set the pin assignments to P1.4 for \BLE:HAL_Uart:rx and P1.5 to \BLE:HAL_Uart:tx
Change baud rate inside BLE module to 1000000 (1M) [Clock dividers can't get close enough to 921600 to work well]
Once programmed, the device should attach as /dev/ttyACM0
Then from linux command line:
> hciattach ttyACM0 any 1000000 noflow
hciconfig should show that it is up and running. Using bluez 5.44
Then you can use hcitool or gatttool to test things out or bluepy to create a gatt client.
The other reason to set 1M rate is to try to take advantage of DLE (tx size of 251). However, there is where I see a problem. I am not able to get the max rates that are seen by CySmart with the DLE example and the default dongle image. Is there some limit in the HCI interface that may throttle the transfer rates? When I create a custom client I can get faster rates but still not the theoretical 700k+.
Any thoughts on how to go fast with HCI? Something in the bluez stack to change gap connection interval?
I seem to get the expected exchange on connection:
CYBLE_EVT_GATTS_XCNHG_MTU_REQ, final mtu= 512
CYBLE_EVT_GAP_DATA_LENGTH_CHANGE: maxTx: 251 , maxRx: 27
CYBLE_EVT_GAPC_CONNECTION_UPDATE_COMPLETE: 0, 6(7.50 ms), 0, 64