-
1. Re: What will be optimized way to implement 1 Master and 3 slave's communication?
himam_31Sep 5, 2017 2:24 AM (in response to sapac_1819731)
In BLE there is no profile exactly suitable for serial protocol. You will need to use custom profile. You can design the profile in such a way that Client perform reads periodically from the slave. Also note that simultaneous connection to multiple slaves is not possible, you will need to time multiplex.
Thanks,
Hima
-
2. Re: What will be optimized way to implement 1 Master and 3 slave's communication?
sapac_1819731 Oct 3, 2017 12:48 AM (in response to sapac_1819731)Hi Hima,
Thanks For the answer,
I have implemented above scenario with heart rate collector and heart rate sensor and time multiplexing.
but i am facing some issue as below
1.INSUFFICIENT_ENCRYPTION_KEY_SIZE
2.sometimes peripheral device stops advertising/notification.
-
3. Re: What will be optimized way to implement 1 Master and 3 slave's communication?
epr_1639216 Oct 3, 2017 7:34 AM (in response to sapac_1819731)1. You need a larger encryption key size. This seems pretty self-explanatory?
2. Depending on how you write the peripheral BLESS event handler, you might run into an event where the chip does an event that causes it to stop advertising (based on code, since I haven't seen it lose advertisement without some event/notification/code telling it to).
I would suggest looking at your code flow and seeing if there are cases that could cause the advertisement to stop.
Also, just fyi, the notifications only work when the device is connected to another Bluetooth device; Notifications while unconnected shouldn't work, and this could be what you are seeing.
-
4. Re: What will be optimized way to implement 1 Master and 3 slave's communication?
sapac_1819731 Oct 3, 2017 8:45 AM (in response to epr_1639216)Thanks e.pratt,
Thanks for the information i will go through it.
can you please go through the logs attached here and and figure out something?
P.S-
2 different master logs(taken on separate days) and 1 slave log
Thanks.
-
teraterm-slave3.txt.zip 5.3 K
-
teraterm-master.txt.zip 83.2 K
-
master02-10-2017.txt.zip 38.6 K
-
-
5. Re: What will be optimized way to implement 1 Master and 3 slave's communication?
epr_1639216 Oct 3, 2017 11:35 AM (in response to sapac_1819731)Since most of the events are successes; I would assume there is something transient occurring in your code.
The insufficient encryption error has the following documentation:
/** Insufficient key size for the security requirements of this device */
Possibly, you are sometimes using the wrong value for the encryption key or encryption key size.
The following events make me think your code is behaving erratically (in Teraterm-master.txt):
Line 21: ConnectDevice API Error: 0x103 invalid state: state: scanning
Line 75: ConnectDevice API Error: 0x103 invalid state: state: connected
Line 91: ConnectDevice API Error: 0x103 invalid state: state: scanning
Line 168: CyBle_BascSetCharacteristicDescriptor API Error: 0x02 invalid operation
etc. etc.
-
6. Re: What will be optimized way to implement 1 Master and 3 slave's communication?
sapac_1819731 Oct 3, 2017 12:02 PM (in response to epr_1639216)Thanks For the patience..!!
Can you please look(in Teraterm-master.txt): after Line 57967.
as main problem causes after this and am unable to figure out as you can see scan progress shows the peripheral devices(00a050000aaa/bbb/ccc/ddd) but unable to connect.
device-3 is anyhow down so i am getting CYBLE_EVT_TIMEOUT: 4
Then i get start getting CYBLE_EVT_GAP_AUTH_FAILED, reason: INSUFFICIENT_ENCRYPTION_KEY_SIZE and ConnectDevice API Error: 0x103 invalid state: state: scanning
for time being as a workaround am using "CySoftwareReset();" for the 60 sec on both side and planning to do same if encryption error comes.
is there any way to inform heart rate sensor about heart rate collector has resetted?or any workaround so that all devices will be in sync.
but don't feel this is a better way.
-
7. Re: What will be optimized way to implement 1 Master and 3 slave's communication?
epr_1639216 Oct 4, 2017 8:02 AM (in response to sapac_1819731)It looks like one of your connection attempts fails, after which your code/state machine gets out of wack and starts trying to connect while still scanning, etc.
Try adding handlers for failure cases for: connecting, scanning, reading data, encrypting, etc.
That way, you can say retry encryption a couple times if it fails; Reset the encryption data if it fails too much, etc.
I would say the code looks to be behaving in a time-multiplexing fashion, and you just need to handle the failure cases.