HC-06 bluetooth telemetry works, but not with GCS
« on: March 13, 2018, 02:59:12 am »
Trying to get a relay box working:
- Control: RC Tx -> 2.4ghz RF -> RC Rx -> PPM -> OpLink -> 433mhz RF -> Sparky2 in a quad
- Telemetry: Sparky2 telemetry -> 433mhz RF -> OpLink -> serial data -> Bluetooth module -> 2.4ghz RF -> Laptop running GCS

It flies.  Telemetry comes out of OpLink because I can connect an FTDI in place of the Bluetooth and that works OK.  The whole relay box works with dump command and terminal command as described below.  It also works for a very short time when I press Connect from GCS, but the HC-06 LED goes from blinking to solid and telemetry stops very quickly.  Press Disconnect / Connect in GCS and it works again for another very short time.

Linux Mint 18.x 64 bit
LP 16.09
Everything set as Data+Command
Everything set up at 57600 baud.
HC-06 bluetooth module (legacy?)  AT+VERSION says it is linvorV1.8
This is a 4 wire bluetooth module with unpopulated pins for Enable and Status.  I wonder if I need to tie Enable high/low.

I used these instructions to set up the HC-06 beginning at section: "HC-06 (ZG-B23090W): AT Commands".  This is the only set of commands that I found that work on this device:
http://www.martyncurrey.com/hc-06-zg-b23090w-bluetooth-2-0-edr-modules/

I set it up according to the LP wiki instructions:
https://librepilot.atlassian.net/wiki/spaces/LPDOC/pages/10354702/Setup+a+bluetooth+for+telemetry

I have connected the HC-06 to 5V power with no serial data and used miniterm.py to the RF device to verify that I can send AT commands and receive replies, so send / receive with the bluetooth RF works.

I have connected the HC-06 serial cable to an FTDI with the cable I use for OpLink and it works OK (AT commands and responses), so cable is good and HC-06 can send / receive on the serial cable.

I have connected an FTDI from the OpLink port where the telemetry comes out, to the PC, and connected the GCS with the FTDI device and it works OK, so OpLink telemetry is working.

The relay box works OK with the hd (hex dump) command, miniterm.py terminal emulator, etc.  I get continuous garbage dumped out.  But if I press Connect with GCS, it gets a packet or two through and then stops.  The HC-06 LED stops blinking (goes solid red).  Press GCS Disconnect and LED starts blinking again.  Press GCS Connect again and it works for one or two packets again.  The hd command is very stupid and does not know anything about bluetooth.  Is the GCS doing something that Bluetooth does not like that the simple hd command does not do?

I notice that the bluetoothctl connect command connects, but then disconnects soon after.