-
-
Notifications
You must be signed in to change notification settings - Fork 167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NRF5240 DK CODED_PHY with ESP32 #581
Comments
Please see the examples in the nimble-arduino library for BT5. You will need to enable extended advertising in the config. |
Hi but this example is for the ESP32 and not the NRF52, when I enable extended advertising in nimconfig.h it say it's only for ESP32. I am reading this wrong? Thanks for your help! it says: /****************************************************
|
That note can be safely ignored for you use, it will be removed later. |
Hi h2zero, so to be clear I have this setup:
but I don't get this with the NRF52 code.
Sorry, been struggling with this for a while, so any help would be of great use! Even better if I could just understand what needs to be specified at the server on the NRF52 to enable then that would be very helpful indeed. Thanks once again for an excellent library. |
Sorry, been busy with work. Admittedly I haven't tried the extended advertising on the nrf52 yet, I'll see if I can test this this week. |
Thank you very much indeed. I try and compile but it doesn't when I remove the esp32 related content. |
Hi, did you get a chance to test? sorry just chasing because this is one of the final steps before I send my project out for test. I will try myself in the meanwhile and update if I have any success. Thanks again! |
Here is the output I get when I use the multi advertising example: `Processing nrf52840_dk_adafruit (platform: https://github.com/h2zero/platform-n-able.git#1.0.0; board: nrf52840_DK; framework: arduino)Verbose mode can be enabled via
|
Also here is the output I get (a bit shorter!) when using just the extended server on the nrtf52 with esp32 sleep commented out. `Processing nrf52840_dk_adafruit (platform: https://github.com/h2zero/platform-n-able.git#1.0.0; board: nrf52840_DK; framework: arduino)Verbose mode can be enabled via
|
Same thing happened to me, it seems it cannot load the ble functions (trying to load from the ESP32 library?) Would like to get NRF52 working with coded PHY if possible |
HI @h2zero - delighted to see that you are looking into this. I have done a bit of research in the background and found that: https://github.com/tjpetz/Coded-Advertiser/blob/main/main.cpp seems to work for coded_phy but it is based on Mbed :(. However when I run the example your esp32 BT5 client example detects the coded_phy device. Just thought I would put it out there incase it helps! |
@j45p41 @nunomiguelferreira I'm not sure what is going on with your environments. I have tested with the following and is compiling just fine.
With this code (multi advertiser): |
Hi @h2zero, really appreciate you looking into this. I can confirm that it now compiles. However I get tis in the console:
I also can't see the device on nrfConnect or ESP32. |
@j45p41 that return code is odd.
I need more info and and possibly an example code to resolve this. |
hi @h2zero I used the code and platform.ini you posed in the reply. I am using nrf52840 DK. Let me know if there is any other info that would be useful. Thanks! |
HI @h2zero - Can you pls let me know how we can troubleshoot this. I used the example code you sent me with requested debug level - will really help if I can get the nrf52840 working with coded-PHY. Do you have any code that you have tested? |
Hi, any help would really be appreciated:) |
Hi @j45p41, I have pushed some changes to the n-able core that should have fixed this. Please try that out. |
Hi, @h2zero thank you very much indeed. I have used the following platformio.ini:
and the code you provided. I am still getting same serial output:
I did platform clean before compiling. Do I need to do anything else to pull in your new changes? |
That should work, it's likely using a cached version of the core. |
I just tested here, if you delete the |
Hi @h2zero that works! I can't believe after 7 months it's finally working! Thank you very much for your help! If I can get a bit more range than the legacy BT in an indoor environment then this will really help our project. Is it possible to:
Thanks Again! |
Glad to hear, sorry it took so long, wasn't easy to find the issue.
You're very welcome 😄 |
It all in good time! so after adapting the project last night and with your comments above here is my experience.
However I am getting the following message (all ok when using
|
The macros |
Ok. How do I enable s2 or s8 modes? |
Hi @h2zero - first of all thanks for all your help. I managed to get what I wanted out of it. Referring to:
and now the range is MUCH better even from outdoors to indoors. So it seem that this is the only way of increasing power. Here is the power graph with it it on: ![]() and here it is with it off: ![]() so there is a clear increase in power. This does not work when using So I am happy now because my project is now in flight due to your kind help and the above change. Only questions remain:
I have used the following line but now sure if this is making any difference:
|
Looks like the NimBLE driver caps the tx power to 4dbm, you can use the register to go to 8 |
client device is esp32 c3 running BLE5 client example. When I switch back to 1.4.1 address is ok. |
Hmm, in that case I'm going to assume that random mac is enabled on the esp. is it also running on this updated branch? |
yes because the client side is running the same example. When I switch to 1.4.1 it's consistent but with 1.5.0 it's changing. |
That's what I was curious about, thanks for confirming that suspicion. I'll look into that, quite strange that it has been changed. Thanks for testing, please report any other issues or errors encountered. |
I certainly will do. The range is now brilliant. I can reach the device from anywhere in the house! also when I compile the new version (1.5.0) on my ESP32C3 firmware I get:
So all testing done before this post is using 1.4.1 on esp32C3, it does not compile when I update to version 1.5.0. I can also confirm that when I place seapower here:
there is no change in power. |
You'll need to change the code in your app to use the newer callbacks and function signatures used in the master branch, have a look at the examples there. |
ok I will try this and report back. |
hi @h2zero, so I took the client example from the 1.5.0 branch and compiled with the following platfomio.ini:
I got the following compile error:
I will keep the config so let me know if you need any other testing to be done. Thanks again! |
Thanks, looks like that file is missing compile guards since it is a new file. I'll add that shortly and look for others. |
Hi @h2zero , on a separate subject. Is it possible to fix the channel on the client side so that it only monitors the last successfully connected channel? Regards, |
I've pushed fixes for the build errors, feel free to test it out.
There is no way that I am aware of other than modifying the controller scan code, you can set the advertisement channel though. |
Hi, sorry about late reply I was just getting some hours in for the day Job! so compiles and works with client example. However the MAC address is still shifting:
so thought maybe its coming in that way from peripheral. I used this code to output:
and it consistently outputs:
so I think peripheral is sending correctly. So far it appears that the code on the client is causing the issue. |
I'm thinking this is the peripheral using a random address. With extended advertising you can set the address differently for each advertisement and in this case it looks like the controller is changing it every time it start advertising. The address you are reading there is just the static address from the device register and is not being used in this case. |
could I be setting in the config file, I have checked all values and only thing I find related to random addresses is the following:
in |
It's not a setting that you are missing, it's actually the stack returning a NULL address when starting up so it generates are random address to use at each reboot. A workaround until that is resolved is to call |
@j45p41 The address issue should be resolved now. New config options in the NimBLE core are creating some new issues 😄 |
Also fixed |
I can confirm this is working. |
Perfect 😄 , any crashing/rebooting? If it's stable I will look to merge this. |
Looking good so far. I have a device which detects an interrupt and then sends a message after making a connection and goes to sleep. It does this 30/40 times a day and has been running for 4 days now with no issues. Thanks again! |
Been so happy with progress, almost forgot about this. Is it possible to s=8? or is that a future feature? |
S=8 is the default coded phy mode, S=2 would be a config setting. |
Hi, When I specify BLE_HCI_LE_PHY_CODED_S2 macro it compiles but no transmission. I think you said that it was non functional in earlier post. How would you config it? |
My understanding of the code was incorrect. I don't think you can set the which coded PHY is used for advertising, it's always S=8. You can change it to S=2 when connected it seems, that's the only place I can see that allows specifying. |
so I implemented it like this: Client:
Peripheral:
The result on client:
|
Yes, that's an invalid input. You would need to set the phy to s=2 after connecting since the function that accepts that parameter requires a connection handle value as well. |
Hi @h2zero , let me know if I should open a second ticket for this but I wonder if it is different for extended advertising. My use case is several peripheral devices (NRF52) advertising and being connected to by a client, in some cases simultanueosly. I can see from another post that the suggestion is having multiple client instances (I think upto 9 are allowed). Does this mean that while one device is connecting another one can also connect even during the connection process of the first? would using multiple processing task instances help here. I have set it up like this - is this correct?
so using same callbacks but creating Thanks again in advance! |
Hello, there can only be one connection in progress at a time. Once connected then the scanner becomes available again to connect to another device as needed. |
I'll close this now, please re-open if there are any related issues. |
Discussed in #580
Originally posted by j45p41 August 14, 2023
Hi,
I have been able to achieve CODED_PHY connection between two ESP32 devices but can't seem to find a way to setup NRF52840_DK as a server sending CODED_PHY.
I'm using the NimBLE_Server example but don't understand what I need to add to get the device to advertise with CODED_PHY. I believe the parameters in the nimcong.h file only relevant to esp32. Any guidance will be very much appreciated.
The text was updated successfully, but these errors were encountered: