observer example

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Dirk_6716
Level 2
Level 2
10 sign-ins 10 replies posted 10 questions asked

https://github.com/cypresssemiconductorco/PSoC-4-BLE/tree/master/100_Projects_in_100_Days/Day010_Obs...

Hello,

1.     I am trying to run the above 'observer' code on the ble pioneer kit. It seems to work fine, but in the serial terminal (tera term), only CAPITAL CASE letters are 'printf'ed correctly. Lower case letters are printed as random characters. the debug.c file and the heap are set as is in the original example code above.

2.     Also, I want to maximize the discovered packets. I don't want to decrease power consumption, I just want to continuously detect nearly  every advertised packet by a specific broadcaster. What scan parameters will be best? 10 ms interval + 10 ms window? Any code changes?

3.     Also, I realized that scanning 3 channels (37,38,39) caused leads to missed packages. Therefore, I set my broadcaster to only advertise in channel 37, and added the following code below such that the observer only scans channel 37. I thought this would make my observer continuously scan channel 37 and therefore not miss any packets, but this was not the case. Even more advertisements were missed than before.

5. How do I set a CyBLE Central device so that it scans only for a particular channel among channel 37, 38, 39 ?
A) To change the scan channel map configuration, change the bits 13, 14, and 15 of the CYREG_BLE_BLELL_SCAN_CONFIG register.
Bits - 15:13
Name - SCAN_CHANNEL_MAP advertising channels that are enabled for scanning operation.
Description -
Bit 15: setting 1 - enables channel 39 for use.
Bit 14: setting 1 - enables channel 38 for use.
Bit 13: setting 1 - enables channel 37 for use.
Default Value: 7
See the PSoC/PRoC BLE Register TRM.
For example:
To scan only in 37th advertising channel, use the following code in CYBLE_EVT_STACK_ON event in the BLE callback event handler. Ensure that the following code is added before calling the start scan API.
#define CYREG_BLE_BLELL_SCAN_CONFIG_USER (*(uint32*) CYREG_BLE_BLELL_SCAN_CONFIG)
CYREG_BLE_BLELL_SCAN_CONFIG_USER=CYREG_BLE_BLELL_SCAN_CONFIG_USER & 0xFFFF2FFF;
0 Likes
1 Solution
lock attach
Attachments are accessible only for community members.
VenkataD_41
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

Hi,

The code example is printing correctly at our side, please see the attached image.

1. Please check the UART baud rate on both sides. Reset the terminal and reset the psoc device.

  Please follow the procedure mentioned in the attahed file and check once.

2. There is a trade-off between power consumption and discovering more packets. Since the minimum  advertisement interval for BLE is around 20 milliseconds, scanning at 10 milli seconds should be  fine. Please note that the advertisement interval of the peer devices should also has to be considered. If the advertisement interval is too high there might not be any success in discovering many devices in small time.

3. If you dont want to miss any advertisement packet you can do following. But this may increase power consumption.

  (scan window at central side) > (advertisement interval at peripheral side)

4. To reduce the power consumption you can increase the scan interval.

5. The code you are using at your side is correct and it works without any issues.

6. To design low power BLE applications Cypress recommends you to go through the following application note:

https://www.cypress.com/documentation/application-notes/an92584-designing-low-power-and-estimating-b...

Please check the above comments and update us.

Thanks

Ganesh

View solution in original post

0 Likes
1 Reply
lock attach
Attachments are accessible only for community members.
VenkataD_41
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

Hi,

The code example is printing correctly at our side, please see the attached image.

1. Please check the UART baud rate on both sides. Reset the terminal and reset the psoc device.

  Please follow the procedure mentioned in the attahed file and check once.

2. There is a trade-off between power consumption and discovering more packets. Since the minimum  advertisement interval for BLE is around 20 milliseconds, scanning at 10 milli seconds should be  fine. Please note that the advertisement interval of the peer devices should also has to be considered. If the advertisement interval is too high there might not be any success in discovering many devices in small time.

3. If you dont want to miss any advertisement packet you can do following. But this may increase power consumption.

  (scan window at central side) > (advertisement interval at peripheral side)

4. To reduce the power consumption you can increase the scan interval.

5. The code you are using at your side is correct and it works without any issues.

6. To design low power BLE applications Cypress recommends you to go through the following application note:

https://www.cypress.com/documentation/application-notes/an92584-designing-low-power-and-estimating-b...

Please check the above comments and update us.

Thanks

Ganesh

0 Likes