Hey guys,
So far I've been testing my BLE project by using Btool to control the USB dongle(loaded with CC2540_USB dongle_HostTestReleaseAll.hex). As I understand it, loading the USB dongle with the hostTestRelease file lets you control the dongle through a virtual COM port. So, I'd like to move away from Btool and write a labview vi to control it.
Before I do that though, I wanted to test it by trying to control it through a serial terminal program like tera term. So I open tera term and it recognizes the CC2540 as a COM port(COM port 3 on my PC). I setup the the serial port with the same parameters Btool uses. Now, I try to send it "01 00 FE 26 08 05 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00" which is the Gap_Device Init code that Btool first sends when you open it. But there is no response. Can anybody tell me why I'm not able to read anything back? Is it the string format? Do I need to send it an ASCII string? Will I need to include a new line terminate character?
I would really appreciate any help or suggestions.
regards,
V
Hi Vivek, you have several similar examples at the top rows of the forum, in the linux examples.
Can you give them a try and let us know?
Thanks! :)
Please click the Verify Answer button on a post if it answers your question! :)
I'm trying to do the same. I want to develop my own application on MATLAB to communicate with the usb dongle through HCI commands via a serial connection. Before doing that I tried using Realterm to send any command but I couldnt enter anything in the terminal. I've looked at the provided examples including those developed in Linux but couldn't find any clue why I dont get a response from the dongle. The only two applications that work are BTool and BleHealthDemo (which is based on BTool) . I looked at the BleHealthDemo code but didnt get any helpful hint.
I feel there is something has to be done to initialise the connection to the usb dongle under Windows 7. I looked at the JavaSimplePeripheral code and it seems it doesnt work on Windows 7. I wonder if anyone has managed to communicate with the dongle using applications other than BTool.
Regards
Ehad
Simple - just send "binary" bytes that correspond to a command that should have a response. Take the read board address command which is exactly 4 binary bytes but shown as hex: 0x01 0x09 0x10 0x00
Then you will recieve the 13 binary bytes of response.
I use Br@y Terminal to open port at 115200,8,N,1 & no flow control and can talk to this .hex image:
C:\Texas Instruments\BLE-CC254x-1.2.1 - Copy\Accessories\HexFiles\CC2540_USBdongle_HostTestRelease_All.hex
Thanks a lot, it's working now. I had to send and receive the data as ASCII characters in MATLAB. Here is a sample code for testing the serial communication with the USB dongle:
-------------------------------------------------------------------------------
clearclctry fclose(INSTRFIND);%closes all current portscatchends = serial('COM2');set(s,'BaudRate',115200,'Timeout',0.2,'FlowControl','none','Parity','none');
fopen(s);
GAP_initialise=['01';'00';'FE';'26';'08';'03';'00';'00';'00';'00';'00';'00';'00' '00';'00';'00';'00';'00';'00';'00';'00';'00';'00';'00';'00';'00' '00';'00';'00';'00';'00';'00';'00';'00';'00';'00';'00';'00';'01' '00';'00';'00'];dec=hex2dec(GAP_initialise);fwrite(s,char(dec)');[A,count] = fread(s,30);h=dec2hex(A);h_disp='';for i=1:length(h) h_disp=[h_disp h(i,:) ' '];endh_disp
---------------------------------------------------------------------------
Br@y Terminal has an great macro functionality - at the bottom left corner of the gui, press the 'Set Macros' button and for macro one, M1, enter the hex of the message you want to send. So to read the board address:
$01$09$10$00
Then just press M1 to send the binary 4 bytes.