cancel
Showing results for 
Search instead for 
Did you mean: 

WICED Studio Wi-Fi Combo

New Contributor II

Folks,

How do you connect to a CYW4343W using a PIN please? There is vague mentions of PINs in both the source code and the sketchy documentation, but I can't fathom how you set the device up so that when the phone attempts to connect to the CYW4343W, the phone has to enter a PIN for the connection to succeed.

I have set up our device in the hello_sensor style and I can connect, read and write data etc, but now I need to set it up so the phone enters the PIN to communicate.

The PIN will be the same in every device (at least to start with) and we have no user interface whatsoever, hence the need for each device to have the same PIN.

I can't even see any example code to wade through.

I could do with some explicit instructions as to how this works. I'm assuming you have to set up somerthing when advertising.

Many thanks.

0 Likes
Reply
1 Solution
Moderator
Moderator

Hi RoWo_4704901 ,

From your description, I believe you are using BLE and you want to use 6 digit Passkey for security.

In order to use the passkey method, you need to set the IO capabilities accordingly. In your case , your mobile phone have to enter the passkey. Which means 4343W should be having IO capability Display and for mobile keyboard.

So when you set the IO capability BTM_IO_CAPABILITIES_DISPLAY_ONLY in BTM_PAIRING_IO_CAPABILITIES_BLE_REQUEST_EVT , the stack will generate 6 digit passkey and display on the 4343W device. Then you have to enter this passkey on your mobile phone during connection process.

As per spec, the 6 digit passkey should be randomly generated. So there is no provision to have all the devices with same PIN .  As of now , there is no such API in WICED to set a fixed passkey in all of your devices.

So ideally only if your device have any IO capability , you can use passkey method.

I have attached modified hello_Sensor example for IO capability display to test at your side.

Note :

I have attached our WICED Academy files compatible with WICED SDK. It is targeted for CYW20719 device, however the app code implementations and structures are same for 4343W . You may refer to WBT101-04B-BLE-Ntfy-Sec.pdf in labmaual folder for understanding how to implement different security options.

Regards,

Anjana

View solution in original post

0 Likes
Reply
21 Replies
Moderator
Moderator

Hi RoWo_4704901 ,

From your description, I believe you are using BLE and you want to use 6 digit Passkey for security.

In order to use the passkey method, you need to set the IO capabilities accordingly. In your case , your mobile phone have to enter the passkey. Which means 4343W should be having IO capability Display and for mobile keyboard.

So when you set the IO capability BTM_IO_CAPABILITIES_DISPLAY_ONLY in BTM_PAIRING_IO_CAPABILITIES_BLE_REQUEST_EVT , the stack will generate 6 digit passkey and display on the 4343W device. Then you have to enter this passkey on your mobile phone during connection process.

As per spec, the 6 digit passkey should be randomly generated. So there is no provision to have all the devices with same PIN .  As of now , there is no such API in WICED to set a fixed passkey in all of your devices.

So ideally only if your device have any IO capability , you can use passkey method.

I have attached modified hello_Sensor example for IO capability display to test at your side.

Note :

I have attached our WICED Academy files compatible with WICED SDK. It is targeted for CYW20719 device, however the app code implementations and structures are same for 4343W . You may refer to WBT101-04B-BLE-Ntfy-Sec.pdf in labmaual folder for understanding how to implement different security options.

Regards,

Anjana

View solution in original post

0 Likes
Reply
Moderator
Moderator

I am not able to add the WICED ACADEMY files.

Here is the link of the same : GitHub - cypresssemiconductorco/CypressAcademy_WBT101_Files: Files for WICED Bluetooth 101 class

0 Likes
Reply
New Contributor II

OK, many thanks for the fast reply, it's much appreciated.

It's not what we wanted to hear, but at least we know. We have absolutely no UI, there must be a number of other products in a similar situation, so seems like quite a an issue.

0 Likes
Reply
Moderator
Moderator

Hi RoWo_4704901 ,

Yea, I understand.

To add one more point , if you keep the IO capability as keyboard, then you can just use the API wiced_bt_dev_pass_key_req_reply and you can send a known passkey if that helps your requirement. In that case, in your mobile you may have to hard code a passkey with IO cap display.

As I mentioned before, currently our stack don't have the option to set a fixed passkey . However if its critical for your application, you may approach our local sales / FAE marketing team. They may evaluate the opportunity and consider the request for new API.

Regards,

Anjana

0 Likes
Reply
New Contributor II

Hi again.

Sorry, only just seen your reply.

I don't understand what you mean by:

if you keep the IO capability as keyboard, then you can just use the API wiced_bt_dev_pass_key_req_reply and you can send a known passkey if that helps your requirement

Most specifically by "keep the IO capability as keyboard". Are you taking about a keyboard on our device with the CYW4343W? We have nothing at all, it's like a watch with no display and no buttons!

I'll tell the powers that be about the possibility of talking to you about a new API call.

Thanks again.

0 Likes
Reply
Moderator
Moderator

Hi RoWo_4704901 ,

What I mean is - You will be keeping the IO capability as keyboard even if you don't have a real Keyboard entry in your end device.

Suppose you know the passkey already and hard corded on your peer device in which you have kept the IO cap display .

In that case , when you know the passkey to be used, you don't have to enter the key manually. Rather on the event triggers, you can call API wiced_bt_dev_pass_key_req_reply to send the known passkey to complete pairing process.

Regards,
Anjana

0 Likes
Reply
New Contributor II

I'm getting nowhere with this. I have followed the hello_sensor example you posted, but it refuses to ask for any PINs when connecting.

I then worked through some documentation in  WBT101-04B-BLE-Ntfy-Sec.pdf as you suggested and that says use this:

wiced_bt_set_pairable_mode()

Whch made me think I must have found what I was missing from your example code. However, even though it's in two examples of  "wiced_bt_dev.h" header files, it's not in the one we're using for our project.


So, is it possible we're using the wrong header files? I'm utterly confused by the overwhelming amount of  code and how many duplicate examples there of of numerous header files.

It looks like the only places this function wiced_bt_set_pairable_mode()  is listed is under BCM920739 files. There are only a small handul of Google devices on the BCM920739, one of them referring to this site, so goodness knows what it is and how different it is to the CYW4343W that we are using. Are you able to give any advice at all on any of this please?

Is there a different set pairable mode for the CYW4343W? Do we have the wrong header files?

Thanks.

0 Likes
Reply
New Contributor II

AnjanaM_61

Another reason I'm concerned that the instructions you gave me are for completely the wrong part is that those instructions go on about Bluetooth configurator, but from what I can make out this is in something called Modus toolbox and we're using WICED studio.

Can you confirm as well as the questions above that this all works with WICED studio?

Thanks

0 Likes
Reply
New Contributor II

This post:CYW4343W Wiced_bt_set_pairable_mode issue

Seems to suggest we can't PIN pair at all using this CYW4343W. Is that really correct? We can only connect without a PIN with CYW4343W?

SheetalJ_96​ You were the responder on that original post, can you confirm this please?

If not, what is the method for PIN pairing with the CYW4343W please?

Many thanks.

0 Likes
Reply
Moderator
Moderator

Hello RoWo_4704901 ,

I tested and provided you the example project. Its working for me with passkey entry.

I tested with CySmart mobile app. Upon clicking on the device name, you will get a pop up for pairing as a notification on mobile screen top.

Click on that to proceed. Attached few screenshots.

It should work regardless of wiced_bt_set_pairable_mode API for 4343W.

Regarding WICED ACADEMY files, yes its directly compatible with BT discrete chips. However the theory and pairing events are same for the 4343W chip as well. So You may refer that to understand the steps .

Please test the project once again.

However as mentioned before , IO_capabilities are required for PIN / Passkey entry. The example I shared is for test purpose at your side.

As I mentioned before, currently our stack don't have the option to set a fixed passkey . However if its critical for your application, you may approach our local sales / FAE marketing team. They may evaluate the opportunity and consider the request for new API.

Regards,

Anjana

0 Likes
Reply
New Contributor II

Hi  AnjanaM_61

I tried again with the hello_sensor app rar you posted in your first reply again and it made absolutely no difference.

On a whim, I tried my tablet. Same thing. Then out of desperation I tried a different phone and that did actually try and pair with PINs. I am using printing to a serial port to give me messages and that should spit out the PIN required.

However, I never get a BTM_PAIRING_IO_CAPABILITIES_BLE_REQUEST_EVT event, it never prints out a PIN, so I cannot connect.

If I take too long to confirm I want to connect with a pin (about fifteen seconds or so) the message asking for confirmation of PIN pairing disappears and it just tells me the characteristics are blank. I have to reboot our device to reconnect.

I do get an event telling me the pairing has failed.

So questions are:

1. Why does my phone not work in any way at all with a PIN? Why does it just connect and work every time? (Bearing in mind a different phone does request a PIN.)

I could imagine it's maybe because it's been connected to our device before, but our device is not in the list of bonded devices on my phone.  Is my phone's details stored in our devices somewhere without me realising it goes on behind the scenes? If so, how would I clear that from our device?

2. Why is BTM_PASSKEY_NOTIFICATION_EVT never getting called? Even with a different phone that does at least realise it needs a PIN to connect?

I realise this is not the solution long term, and we need to have the phone select a permenant PIN that is hard coded into our device, but, baby steps.

Thanks again.

0 Likes
Reply
Moderator
Moderator

Hi RoWo_4704901 ,

Can you please let me know the WICED SDK version you are using?

I am sorry, there was an issue with SDK 6.4 version for the pairing. However I thought the issue is only when the device is in Central role. Let me ask any of my colleague to test the example with SDK 6.4 public version to see if we are getting same issue as yours and will update you.

Regards,

Anjana

New Contributor II

We are, indeed, using SDK6.4.

0 Likes
Reply
New Contributor II

Hi AnjanaM_61

Did a colleague have a look at this?

Also, what hardware have you tested this on? Remember we are usuing a module and an STM32 connected via UART/Quad SPI.

0 Likes
Reply
Moderator
Moderator

Hi RoWo_4704901 ,

Yes tested and its working fine.

We are using CYW94343WWCD1_EVB ( https://www.cypress.com/documentation/development-kitsboards/cyw94343wwcd1evb-evaluation-and-develop...  ) . It uses STM32

I don't have the same module which you are testing.

Could you try testing it again ?

Reprogram the board with the code. Make sure on your phone BT settings , the device is not bonded. If bonded, then do forget the device.

We tested using Android mobile phone.

Regards,

Anjana

0 Likes
Reply
New Contributor II

Hi AnjanaM_61

I am running exactly the same hello_sensor code as what you originally posted. If I attempt to connect with an Android device to our product, I get no callback to print out a PIN. The Android tablet says I need to enter a PIN, but WICED is not giving me one.

006.004.000.0061 is the version spat out by the command line as the WICED version.

I've tried this over and over again with various different phones and tablets with no joy.

Is there anything in the platform files that could enable most things to work, but not the PIN?

It looks like you are running a very similar setup to us, you have the same SoC (assuming the BCM4343 is the same as  CYW4343?) and are connecting to an STM32. Does your binary blob match with ours?

Nothing is bonded, but I have cleared all BT cache to be on the safe side with no joy. Even with a brand new phone I never get the PIN callback function called.

Thanks.

0 Likes
Reply
Moderator
Moderator

Hi,

BCM4343 is the same as  CYW4343? - Yes.

Which exact partner module are you using ?

Did you tried with multiple boards?

Can you send me a video of the connection procedure where the passkey entry on mobile is coming and not on the 4343 side?

Regards,

Anjana

0 Likes
Reply
New Contributor II

Hi AnjanaM_61

We are using Murata 1DX module.

Videos seem to need a third party place to put the video, which I don't have access to. However, the image below shows you *everything* I get  spat out by WICED on the STM32. As you can see I never get the callback with the PIN. ie, this:

BTM_PASSKEY_NOTIFICATION_EVT

event never happens:

Capture_BLE.JPG

On the CySmart app, when I try to connect it asks me for the PIN I need, but of course, WICED is never providing me with that PIN.

0 Likes
Reply
New Contributor II

AnjanaM_61

One thing that I have discovered is that the program never returns from wiced_bt_stack_init()

I'd never noticed this because there is only ever a print to the command line of a failure of initialisation and then we go into an infinte loop in the thread that sets this up (further down the line the initialising thread will do stuff).

So the three questions are:

1. Why would this never return?

2. Could this be why the PIN connect is not working?

3. Why would it not returning allow me to still connect and read characteristics without a PIN pairing?

This is the only other instance I can find for this:

[BLE] wiced_bt_stack_init gets stucks

But we are setting up:

.max_number_of_buffer_pools = 4,

already.

0 Likes
Reply
New Contributor II

AnjanaM_61

Bump. I know we're a pain, but please can we get a response on these latest two issues?

0 Likes
Reply
Moderator
Moderator

Hi RoWo_4704901 ,

I was not available last few days, nothing intentional.

I don't know why you have mentioned its getting stuck at wiced_bt_stack_init() ? Did you check the return status of API?

In the logs which you shared , I can see pairing complete : 22 - which means pairing timeout . In that case , either you might not have clicked on pair notification came on mobile phone.

Also , I can't see all of the logs getting printed. I have attached mine to compare.

Q) Why would it not returning allow me to still connect and read characteristics without a PIN pairing?

-  In the project which I shared, I have not made the read / write properties of characteristic AUTH required. So even if pairing fails, you may able to read / write. You can change the permissions according to requirement later by using LEGATTDB_PERM_AUTH_READABLE .

1. Can you please try with a second board if you have ?

2. Can you try the default demo examples like ble_hello_sensor or ble_wifi_introducer and see if its working fine ? If its working fine, then modify only the passkey events and try again?

3. You may also share the logs by enabling GLOBAL_DEFINES     += ENABLE_BT_PROTOCOL_TRACES in the make file. So that we can see all the BT HCI logs and can confirm if its getting stuck anywhere

I would suggest you to contact one of our local sales FAE if possible, so that they can help to sort out your issue straight away.

Regards,

Anjana

0 Likes
Reply