Project - Ya Bluetooth Module ( 2.0) driver

I just posted Ya Bluetooth Module ( 2.0) driver on Codeshare. Feel free to discuss and make suggestions here.


Sorry, found the first bug. I saw the malfunction on spider mainboard when using ReadMode_ByteArray and FastReadMode when the data could not be processed fast enough in the eventhandler and queued up. The bug resulted in corrupted data.
Edit: Should work now in Version 2

Thanks very much for sharing this. Seeing this inspired me to try my Bluetooth module that I recently received but have not yet tried. I will definitely try out your drivers.

Testing the latest version of this with the GHI BT module on a FEZ Spider. Using NETMF/Gadgeteer 4.3, and VS2012, and I’m on Windows 8.1 Pro.

I’m able to get the BT module to pair successfully, and the first time I run the project after pairing, I can connect via a terminal app to either COM9 or COM10 (seems to vary which one is actually used for serial communication). Once connected, I can both send and receive data via that serial port.

If I leave the Spider and BT module running, and disconnect the terminal app, I can then reopen the terminal app and reconnect to the COM port and communication resumes normally. Watching in the modern control panel’s “Manage Bluetooth devices” window, I can see the BT connect and disconnect when I connect or disconnect the terminal app.

However, if I reset the board, and attempt to connect again, I am unable to connect on the previously active COM port. I can usually connect to the other COM port that shows up in Device Manager (for me, it’s always COM9 and COM10), but no communication takes place.

I don’t think this is necessarily a problem with the BT module, however, as I can use the BT driver from: Pano Head/Coding4Fun Pano Head/Bluetooth.cs

and with that code, the module seems to connect and disconnect consistently even if I reset the board. Unfortunately, with that driver, the data I receive from the terminal app isn’t what I type. I just see a bunch of special characters, rather than the text I’m typing.

Any suggestions would be welcome, as I’m getting pretty frustrated with this module. Should be MUCH easier than this.

UPDATE: Naturally, the minute I post this, I tried the other BT driver again, and it seems to be working now. Sigh. But at least that’s progress.

I am not in possession of my BT module at the moment to test / confirm, but can you clear up what code you use/replace? Are you replacing RoSchmi’s driver with the pano head code, and that works better ?

Can you also confirm what the BT pairing state LEDs are in the different scenarios and drivers. In my previous tweaks of the original BT driver I found the state was critical in those two COM ports opening up on the PC side.

Oh, and now I notice you added an edit. Great ! :slight_smile:

@ Brett - I was having difficulty with @ RoSchmi’s driver, in that I cannot seem to get it to reconnect after a restart without removing/re-pairing.

The BT driver from the pano head project seems to be working fine at the moment, though I was getting garbage data from it on my earlier (today) attempt. Perhaps the BT module was in some kind of incorrect state, and switching to the other driver, and then back again cleared that issue.

So, until I run into another problem, I seem to be in good shape. :slight_smile: