GithubHelp home page GithubHelp logo

Can't get WiFi provisioning demo to work with ESP32 board and Release 1.5 branch of amazon-freertos about amazon-freertos-ble-ios-sdk HOT 24 CLOSED

aws avatar aws commented on August 15, 2024
Can't get WiFi provisioning demo to work with ESP32 board and Release 1.5 branch of amazon-freertos

from amazon-freertos-ble-ios-sdk.

Comments (24)

ravibhagavandas avatar ravibhagavandas commented on August 15, 2024 3

@sameerdasarwad @pisukeman

Just works(LEGACY) pairing is disabled by default for ESP32 Nimble stack in FreeRTOS. So, in addition to above config changes, you need to enable stack level config by 'make menuconfig--> Component config --> Bluetooth --> Enable NimBLE host stack --> Security manager legacy pairing' or by setting 'CONFIG_NIMBLE_SM_LEGACY=y in sdkconfig.

Please let us know if this works for you.

from amazon-freertos-ble-ios-sdk.

xuaninbox avatar xuaninbox commented on August 15, 2024

Hey, when you first connect to the device, did you see a popup to confirm pairing, and also accept the pairing on the device (by connect via serial and type 'y' to accept) ?

from amazon-freertos-ble-ios-sdk.

jkeiththomson avatar jkeiththomson commented on August 15, 2024

No, I didn't see a popup asking me to confirm pairing, nor did I see a prompt on the serial connection to type 'y' to confirm.

When I start the demo app, the ESP32 is shown in the list of devices (it's the only device in the list).

When I tap the device name in the list, a green vertical bar appears to the right of the device name.

When I tap the device name again, a popup menu asks me if I want to do MQTT Proxy, Network Config or Custom GATT MQTT. If I choose "Network Config" then I get the screen that should be listing all the SSIDs available, but no SSIDs are shown.

from amazon-freertos-ble-ios-sdk.

xuaninbox avatar xuaninbox commented on August 15, 2024

I see, one thing to rule out is old BLE bonding on iOS. Have you connected with this ESP device before with this phone? If so could you go to settings > bluetooth > and forget the ESP device. If this didn't work, please restart the phone as there may be other cached BLE info.

from amazon-freertos-ble-ios-sdk.

jkeiththomson avatar jkeiththomson commented on August 15, 2024

Yes, I had connected previously with this phone. So I deleted the ESP32 from the list of BT devices in iOS Settings, and just for good measure, I rebooted the phone.

This time when I started the demo app I did get a "pairing" confirmation on the phone and a 'y' confirmation on the serial connection However, after confirming those two prompts, I still get an empty list of scanned networks (and I see the same error in the debug log).

from amazon-freertos-ble-ios-sdk.

xuaninbox avatar xuaninbox commented on August 15, 2024

Could you post the debug log from the ESP so we could debug further?

from amazon-freertos-ble-ios-sdk.

jkeiththomson avatar jkeiththomson commented on August 15, 2024

Here are the logs from the esp32 and ios app.
esp32.log
ios.log

from amazon-freertos-ble-ios-sdk.

ravibhagavandas avatar ravibhagavandas commented on August 15, 2024

Hi @jkeiththomson,

WiFi provisioning is not enabled by default on Amazon FreeRTOS devices, so you need to explicitly enableby defining the following config to 1 in the file iot_ble_config.h

#define IOT_BLE_ENABLE_WIFI_PROVISIONING ( 1 )

Let us know if this fixes the problem.

from amazon-freertos-ble-ios-sdk.

jkeiththomson avatar jkeiththomson commented on August 15, 2024

It didn't fix the problem but we did get a little further along. Here are the new logs.
esp32-1.log
ios-1.log

from amazon-freertos-ble-ios-sdk.

xuaninbox avatar xuaninbox commented on August 15, 2024

from the log: GATT_INSUF_AUTHENTICATION: MITM required

it looks like we are still having a bonding issue, could you forget the device in the settings and try again? btw, are you erasing the flash when updating the firmware on the ESP, that will remove the bonding from the ESP so you may have to redo the bonding.

from amazon-freertos-ble-ios-sdk.

jkeiththomson avatar jkeiththomson commented on August 15, 2024

Redoing the bonding did the trick! Thank you! I can now enumerate the WiFi networks around me and connect to my home network.

I will take care not to erase the flash before updating the firmware next time.

Thanks again for your help.

from amazon-freertos-ble-ios-sdk.

jkeiththomson avatar jkeiththomson commented on August 15, 2024

Sorry - I have another question. Why do I need to hit 'y' on the serial connection to the ESP to confirm the bonding? That won't be possible for our end users to do. Is that just a debugging thing?

from amazon-freertos-ble-ios-sdk.

xuaninbox avatar xuaninbox commented on August 15, 2024

So by default we use the highest security setting BLE offers which is Numeric Comparison that requires you to confirm that you are seeing the same number on both the phone and the device (by pressing Y), however if the device you are building does not have a screen or input, you could choose to use a lower security setting. The 'Pairing procedure and I/O capabilities' graph here is a good reference of these settings. https://medium.com/rtone-iot-security/deep-dive-into-bluetooth-le-security-d2301d640bfc

I'll ask @ravibhagavandas to point you to the file where you can change these settings.

from amazon-freertos-ble-ios-sdk.

ravibhagavandas avatar ravibhagavandas commented on August 15, 2024

Hi,
To enable just works pairing ( pairing without numeric comparison ) you want to override the following config in iot_ble_config.h

#define IOT_BLE_ENABLE_NUMERIC_COMPARISON ( 0 )

#define IOT_BLE_ENABLE_SECURE_CONNECTION ( 0 )

#define IOT_BLE_INPUT_OUTPUT ( eBTIONone )

from amazon-freertos-ble-ios-sdk.

sameerdasarwad avatar sameerdasarwad commented on August 15, 2024

@ravibhagavandas @xuaninbox i have set these setting but it wont work i just want to remove press y key

from amazon-freertos-ble-ios-sdk.

sameerdasarwad avatar sameerdasarwad commented on August 15, 2024

when i am changing values i am getting error
E (6161) AFR-BLE: Just works in Secure Connections only mode
#define IOT_BLE_ENABLE_NUMERIC_COMPARISON ( 1 )
#define IOT_BLE_ENABLE_SECURE_CONNECTION ( 1 )
#define IOT_BLE_INPUT_OUTPUT (eBTIONone )

and if i change it to
#define IOT_BLE_ENABLE_NUMERIC_COMPARISON ( 1 )
#define IOT_BLE_ENABLE_SECURE_CONNECTION ( 1 )
#define IOT_BLE_INPUT_OUTPUT (eBTIODisplayOnly )
it asking me for password if i entered 0000 or 1234 but still i its didnt get provision
i just want to remove y key confirmation from device side because we dont have any input or display to our device

from amazon-freertos-ble-ios-sdk.

ravibhagavandas avatar ravibhagavandas commented on August 15, 2024

@sameerdasarwad

As mentioned above, to enable Just Works Pairing you need to set the following configs as below in iot_ble_config.h

#define IOT_BLE_ENABLE_NUMERIC_COMPARISON ( 0 )
#define IOT_BLE_ENABLE_SECURE_CONNECTION ( 0 )
#define IOT_BLE_INPUT_OUTPUT ( eBTIONone )

Let me know if this configuration worked for you.

from amazon-freertos-ble-ios-sdk.

pisukeman avatar pisukeman commented on August 15, 2024

Hi!
We're not able to make the Just Works Pairing works.
Using the configuration:

#define IOT_BLE_ENABLE_NUMERIC_COMPARISON ( 0 )
#define IOT_BLE_ENABLE_SECURE_CONNECTION ( 0 )
#define IOT_BLE_INPUT_OUTPUT ( eBTIONone )

The app is not able to pair with the ESP32. The connectionStatus never gets BLE_CONNECTED value.

On the other hand if I try with other configurations, everything works fine. For example, we just tried the "Y" confirmation at ESP side and the pairing was good.
Any hints about what we are doing wrong?

Thanks in advance

from amazon-freertos-ble-ios-sdk.

sameerdasarwad avatar sameerdasarwad commented on August 15, 2024

yes with the y confirmation pairing done smoothly but i just want to remove the confirmation from esp side as @ravibhagavandas mention i tried with the above configuration but its not working for me its showing error like afr:ble works in secure mode only
or after some time getting massage like

GAP procedure initiated: advertise; disc_mode=2 adv_channel_map=0 own_addr_type=0 adv_filter_policy=0 adv_itvl_min=187 adv_itvl_max=375
5 4020 [ble] [INFO ][DEMO][40200] BLE disconnected with remote device, connId = 0
when i search for ble i found esp when i select it "more..."option should be available but it is not and getting above massage
i am using android SDK app with Bluetooth version 5

from amazon-freertos-ble-ios-sdk.

sameerdasarwad avatar sameerdasarwad commented on August 15, 2024

@ravibhagavandas i think iot_ble_config_defaults.h is also need to change or keep it as it is

from amazon-freertos-ble-ios-sdk.

ravibhagavandas avatar ravibhagavandas commented on August 15, 2024

@sameerdasarwad @pisukeman

Thanks for your inputs.
We are able to reproduce an issue with ESP32 device when trying to pair in Just Works mode with IOS SDK. We are debugging this issue further and will get back to you on this.

from amazon-freertos-ble-ios-sdk.

sameerdasarwad avatar sameerdasarwad commented on August 15, 2024

@ravibhagavandas thanks for response i will also try to find the solution hope soon we will get output

from amazon-freertos-ble-ios-sdk.

ravibhagavandas avatar ravibhagavandas commented on August 15, 2024

We see an issue with ESP (NIMBLE) porting layer for BLE, for Just Works pairing mode. The issue is reproducible with our IoS and Android SDKs. We are in touch with ESP team regarding this, and will post as soon as we get some updates.

from amazon-freertos-ble-ios-sdk.

sameerdasarwad avatar sameerdasarwad commented on August 15, 2024

hi @ravibhagavandas i have tested and its works fine thank you for solution ;)

from amazon-freertos-ble-ios-sdk.

Related Issues (19)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.