Closed bitabs closed 6 years ago
what are the UUIDs for the services?
These are the UUIDs @aj-ptw
@aj-ptw I've did some debugging, and this is where it seems to break Btw, the
[k.RFduinoUuidService
] = 2220:
And here's the console for the line 789:
@aj-ptw I'm thinking, why is my Cyton returning such huge UUID, whereas the UUID in the constant.js it is hardcoded. Do I need to do some configuration on the Arduino side?
Can you interrogate the RFDuino with a BLE application like Light Blue? Check out what services and characteristics the RFDuino is outputting.
@aj-ptw Ok so this is what I got from the application so far:
@aj-ptw
They seem to give out the same details as debugged in chrome @aj-ptw
Ok, I've found out the problem, but I don't know how to fix it. In other words, I don't know if this should be done from your side or my side.
When my device scans for devices like the RFduino, the services UUID format is different than that of the one set in constant.js. For example:
The uuid that I get is "00002220 00001000800000805f9b34fb" but in constant.js its set to:
RFduinoUuidService : "2220"
I tried to change the value of the uuid inside the
CytonBLE.prototype._nobleConnect = function (peripheral) {...}
But this throws
noble warning: unknown peripheral "CF:92:02:BC:0D:CE", 2220 characteristics discover
It would be really appreciated if you could help me figure this out. Currently, this problem only appears if I call the connect method.
Hmm I wonder why your service IDs and characteristics are so long. You cannot change the uuid's. I went as far to confirm with another driver i found written in Swift
Keep in mind you are searching for an RFDuino, not a Cyton.
Did you try running examples/cytonBLEServer/cytonBLEServer.js example?
The correct characteristic to use is the one in this photo
@aj-ptw Thank you for your work, really appreciated.
Since I get the same details as mentioned in the photo you attached, then what could be the problem? Quite confused now
Did you change the firmware on the RFDuino to Default radio?
I believe so yes @aj-ptw Do you want me to redo the steps that you mentioned? Just to make sure, there could be absolutely no problem with the Cyton board that came as product right? (of course. There isn't, It's OpenBCI after all 💯 ).
I'm betting I've done something wrong in the firmware setup. I'm gonna make my way to university today and will redo the step. Will update you @aj-ptw
@NaseebullahSafi we must figure out why your device is not advertising the correct UUIDs.
I tried to change the value of the uuid inside the
_nobleConnect
function
Can you elaborate on this comment above? What did you change them to? How many of them did you change? Show me a snippit of the code you modified.
I do not have the means to reprogram the RFDuino/Cyton I have on hand and won't till the end of the week to duplicate these problems, I apologize, I had to travel to another location this week out of the range of the OpenBCI lab.
I see,
So I haven't modified any code in Arduino. All I did, is added an if statement inside the OpenBCICytonBLE.js:
CytonBLE.prototype._nobleConnect = function (peripheral) {
return new Promise((resolve, reject) => {
if (this.isConnected()) return reject('already connected!');
this._peripheral = peripheral;
this._localName = peripheral.advertisement.localName;
if (this.options.verbose) console.log('Device is advertising \'' + this._peripheral.advertisement.localName + '\' service.');
// TODO: filter based on advertising name ie make sure we are looking for the right thing
//if (this.options.verbose) console.log("serviceUUID: " + this._peripheral.advertisement.serviceUuids);
this._peripheral.on(k.OBCINobleEmitterPeripheralConnect, () => {
// if (this.options.verbose) console.log("got connect event");
this._peripheral.discoverServices();
if (this.isSearching()) this._nobleScanStop();
});
this._peripheral.on(k.OBCINobleEmitterPeripheralDisconnect, () => {
if (this.options.verbose) console.log('Peripheral disconnected');
this._disconnected();
});
this._peripheral.on(k.OBCINobleEmitterPeripheralServicesDiscover, (services) => {
//console.log("insider 1: ", services, " checking: ", k.RFduinoUuidService);
for (let i = 0; i < services.length; i++) {
console.log("services[i].uuid: ", services[i].uuid, k.RFduinoUuidService);
// ======= Added my if{...} statement ======== \\
let testing = "";
if (services[i].uuid === '0000180000001000800000805f9b34fb') {
services[i].uuid = "1800";
testing = "1800"
} else if(services[i].uuid === "0000180100001000800000805f9b34fb") {
services[i].uuid = "1801";
testing = "1801"
} else {
services[i].uuid = "2220";
testing = "2220"
}
// ========= end of my addition ===========
// important!: since the UUID is different, this will never be true unless I do the if statement above
// This means if we can make our arduino return the right uuid, the below if statement will be true
if (services[i].uuid === k.RFduinoUuidService) {
this._rfduinoService = services[i];
// if (this.options.verbose) console.log("Found rfduino Service");
break;
}
}
if (!this._rfduinoService) {
reject('Couldn\'t find the rfduino service.');
}
...
That if statement all it does is check the UUID that I receive, and basically change it to what is in the conctant.js. This way I can bypass the error of getting null for this._rfduinoService
. Now the whole problem is in me receieving the UUID which is different than what you'd expect (2220
).
@aj-ptw
Hi there,
I'm trying to follow your undo step in the readme, and now its throwing this error. I've been stuck in this for 3 hours, any ideas?
@aj-ptw
I've tried following this step...Doesnt work:
You don’t have the correct firmware on possibly both RFDuinos, you need the host code on dongle and device code on Cyton RFDuino in order to do over the air uploading.
@aj-ptw Is there tutorial on how to do this?
@aj-ptw Ok so this is what I did for the dongle:
And this is what I did for the board:
I don't see what the problem is now?
Is there a way to reset everything and go back to factory state? If not, then I'd appreciate your help to fix this. I have no idea what to do, now BLE doesn't work, nor the board. I cant upload now. @aj-ptw
@NaseebullahSafi sorry you're having these troubles, I' assure you there is always a way to get the board back to it's default state.
Can you please use the GUI to see if your radio system is up? Tutorial here
You may try pressing the auto scan button as well to realign your radio channels. The Host and Device must be on the same channel, perhaps that's why you're getting the "No Target Found" error message.
You are following the tutorial for uploading radios code
It's ok, I'm learning at the same time. And I'm sorry for putting you through all this.
So I pressed the auto scan, and it says "Failure: system is down" @aj-ptw
Sounds like you did not upload the one of the RFDuino's firmware's correctly.
Did you upload RadioDevice32bit.ino code to the Device RFDuino on the Cyton?
Is the blue light on the dongle? Is the dongle running RadioHost32bit.ino code? Is the switch in GPIO6 position when you are hitting autoscan?
Did you upload RadioDevice32bit.ino code to the Device RFDuino on the Cyton?
Yes, I have done this.
Is the blue light on the dongle?
Yes
Is the dongle running RadioHost32bit.ino code?
Yes
Is the switch in GPIO6 position when you are hitting autoscan?
Yes
@aj-ptw
And the last step of your undo section in the READme is where I'm stuck.
Upload DefaultBoard.ino to the Cyton's Pic32 over the air following this tutorial
I cant do this part
You cannot do the last step in the tutorial until your radios are communicating together. The radio utility in the GUI must say Success: System is up in order for you to ever program the Cyton's Pic 32 microcontroller over the air
Do you get success messages when you upload the code to the RFDuino's?
@aj-ptw yes for both 2 steps:
Prints:
=======
Success!
=======
Did you upload RadioDevice32bit.ino code to the Device RFDuino on the Cyton?
For this, note that the switch in the dongle was on RESET, as suggested in tutorial @aj-ptw
I was typing a long instruction set but yea that's wrong if you kept the switch in the reset position. Upload the pass through code with switch in reset on dongle. flip switch to gpio6, upload radiodevice32bit to Device (cyton rfduino), flip switch on dongle to reset, upload RadioHost32bit to dongle, flip switch back to gpio6, done.
ok now that make sense. Im doing that again.
This is probably why your BLE adverstiment packets were all wrong, maybe not though, but I would make sure you uploaded the BLE code just incase this was the problem.
I really hope that is the case.
False hope is what keeps me going ;)
Ok,
for
I was typing a long instruction set but yea that's wrong if you kept the switch in the reset position. Upload the pass through code with switch in reset on dongle. flip switch to gpio6, upload radiodevice32bit to Device (cyton rfduino), flip switch on dongle to reset, upload RadioHost32bit to dongle, done.
I'm gonna now follow your last step. See if it works. BTW for step 3, it should switch to gpi06 right?
Oh my god! I think I'm in heaven:
Wow, so so far so good. I'm gonna now do the whole step for the BLE, and hope for success. @aj-ptw
@aj-ptw Ok So I did BLE enabling and the UUID's are still the same.I'm just gonna explain every step I took and you can tell me where I went wrong:
Upload BoardWithBLE.ino to the Cyton's Pic32 over the air following this tutorial => Plugged Dongle => switch to GPIO6 => Initiate Bootmode for the board => switch of Board at PC => Arduino 1.8.5 => examples => OpenBCI_32bit_Library => BoardWithBLE => Initiate upload
Upload DefaultRadio.ino to the Cyton's RFDuino through hardwire following this tutorial where you use the DefaultRadio.ino from OpenBCI_RFDuino_BLE. If you don't have an FTDI programmer and need to use the Dongle that shipped with your Cyton, then be sure to follow the part in the tutorial about uploading the pass through code to the Dongle. =>
git cloned
into [C:\Users\Nasee\Documents\Arduino\libraries
]() => OpenedArduino 1.5.8 Beta
=> examples => OpenBCI_Radios -> RadioPassThru32bit => Plugged Dongle => switch to Reset => Initiate upload => Switch to GPIO6 => OpenBCI_RFDuino_BLE -> DefaultRadio => Initiate upload => Switch to Reset => OpenBCI_Radios -> RadioHost32Bit => Initiate Upload
This successfully enabled BLE, and I could see it in my phone. I ran my app, and I still get the same UUIDs
I tried using a react native module to test the BLE, and here's what they returned:
I think my board is returning the correct service in this react module, but not long uuid in your module. I can't use their module because its only use for connectivity, whatI'd prefer is to use your approach and your module
What operating system are you using? What version of node?
Great write up btw, I’m on my way towards NYC and will test.
I'm using Windows 10 node version 8.9.4 npm version 5.6.0
@aj-ptw
Thank you AJ really appreciate your help. Just a heads up that you guys are doing a great job, I'm doing my final year project on OpenBCI + I've been asked to show a final app using Cyton to a big company. I shall hope we spread the word about this great product
Awesome I will duplicate with a little more help
What terminal program are you using to run the example program? power shell, cmd prompt, etc... What type of bluetooth low energy adapter do you have?
Thank you AJ really appreciate your help. Just a heads up that you guys are doing a great job, I'm doing my final year project on OpenBCI + I've been asked to show a final app using Cyton to a big company. I shall hope we spread the word about this great product
No problem, customer service is our number one value, learning how people want to interface with this and supporting them is in our core!
I'm using a terminal that comes with IntelliJ IDE.
I'm not sure what you mean by Bluetooth low energy adapter. I'm using Samsung s8 charger cable to connect to my laptop to run my app.
Currently Cyton dongle is connected to my PC, and I enable BLE from my Samsung s8
@aj-ptw
You computer has ble built in?
I always used the CSR dongle on windows with that node app...
Honestly I don't know, but seeing that the BLE works without me using an adapter, then I think it has. Let me confirm.
Yeh it has @aj-ptw
Hey did you use the zadig tool to update your windows drivers? This tutorial is for the ganglion, but it should be followed for you as well. You may try to using the Zadig tool to replace the driver for your Bluetooth comm port. This driver uses noble
which has it's own requirements for supporting windows.
I haven't actually. Let me try @aj-ptw
That could be an issue, I just tried uploading the Default radio to a cyton and got good UUID's:
Can you try running the same thing on Android, I have a feeling theres a difference from IOS @aj-ptw
Currently, when I call the connect method, it throws an error that services are null. Which is true because When I printed, this was shown:
Here's what I have:
Now the question is, why is the service null, and what should we do when it is null?
Update
The weird thing is, when I run it now, although the [
services
] exist, but the error still shows:And If I backtrack the error, it falls here: