Bluetooth HC-05. CSR 4.0 + Windows 10. No dice. - Page 1
Forum section: electronics / projects

author: Buriedcode
author_rank: Super Contributor
timestamp: August 15, 2018, 01:27:23 pm
content: Hi,After years of wanting to add bluetooth connectivity to some projects I finally got around to buying a bluetooth dongle (one of those CSR 4.0 ones) and a HC-05 bluetooth module. The dongle works just fine - works with my DIY bluetooth speaker - that shows a pop-up in windows from the CSR harmony software. Audio streaming seems to work flawlessly.However, whilst I can pair the HC-05 module with my PC, I cannot open either of the ports it creates in device manager, nor can I connect to it in any way. I set the HC-05 in command mode and changed its name, password and baud (to 115200), so the module is definitely working, it responds to AT commands, and the host PC can see it for pairing - a windows 10 thing?Has anyone successfully opened the com ports/communicated with a HC-05 on windows 10? Since I'm using a CSR-based host adapter (which only works with CSR harmony software from 2012) I'm guessing it is either that or a windows 10 problem.

author: iMo
author_rank: Super Contributor
timestamp: August 15, 2018, 01:39:11 pm
content: https://forum.arduino.cc/index.php?topic=412958.0

author: Messtechniker
author_rank: Frequent Contributor
timestamp: August 15, 2018, 01:45:33 pm
content: http://www.collideabq.com/2016/04/28/bluetooth-serial-connection-with-windows-10/

author: Buriedcode
author_rank: Super Contributor
timestamp: August 15, 2018, 05:12:42 pm
content: Quote from: imo on August 15, 2018, 01:39:11 pmUnfortunately I don't have a broadcom chipset, and the only drivers for the CSR chipset are installed.Quote from: Messtechniker on August 15, 2018, 01:45:33 pmI think I came across that blog post whilst googling - I don't have the same options as he did (I think he has an older version of win10) and I can add as many com ports as I like to the bluetooth connection - none of them are accessible by any terminal program. I even wrote a test app in visual studio (C#) and just got the same error. I also tried toe bluetooth serial app - no com ports were available despite adding two (as well as the two it already assigned) to the device.I think the HC-05 and 06 actually connect to host once a host app opens its virtual comp port - as I cannot do that, it remains "unconnected" in the bluetooth options. It works well with my android phone - so it must be a windows problem

author: iMo
author_rank: Super Contributor
timestamp: August 15, 2018, 06:09:02 pm
content: Quote from: Buriedcode on August 15, 2018, 05:12:42 pmFrankly I doubt Win10 could have problems with CSR chipset. Uninstall the driver (remove the files if possible) and reboot, insert the BT dongle into the usb socket and watch what happens..

author: wasyoungonce
author_rank: Frequent Contributor
timestamp: August 16, 2018, 06:44:32 am
content: seen this befote....bt stack creates virtual ports and inwriting them windows dosnt write port values correctly sometimes givinga non null charater on the port number like com 05c. You can enter registery and edit the port value manually but each restart you will have the same issue . This has been happening since win xp and the way windows handles other mfgrs stack software.Sorry atm i cannot post links i'm on a hospital OSKB system .....do a serch for bt stack com port values in windows....somethin like that.

author: Buriedcode
author_rank: Super Contributor
timestamp: August 16, 2018, 04:22:37 pm
content: Quote from: wasyoungonce on August 16, 2018, 06:44:32 amNow this is interesting. The only oddity I found was a couple of terminal programs (I tried about 5) listed the two new com ports created for the bluetooth adapter simply as "COM" with no number.In device manager and most of the terminal programs it lists the com ports correctly as COM4 and COM5. This implies there is something dodgy about the ports labels, perhaps different terminal programs access the com port list from different parts of the registry.That's when I found this, based onwasyoungoncesuggestion:https://answers.microsoft.com/en-us/windows/forum/windows_10-hardware-winpc/bluetooth-stack-inserts-invalid-com-port-names/ff68fac4-62b0-4b3a-b83a-0c8b1712adf8Opening up the registry entries to edit - namely the COM port names - and closing them, I was able to open all the com ports, but only successfully send and receive data on the last one (that I added after pairing). The others I could open, but that didn't cause the bluetooth device to connect, which should happen. Before, I clicked on the devices icon in bluetooth "devices" and added another serial port, I assume one can add as many as you wish, and this seems to work, despite originally displaying the same behavior as the other ports (unable to connect). I'm going to restart to see if its magically "fixed" or if fiddling around in the registry actually did it.Edit, 5 minutes after post, after restart: Well I think I have a workaround. After a restart, all three (the original two created after pairing device and the extra one I added) are not accessible. In two of my terminal programs they are listed simply as COM without a number - hinting that there is some dodgy character/termination character in the registry, which prevents the ports from being used. I can make the third com port usable (and make it appear as COM7) just by opening up this reg key and clicking OK:Code:HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\SERIALCOMM\Device\CsrBtSerialxwhere x is a zero-based index, eg: 0,1,2 etc.. In my case it was CsrBtSerial2 - the com port I added, so it will be the last one in the list.As in the link above, it appears to look fine - they are listed as COM4, COM5 and COM7, but when read they don't return the numbers because the strings aren't terminated. Simply double clicking these entries to edit then closing (by clicking OK) correctly terminates the string.This doesn't work for the original two ports created, only subsequent ports added in bluetooth devices- I do not know why.So.. the workaround is: Add a third com port, make note of its number, and note that the two com ports added during pairing are essentially useless. Every time after a boot, go to above reg entry, open it and close it. You can now use that extra port you added for bluetooth communication. Requires this to be done after every boot. I might write a small script to automate this, so it just requires double clicking that every time I wish to use this HC-05. As the com port is fixed (once created it doesn't change number or disappear) I'll have to reserve COM7 for this purpose.So, not a fix really, but a workaround, and its all thanks towasyoungonce. Cheers

author: wasyoungonce
author_rank: Frequent Contributor
timestamp: August 17, 2018, 02:14:03 am
content: well done iindeed I have seen scripts tofix the issue...but if you do another post it up......this issue has been hapening since XP........'Struth"!Sorry for typos I hate OSKBs!

author: Buriedcode
author_rank: Super Contributor
timestamp: January 31, 2019, 12:34:34 pm
content: I know its an old topic, but I forgot to add my script to the thread as a final solution/workaround:Code:@ECHO OFFREG DELETE "HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\SERIALCOMM" /v "\Device\CsrBtSerial0" /fREG ADD "HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\SERIALCOMM" /v \Device\CsrBtSerial0 /t REG_SZ /d COM7 /fAll this does is rewrite COM7 to the appropriate entry. Its a BAT file that has to be run at startup, so you have to be admin to get windows to run it. It's a fudge, but is the only way I could get it working on my build of windows 10.

author: wasyoungonce
author_rank: Frequent Contributor
timestamp: January 31, 2019, 09:29:57 pm
content: Hi Buriedcode. Yeah just saw your post what a bummer by virtual com ports again. Jeez by win10 you would think things would be better MS has known since early XP.Well done I think I have some scripts for XP but like your BAT has to be run every time.