Hi, dont know what your point is,but user_data2 needs the two uuid bytes (0x1c, 0x18) in the first two positions. Otherwise data is not returned
Well that's interesting - if I compile the Sketch (IDE 1.8.18) it fails on those bytes. I assume they are 'flags' specific to the XIAO then. Am I right in thinking you have a higher version IDE?
yeah, the latest, 2.3.2
I believe you need to read out each character of the advertisement and reverse the order?
yes, at least with my setup. all uiid's need to be correct.
Hi,
You may want to look at this-
I'm using Arduino with HM10 BLE (not the Nordic you are using) but having the same results (of return empty).
Same as you, other apps and utilities (Like the Nordic nRF Connect for Android) are receiving the data as expected.
At the moment I am testing with a transmit every second and I see that not every time the advertismentData is updated. sometimes it stops for 15 seconds or so, and then continues.
I does receive the message correctly every time
That is a worry.
with the ble app I see that the messages are send correctly, a test counter increments correctly
it is actually consequently 30 secs between updates.
Yet more research revealed that using the devicefound block as above, two things happen.
- When okay it show the correct string received. All is fine.
- But when not okay, the call AdvertiseAddress block returns empty. So it has found the mac address and the viax2 name, but no advertise data available?
The is a string prevents error messages for the empty data.
Anybody know how this could happen?
You may want to read the link I post here yesterday..
You can use AdvertaiserServicesUuid block and it will return the correct service UUID, but you can't get the DATA
Also, pay att. to the workaround I posted at the end of that post.
Beyond the current prototyping, what's the length of the data you want to send?
Is 4 byte long enough?
BTW, from your test2.ino the declaration of user_data2 is not clear:
char user_data2[2] = {0x16,0x180,0x41,0x42,0x43,0x44};
The length of the array defined as[2], thought it should be at least 6.
Hi Zivo, yes thanks I saw your post before, there are not so many postst about this problem.
But your solution did not work for me, but it led me to use the 2 byte uuid in there. S o thanks for that.
Your are right the array is wrong, was because I edited the code for this thread.
I have tried everything, I do think that there is a bugg in the library itself.
I am now about to give up, and use connected mode. It should be possible to connect, exchange data and disconnect quickly.
To make it clear, this works:
start advertising and do that for 30 secs.
in stop callback update the advertising data contents
and start advertising again.
It does get every message then.
But I would have liked to do this every one or two seconds
There's a couple of things in the Block:
- If "Viax2" is found, break the for each loop
- calling rx - the procedure will not complete before the next function executes, so either make it the last function or make it return a value.
Thanks Chris,
Yeah the break is allready build in. I saw a lot of Viax2 coming by in the same second, getting one of them is enough of course.
But I dont understand your second point. How is not completing?
rx is now returning a true.
But the problem is the same
Zivo, got your email, but could not email back.
however, tried your suggestion still gives the same problem. three or four in a row okay, then stops for a while and repeats
I suspect deviceFound is triggered when NEW device is found (you have the same device adv. all the time).
I'm using timer for looping for new data ( and renew the adv. scan).
You can print some message to verify the loop run at all.
I can see here that DeviceFound triggers on every advertisement, also from the same device. In there I check for the viax2 name on the devicelist. that works all the time.
Then I check for advertisment address validity with viax2.
When i transmit messages faster than 30 seconds it does find a couple, but then the returned address is empty. Untill the 30 secs is passed.
When I transmit a message with 30 secs interval, it works all the time.
That is fine for some applications, but I would want to process a message every one or two seconds.
and again, your timer solution gives me the same behaviour
The functions that follow do not wait for the procedure to complete, they are executed immediately. If anything down the line relies on what the procedure does, it may not have completed it's task in time, so it's about good programming habits in order not to get caught out.
Ah thanks very much for that info. That is very important to consider!!!