BLE/NRF error #7482
Replies: 1 comment
-
Posted at 2024-04-21 by SI_Cheng-Yun Is there a problem with the regular expression for verifying Posted at 2024-04-21 by @fanoush try removing quotes? at least with 16bit ones it worked without quotes for me (on nrf52) Posted at 2024-04-22 by SI_Cheng-Yun so sad... it dosen't work, told me:
Posted at 2024-04-22 by SI_Cheng-Yun recent now, I've tried:
and:
and:
and:
and:
and:
none of them succeeded. Posted at 2024-04-22 by @fanoush Just tried your original code with quotes with nrf52 and it works as is with no change so it is issue of ESP32 port.
and even this works with long ids without quotes and dashes
and I verified in nrfConnect that those IDs are indeed used correctly when connecting to the device. So looks like parsing of BLE ids for ESP32 is done by different code than for nrf52 and it does not work as expected. Posted at 2024-04-22 by @fanoush Oh that is strange. The code is common for all platforms Are you using recent/latest version of Espruino? EDIT: the specific ESP32 code printing the message starting with "invalid Char UUID:" is here and what is also strange is that it probably parses the service ID in same format Posted at 2024-04-22 by @fanoush sorry, I don't use ESP32 very much but when looking at similar nrf52 code here I guess there should be If you can build from source maybe you can try to fix it? Posted at 2024-04-22 by SI_Cheng-Yun It is issue of ESP32 port. I have just tried the code without quotes and dashes: NRF.setServices({
a18419019ed149b3b998172d8f29b213 : {
a18419029ed149b3b998172d8f29b213 : {
readable : true,
writable : true,
notify : true,
onWrite: (event) => {
console.log("Got: ", event);
}
}
}
});
NRF.setAdvertising({}, { name: "ISP" }); It does not work.
May be there are some bugs in ESP32 code. Posted at 2024-04-22 by SI_Cheng-Yun Yes, Espruino firmware version of my ESP32 board was updated to 2v21 version. Posted at 2024-04-22 by @fanoush
yes, it is not so stable, there is no official ESP32 based Espruino device so this is just community effort.
attached is result of the build with that patch applied. maybe it helps, maybe you'll hit another bug Attachments: Posted at 2024-04-22 by SI_Cheng-Yun It's so nice of you! Posted at 2024-04-22 by SI_Cheng-Yun wow! Thank you! Posted at 2024-04-22 by @fanoush
it is actually very easy, on typical linux (ubuntu, debian) or in WSL you just checkout the Espruino github repo and run provision script that will download stuff for specific BOARD and its platform. I think on Ubuntu this works just with
Also you can trick it and just use github to build it for you, ESP32 is part of build checks, so if you go to
so just click that link to download zip of build results for that commit. So you can just fork Espruino repo, push change(s) to your forked repo and get the result zip of your custom ESP32 build. Posted at 2024-04-22 by @MaBecker @fanoush nice finding, will create a pr for this, so it will be part in one of the next ES32 builds. Posted at 2024-04-22 by @fanoush Well but does it work? I did not test it. Posted at 2024-04-22 by @MaBecker I will run some test before creating a pr. Posted at 2024-04-23 by SI_Cheng-Yun It works! It works! It's actually well done! WOW~ It's splended! Posted at 2024-04-23 by SI_Cheng-Yun This is really wonderful! This further enhances my motivation to handle many tasks later on, Many thanks for you! Posted at 2024-04-23 by SI_Cheng-Yun This is really wonderful. Thank you all very much for your selfless and kind work, which has inspired me so much! Posted at 2024-04-23 by SI_Cheng-Yun After solving the existing problems, I found that callback function for NRF.setServices({
0x1901: {
0x1902: {
value : "Hello",
broadcast : true,
readable : true,
writable : true,
notify : true,
indicate: true,
onWrite: (event) => {
console.log("Got: ", event);
}
}
}
}); Posted at 2024-04-23 by SI_Cheng-Yun There are indeed some issues with ESP32, sad... Posted at 2024-04-23 by SI_Cheng-Yun I plan to learn the source code when I have some free time in a while and try to solve this problem (since I don't have a hardware background myself, I actually find it a bit difficult, though you say it's easy). Posted at 2024-04-23 by @fanoush
Yes, not a long time ago only advertising worked well on ESP32 so even this state is much better. If setting up service with characteristics did not work (at all I guess?) and is fixed only now it means nobody used it before. Does at least reading and writing values of characteristics work? As a workaround for now it may be good enough to read characteristics periodically instead of using notifications. Oh but you said writing does not work because the callback is not called so you don't get the new value. Oh, well. I don't know what project are you working on but if you just need some bidirectional communication you may use the interpreter console itself over BLE to pass the data. Sorry I don't use ESP32 with Espruino for BLE so I am not sure what already works, @MaBecker does at least the Nordic UART console work over BLE on ESP32? Or maybe @gfwilliams knows what is BLE state for ESP32 and what is still missing? I've seen some significant BLE related work done for ESP32 port in recent year. Posted at 2024-04-23 by @MaBecker Check issue #1777 Improve ESP32 implementation for fixed and open issues. Gordon implelemnted the uart part and it works perfect. Posted at 2024-04-23 by SI_Cheng-Yun no no no no no... writing does work! Posted at 2024-04-23 by @MaBecker Using now GATTBrowser to check the service and the custom characteristics, look fine to me. Attachments:
Posted at 2024-04-23 by @fanoush
Thanks. Not much BLE related there however, I see only
So it makes sense there is no info in the list about using BLE characteristics (writing callback + notifications) since nobody could try with NRF.setServices not working. Posted at 2024-04-23 by @MaBecker but the event is not fired, or is something wrong with my test code?
Posted at 2024-04-23 by @fanoush
Yes that is good, what I meant is that if you don't get the callback then you don't know what value was written so writing is not very useful. Posted at 2024-04-23 by SI_Cheng-Yun I can read it after writing, so I can read the value I wrote. Just write => read. Posted at 2024-04-23 by @MaBecker read so write changes the value from Hello to world in my test, but the leds on D19 did not switch on and off. Posted at 2024-04-23 by SI_Cheng-Yun Yes, yes, it is indeed this issue. Posted at 2024-04-23 by @gfwilliams Thanks for looking into this! You can force the console to stay on Serial1 even when connected with BLE with Also I looked and there is some code for handling writes there, but on trying the code above and writing I get:
Is this what you see too? I'll have a look and see if I can figure out what's broken Posted at 2024-04-23 by @MaBecker
Yes, I see that too. Posted at 2024-04-23 by @gfwilliams Well, that was a nightmare. Pretty much everything was broken. But I have now fixed setServices, onWrite, and notifications/indications, so I think it should be ok if you try a 'cutting edge' build now Posted at 2024-04-23 by @MaBecker Hmm, seems to be a huge thing, still get this when writing
Edit: GIT_COMMIT: "3076d5133" ups this is not the latest commit Posted at 2024-04-23 by @MaBecker Now with the correct version it works - Many thanks, will close issue 2493
Posted at 2024-04-24 by SI_Cheng-Yun 👍👍👍 |
Beta Was this translation helpful? Give feedback.
-
Posted at 2024-04-20 by SI_Cheng-Yun
I am trying to send this command to my ESP32:
Then the console reported an error:
I changed the
Char UUID
to0x1901
, but it still doesn't work.Beta Was this translation helpful? Give feedback.
All reactions