BLE Find Me example doesn't work anymore with PSOC 6

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

cross mob
JoMa_4610161
Level 2
Level 2
First like received First like given

Good Morning,

i have downloaded the latest version of the example "BLE Find ME", but ti doesn't work as expected.

The led doesn't blink when is changed the alert Level value on the Find Me Profile screen. The state of USER_LED2 on the device is always the same.

Inside the function ble_findme_process I saw that the flag mcwdt_intr_flag is always false.

Thanks in advanced,

Giuseppe.

0 Likes
1 Solution

Giuseppe,

I have answers to "fix" BLE_Find_Me MTB project.

In the file cybsp_types.h lines 92-95 change:

/** LED 3; User LED1 (red) */

#define CYBSP_LED3                  (P6_3)

/** LED 4; User LED2 (green) */

#define CYBSP_LED4                  (P7_1)

to:

/** LED 3; User LED1 (red) */

#define CYBSP_LED3                  (P7_1)       // Corrected LP 03.23.2020

/** LED 4; User LED2 (green) */

#define CYBSP_LED4                  (P6_3)       // Corrected LP 03.23.2020

In the file ble_findme.c lines 473-474 change:

/* Reload the timer to get periodic interrupt */

     cyhal_lptimer_reload(&mcwdt);

to:

/* Set a new delay for the timer to get periodic interrupt */

    cyhal_lptimer_set_delay(&mcwdt, MCWDT_MATCH_VALUE);

These changes have been tested and now work.  I would appear to me that cyhal_lptimer_reload() is not working as expected or there is something more that needs to be done.  I replaced this function with one that reads the current counter value and adds the delay onto it for the next match.

Len

Len
"Engineering is an Art. The Art of Compromise."

View solution in original post

7 Replies
Len_CONSULTRON
Level 9
Level 9
Beta tester 500 solutions authored 1000 replies posted

Giuseppe,

It's been a little while since I tried out the "Find_Me" example.

Can you archive your project for me to try?  I'd like to see if something got changed.

Also, are you using a PSoC Kit/proto board for your project?  If so, which one?

Len

Len
"Engineering is an Art. The Art of Compromise."
0 Likes
lock attach
Attachments are accessible only for community members.

I'm using PSoC 6 BLE Prototyping Kit (CY8CPROTO-063-BLE)

I have attached the archive with the latest version.

Thanks!

0 Likes

Giuseppe,

I loaded your project into ModusToolbox and programmed my CYPROTO-063-BLE.

What I get is that the CySmart app recognizes that the BLE Find_ME is there.  I connect with it and I can issue No, MILD or HIGH alerts and the RED user LED remains on instead of changing on the alert level sent.

Is this what happens on your system?

Did you change the code from the original example project?

I downloaded the original BLE_Find_Me project into MTB and programmed my CY8CPROTO-063-BLE.  Same results.  Programming the BLE_Find_Me project using PSoC Creator works.  The Green LED blinks until a connection is make with the CySmart App.  Then the RED has the folllowing results:

  • NO ALERT: RED LED off (Default)
  • MILD ALERT: RED LED blinks
  • HIGH ALERT: RED LED full on

I'm still working on why the MTB version does not work correctly.

Len

Len
"Engineering is an Art. The Art of Compromise."
0 Likes

Hi Len,

What you have observed is exactly the same problem of mine. The led remains on.

I didn't change the code, it's the original version. You can check it with "git status" command from bash.

I got it from "New Application" wizard of ModusToolbox 2.0 IDE.

Thanks for your time,

Giuseppe.

0 Likes

Giuseppe,

I have answers to "fix" BLE_Find_Me MTB project.

In the file cybsp_types.h lines 92-95 change:

/** LED 3; User LED1 (red) */

#define CYBSP_LED3                  (P6_3)

/** LED 4; User LED2 (green) */

#define CYBSP_LED4                  (P7_1)

to:

/** LED 3; User LED1 (red) */

#define CYBSP_LED3                  (P7_1)       // Corrected LP 03.23.2020

/** LED 4; User LED2 (green) */

#define CYBSP_LED4                  (P6_3)       // Corrected LP 03.23.2020

In the file ble_findme.c lines 473-474 change:

/* Reload the timer to get periodic interrupt */

     cyhal_lptimer_reload(&mcwdt);

to:

/* Set a new delay for the timer to get periodic interrupt */

    cyhal_lptimer_set_delay(&mcwdt, MCWDT_MATCH_VALUE);

These changes have been tested and now work.  I would appear to me that cyhal_lptimer_reload() is not working as expected or there is something more that needs to be done.  I replaced this function with one that reads the current counter value and adds the delay onto it for the next match.

Len

Len
"Engineering is an Art. The Art of Compromise."

Great Len!

It works. Thanks so much!

Giuseppe.

0 Likes

Giuseppe,

I'm still working on the issue.

It appears that the BLE_Find_Me was a MTB rewrite from the PSoC Creator project of the same name.

From the .md file,  it was a rewrite with the TARGET=CY8CKIT-062-BLE.  I don't have a working CY8CKIT-062-BLE to try it on right now.

However I noticed the following in regards to the TARGET=CY8CPROTO-063-BLE.

  • The RED and GREEN LED port assignments are swapped in cybsp_types.h.  Not a big issue.  This just means that the RED lights up when advertising and the GREEN LED for the Alert.
  • It's a bit challenging to debug, but in essense in the file ble_findme.c the mcwdt_intr_flag is set ONLY the first time when run.  Only when the mcwdt_intr_flag gets set does the Advertising state change the LED state and the Alert gets processed.  Since this occur ONLY ONCE, the LED states do not get changed.

Here's a Debug UART dump of the code state:

PSoC 6 MCU With BLE Connectivity Find Me

[INFO] : BLE stack started

[INFO] : Set device address command has completed

[INFO] : Set LE mask event mask command completed

[INFO] : Set Tx power command completed

[INFO] : Set Tx power command completed

[INFO] : BLE advertisement started

<Connection made on CySmart App>

[INFO] : GATT device connected

[INFO] : GAP enhanced connection complete

[INFO] : GATT MTU Exchange Request received

[INFO] : GATT read characteristic request received

< A change of ALERT LEVEL does not effect the ALERT  LED >

Update:

If I move the switch(alert_level){} outside of the if(mcwdt_intr_flag){}, the alert_level is changing with the CySmart App changes it.  Therefore the BLEss service is working.

I suspect that finding the reason for the mcwdt_intr_flag being set ONLY once may fix this project.

Update:

Right now the best info is that it appears the ble_findme.c\

void mcwdt_interrupt_handler(void *handler_arg, cyhal_lptimer_event_t event)

{

...

    /* Reload the timer to get periodic interrupt */

    cyhal_lptimer_reload(&mcwdt);     // This function appears not to be reloading properly.  Although the return from this function = 0

}

In summary:  I don't believe the BLE_Find_Me port from PSoC Creator to MTB has been fully tested.

Len

Len
"Engineering is an Art. The Art of Compromise."
0 Likes