13 Replies Latest reply on Oct 23, 2017 10:58 PM by eifu

    CYALKIT-E02 advertising irregular intervals

    emach1_1955091

      Hi, I've noticed that my BLE Sensor is advertising to the Cypress BLE-Beacon App at irregular intervals even when it's physically right next to it under a constant light source. The interval can be as little as 1 second to a minute or sometimes over a few minutes (or stalls for hours).

      I looked at the BLE Sensor firmware source code that was provided and I noticed that it doesn't have random timer for advertising (or at least I didn't see it), so I'm wondering if I received a faulty device? Should the advertising interval be pretty regular and constant ? What could be affecting the irregularity of the advertising sends? What have you experienced?

         

      Thanks in advanced!

        • 1. Re: CYALKIT-E02 advertising irregular intervals
          anpm

          Hi,

             

          Could you please let me know what are the adv settings given in the component (send a screenshot)? Also are yo uchnaging the adv parameter inside the firmware?

             

          Thanks,

             

          Anjana

          • 2. Re: CYALKIT-E02 advertising irregular intervals
            emach1_1955091

            Hi Anjana, How do i determine the adv settings?  I didn't change anything on the firmware other than the major ID (as part of the setup and verify process). 

            • 3. Re: CYALKIT-E02 advertising irregular intervals
              Gyan Chand

              Hi,

                 

              >Yes, the advertising interval be pretty regular and constant.

                 

              > Could you please let us know ,How are you determining the advertising packets interval?

                 

              > We did not experience any issue like this with Cypress BLE-Beacon App.

                 

              Regards,

                 

              Gyan

              • 4. Re: CYALKIT-E02 advertising irregular intervals
                emach1_1955091

                Hi,

                   

                Here are the steps to reproduce. 

                   

                (1) Place beacon under constant sunlight (stationary / non-moving).

                   

                (2) Load up the BLE Beacon iOS app and notice that the incoming rates as logged vary from 1second to almost never. The incoming packets are very sporadic.

                   

                Here's a sample log:

                   

                10:00:00 - iOS app received 1st signal

                   

                10:00:01 - iOS app received 2nd signal (1 sec later)

                   

                10:01:00 - iOS app received 3rd signal (notice 1 minute later)

                   

                10:01:01 - iOS app received 4th signal (1 sec later)

                   

                this continues for a few times more, and then a big long pause...

                   

                10:05:30 - iOS app received Nth signal (time varies from 1 sec, 1 minute, 5 minutes, 10 mins or more).

                   

                I've tested this over multiple days and I never ever get a constant advertising interval. I even tested this on the Android App, which does a bit better at around 3-20 seconds interval over several minutes.

                   

                Question: What's the minimum advertising packet interval?

                • 5. Re: CYALKIT-E02 advertising irregular intervals
                  emach1_1955091

                  Hi - can someone reply to my questions? Just wondering if I received a faulty device. 

                  • 6. Re: CYALKIT-E02 advertising irregular intervals
                    Gyan Chand

                    Hi,

                       

                                   " CYALKIT-E02 Supports BLE communication with a mobile device (iOS 8 or newer / Android 4.4 or newer)"

                       

                    > The iOS BLE-Beacon App has been tested with all iOS versions including latest version iOS 10.1.1 and there is no issue with BLE-Beacon App.

                       

                    Few information I want to know from your side--

                       

                    1) Did you change the company code COID?

                       

                                >>  **If you are using the iOS BLE-Beacon App then you have to set the Apple COID=004C to receive the sensor data for iOS.         

                       

                                         (Please refer to CYALKIT-E02 kit guide( Page 33)).

                       

                    2) Is Android devices have no issue?

                       

                                >> If there is no issue with Android devices then probably you need to change the Company Code for iOS BLE-Beacon.

                       

                           

                       

                    Regards,

                       

                    Gyan

                    • 7. Re: CYALKIT-E02 advertising irregular intervals
                      emach1_1955091

                      Hi Gyan,

                         

                      I changed the sensor ID per the kit guide instructions. It doesn't matter what I change it too as the broadcast is still irregular on both iOS (10+) and Android, so I'm thinking I might have received a faulty sensor/chip.  Are you able to confirm what is the broadcast interval?  

                      • 8. Re: CYALKIT-E02 advertising irregular intervals
                        Gyan Chand

                        Hi,

                           

                        The default advertising interval is 1 sec.

                        • 9. Re: CYALKIT-E02 advertising irregular intervals
                          emach1_1955091

                          Thanks for confirming.  It appears that I do have a faulty BLE sensor.  I've confirmed that the advertising interval on all 4 of my iOS devices and android devices that the advertising intervals are sporadic and irregular ranging from 1sec to 3secs to 30 secs, but never consistently less than 30 seconds.  Can you please help me with exchange/return of the sensor  or let me know what I should do?

                          • 11. Re: CYALKIT-E02 advertising irregular intervals
                            eifu

                            Hi 

                               

                            Many sorry for our late reply. I am application engineer for energy harvesting products. I will answer it.

                               

                            The CYALKIT-E02 has two mode which are "Demo" and "Timer" mode. Both modes are using a power gating control by S6AE103A power management IC (PMIC) to transmit the advertising packet.  Therefore it can't change the advertisement interval from the firmware if you use the solar energy.  But if you use the USB power that connected the Debug Board with Solar BLE Sensor, you can check the set interval by firmware because the power geting control will be disabled (Refer to step 10 of page 29 on CYALKIT-E02 kit guide)

                               

                            The following is description for each modes.
                             Demo - The time interval depends on ambient light. In other word, it means energy driven mode. (Refer to Table 3-1. Light Level Versus Time Interval on page 20) 
                             Timer - The time interval fixed 5-min using external capacitor of PMIC
                            For detail, refer to 5.1.4 Internal Timer Setting Block of page 26.

                               

                            I guess that your issue occurs the demo mode. I will attach a waveform for 3 kind of light power case for CYALKIT-E02. This issue applies to CASE2.

                               

                            To resolve this issue:
                             1. Change the external capacitor for PMIC timer.
                                    Ex: C9 capacitor 2200-pF -> more big capacitor 
                             2. Disable the PMIC timer function, and then input more brighter light
                                    Ex: Remove C7, C9 and C14 capacitors

                               

                            CYALKIT-E02 KIT GUIDE

                               

                            http://www.cypress.com/file/280601/download

                               

                             

                               

                            Regards
                            Eiji Fukawa

                            • 12. Re: CYALKIT-E02 advertising irregular intervals
                              user_483423427

                              Hello eifu,

                              I've read your answer above, it helped me understand more about this kit.

                              I have a question.

                               

                              >But if you use the USB power that connected the Debug Board with Solar BLE Sensor, you can check the set interval

                              >by firmware because the power geting control will be disabled (Refer to step 10 of page 29 on CYALKIT-E02 kit guide)

                               

                              --> I understand that we can disable the PMIC timer function by using USB power the Solar BLE sensor or to remove C7, C9, C14 capacitors.

                              If we do disable PMIC timer function, then BLE interval value set by firmware will be applied, right?

                              Could you tell me the default setting value and  which parameter is used to set that BLE advertisement interval by the firmware?

                               

                              Thanks & Best Regards,

                              • 13. Re: CYALKIT-E02 advertising irregular intervals
                                eifu

                                Hi

                                 

                                You need to change the following "I2C_COUNT_PERIOD_" in void ProcessI2CEvents(void) to change the time interval.

                                   UpdateWdtCounter1(I2C_COUNT_PERIOD_XXX);

                                 

                                Regards

                                Eiji

                                 

                                 

                                // main.c

                                /******************************************************************************

                                * Function Name: ProcessI2CEvents

                                *******************************************************************************

                                *

                                * Summary:

                                *   This function handles I2C events according to current state and update the

                                *   state value.

                                *

                                * Parameters:

                                *   None

                                *

                                * Return:

                                *   None

                                *

                                ******************************************************************************/

                                void ProcessI2CEvents(void)

                                {

                                    CYBLE_API_RESULT_T apiResult = CYBLE_ERROR_OK;

                                   

                                    switch(i2c_state)

                                    {

                                        /* Initialise I2CM and the sensor */

                                        case I2C_START:

                                            /* Handle the case if I2C_COUNTER triggers a new interrupt. */

                                            if(wdt_trigger_on_flag)

                                            {

                                                I2CM_Start();

                                 

                                 

                                 

                                 

                                                I2C_buffer[SI7020_WRITE_REG_INDEX_CMD]  = SI7020_WRITE_USER_REG;

                                                I2C_buffer[SI7020_WRITE_REG_INDEX_DATA] = USER_REG_SETTING;

                                                I2CM_I2CMasterWriteBuf(SI7020_SLAVE_ADDR,

                                                                       I2C_buffer,

                                                                       SI7020_WRITE_REG_SEND_LEN,

                                                                       I2CM_I2C_MODE_COMPLETE_XFER);

                                 

                                 

                                 

                                 

                                                UpdateWdtCounter1(I2C_COUNT_PERIOD_20MS);

                                               

                                                /* Set next I2C state */

                                                i2c_state = I2C_READ_HUMIDITY_SEND_CMD;

                                            }

                                            break;

                                       

                                        /* Perform "Measure Relative Humidity" command to Si7020 */

                                        case I2C_READ_HUMIDITY_SEND_CMD:

                                            /* Handle the case if I2C_COUNTER triggers a new interrupt. */

                                            if(wdt_trigger_on_flag)

                                            {

                                                I2CM_I2CMasterClearStatus();

                                               

                                                /* Request RH data from I2C Sensor */

                                                I2C_buffer[I2C_BUFFER_HUM_OFFSET_CMD] = SI7020_MEASURE_RH;

                                                I2CM_I2CMasterWriteBuf(SI7020_SLAVE_ADDR,

                                                                       &I2C_buffer[I2C_BUFFER_HUM_OFFSET_CMD],

                                                                       SI7020_MEASURE_RH_SEND_LEN,

                                                                       I2CM_I2C_MODE_COMPLETE_XFER);

                                               

                                                UpdateWdtCounter1(I2C_COUNT_PERIOD_20MS);

                                               

                                                /* Set next I2C state */

                                                i2c_state = I2C_READ_HUMIDITY_RECV_DATA;

                                            }

                                            break;

                                       

                                        /* Read back "Measure Relative Humidity" result from Si7020 */

                                        case I2C_READ_HUMIDITY_RECV_DATA:

                                            /* Handle the case if I2C_COUNTER triggers a new interrupt. */

                                            if(wdt_trigger_on_flag)

                                            {

                                                /* Read RH data from I2C Sensor */

                                                I2CM_I2CMasterReadBuf(SI7020_SLAVE_ADDR,

                                                                      &I2C_buffer[I2C_BUFFER_HUM_OFFSET_DATA],

                                                                      SI7020_MEASURE_RH_RECV_LEN,

                                                                      I2CM_I2C_MODE_COMPLETE_XFER);

                                               

                                                UpdateWdtCounter1(I2C_COUNT_PERIOD_20MS);

                                               

                                                /* Set next I2C state */

                                                i2c_state = I2C_READ_TEMP_SEND_CMD;

                                            }

                                            break;

                                       

                                        /* Perform "Read Temperature Value" command to Si7020 */

                                        case I2C_READ_TEMP_SEND_CMD:

                                            /* Handle the case if I2C_COUNTER triggers a new interrupt. */

                                            if(wdt_trigger_on_flag)

                                            {

                                                I2CM_I2CMasterClearStatus();

                                               

                                                /* Request Temperature data from I2C Sensor */

                                                I2C_buffer[I2C_BUFFER_TEM_OFFSET_CMD] = SI7020_READ_TEMP;

                                                I2CM_I2CMasterWriteBuf(SI7020_SLAVE_ADDR,

                                                                       &I2C_buffer[I2C_BUFFER_TEM_OFFSET_DATA],

                                                                       SI7020_READ_TEMP_SEND_LEN,

                                                                       I2CM_I2C_MODE_COMPLETE_XFER);

                                 

                                 

                                 

                                 

                                                UpdateWdtCounter1(I2C_COUNT_PERIOD_20MS);

                                               

                                                /* Set next I2C state */

                                                i2c_state = I2C_READ_TEMP_RECV_DATA;

                                            }

                                            break;

                                       

                                        /* Read back "Read Temperature Value" result from Si7020 */

                                        case I2C_READ_TEMP_RECV_DATA:

                                            /* Handle the case if I2C_COUNTER triggers a new interrupt. */

                                            if(wdt_trigger_on_flag)

                                            {

                                                /* Read Temperature data from I2C Sensor */

                                                I2CM_I2CMasterReadBuf(SI7020_SLAVE_ADDR,

                                                                      &I2C_buffer[I2C_BUFFER_TEM_OFFSET_DATA],

                                                                      SI7020_READ_TEMP_RECV_LEN,

                                                                      I2CM_I2C_MODE_COMPLETE_XFER);

                                               

                                                UpdateWdtCounter1(I2C_COUNT_PERIOD_20MS);

                                               

                                                /* Set next I2C state */

                                                i2c_state = I2C_START_ADV;

                                            }

                                            break;

                                       

                                        /* Start BLEBeacon or Eddystone-UID Advertisement */

                                        case I2C_START_ADV:

                                            /* Handle the case if I2C_COUNTER triggers a new interrupt. */

                                            if(wdt_trigger_on_flag)

                                            {

                                                I2CM_I2CMasterClearStatus();

                                               

                                                /* If the interval is 0, don't advertise any data. */

                                                if(CFG_interval == 0)

                                                {

                                                    /* Set next I2C state */

                                                    i2c_state = I2C_WAIT;

                                                   

                                                    UpdateWdtCounter1(I2C_COUNT_PERIOD_1S);

                                                   

                                                    break;

                                                }

                                                /* If BLEBeacon mode is chosen, prepare the data according to BLEBeacon format. */

                                                else if(pCFG->mode == ADV_MODE_BLEBEACON)

                                                {

                                                     /* Update RH index of ADV packet with a new value */

                                                    cyBle_discoveryData.advData[ADDR_HUM_OFFSET] = I2C_buffer[I2C_BUFFER_HUM_OFFSET_DATA];

                                                   

                                                     /* Update Temperature index of ADV packet with a new value */

                                                    cyBle_discoveryData.advData[ADDR_TEM_OFFSET] = I2C_buffer[I2C_BUFFER_TEM_OFFSET_DATA];

                                                   

                                                    /* Set the next I2C state. */

                                                    i2c_state = I2C_STOP_ADV;

                                                }

                                                /* Eddystone mode is chosen, prepare the data according to Eddystone format. */

                                                else

                                                {

                                                    ES_ADV_CNT++;

                                                    ES_SEC_CNT_ms += BEACON_PERIOD_SENS_ON_1FRAME;

                                                   

                                                    /* Look for the frame which is advertised first. */

                                                    /* Eddystone-UID is on. */

                                                    if(pCFG->frame.UIDisEnabled)

                                                    {

                                                        UpdateAdData3(ES_FRAME_TYPE_UID);

                                                       

                                                        /* Set the next I2C state. */

                                                        /* Eddystone-URL is on. */

                                                        if(pCFG->frame.URLisEnabled)

                                                        {

                                                            i2c_state = I2C_ADV_URL;

                                                        }

                                                        /* Eddystone-TLM is on. */

                                                        else if(pCFG->frame.TLMisEnabled)

                                                        {

                                                            i2c_state = I2C_ADV_TLM;

                                                        }

                                                        /* Only Eddystone-UID is on, stop advertising next time. */

                                                        else

                                                        {

                                                            i2c_state = I2C_STOP_ADV;

                                                        }

                                                    }

                                                    /* Eddystone-UID is off, Eddystone-URL is on. */

                                                    else if(pCFG->frame.URLisEnabled)

                                                    {

                                                        UpdateAdData3(ES_FRAME_TYPE_URL);

                                                       

                                                        /* Set the next I2C state. */

                                                        /* Eddystone-TLM is on. */

                                                        if(pCFG->frame.TLMisEnabled)

                                                        {

                                                            i2c_state = I2C_ADV_TLM;

                                                        }

                                                        /* Only Eddystone-URL is on, stop advertising next time. */

                                                        else

                                                        {

                                                            i2c_state = I2C_STOP_ADV;

                                                        }

                                                    }

                                                    /* Only Eddystone-TLM is on. */

                                                    else

                                                    {

                                                        UpdateAdData3(ES_FRAME_TYPE_TLM);

                                                       

                                                        /* Set next I2C state */

                                                        i2c_state = I2C_STOP_ADV;

                                                    }

                                                }

                                               

                                                apiResult = Beacon_GappStartAdvertisement(CFG_interval);

                                               

                                                /* We don't need WDT counter to wake the system. BLESS will do it. */

                                                CySysWdtUnlock();

                                                CySysWdtDisable(CY_SYS_WDT_COUNTER1_MASK);

                                                CySysWdtLock();

                                            }

                                            break;

                                       

                                        /* Advertise Eddystone-URL frame. */

                                        case I2C_ADV_URL:

                                            /* Handle the case if BLESS finishes Tx of the last frame. */

                                            if(CyBle_GetBleSsState() == CYBLE_BLESS_STATE_EVENT_CLOSE)

                                            {

                                                ES_ADV_CNT++;

                                                ES_SEC_CNT_ms += CFG_interval;

                                               

                                                UpdateAdData3(ES_FRAME_TYPE_URL);

                                               

                                                /* Set the next I2C state. */

                                                /* Eddystone-TLM is on. */

                                                if(pCFG->frame.TLMisEnabled)

                                                {

                                                    i2c_state = I2C_ADV_TLM;

                                                }

                                                /* Eddystone-TLM is off, stop advertising next time. */

                                                else

                                                {

                                                    i2c_state = I2C_STOP_ADV;

                                                }

                                               

                                                apiResult = CyBle_GapUpdateAdvData(&cyBle_discoveryData, &cyBle_scanRspData);

                                            }

                                            break;

                                       

                                        /* Advertise Eddystone-TLM frame. */

                                        case I2C_ADV_TLM:

                                            /* Handle the case if BLESS finishes Tx of the last frame. */

                                            if(CyBle_GetBleSsState() == CYBLE_BLESS_STATE_EVENT_CLOSE)

                                            {

                                                ES_ADV_CNT++;

                                                ES_SEC_CNT_ms += CFG_interval;

                                               

                                                UpdateAdData3(ES_FRAME_TYPE_TLM);

                                               

                                                /* Set next I2C state */

                                                i2c_state = I2C_STOP_ADV;

                                               

                                                apiResult = CyBle_GapUpdateAdvData(&cyBle_discoveryData, &cyBle_scanRspData);

                                            }

                                            break;

                                       

                                        /* Stop advertisement. */

                                        case I2C_STOP_ADV:

                                            /* Handle the case if BLESS finishes Tx of the last frame */

                                            if(CyBle_GetBleSsState() == CYBLE_BLESS_STATE_EVENT_CLOSE)

                                            {

                                                /* Set next I2C state */

                                                i2c_state = I2C_WAIT;

                                           

                                                CyBle_GappStopAdvertisement();

                                               

                                                UpdateWdtCounter1(I2C_COUNT_PERIOD_1S);

                                            }

                                            break;

                                       

                                        /* Wait until the solar cell gathers enough power. */

                                        case I2C_WAIT:

                                            /* Handle the case if I2C_COUNTER triggers a new interrupt. */

                                            if(wdt_trigger_on_flag)

                                            {

                                                /* Set next I2C state */

                                                i2c_state = I2C_READ_HUMIDITY_SEND_CMD;

                                            }

                                            break;

                                           

                                        default:

                                            break;

                                    }

                                   

                                    /* clear wdt_trigger_on_flag if it's set */

                                    if(wdt_trigger_on_flag)

                                    {

                                        wdt_trigger_on_flag = false;

                                    }

                                   

                                    /* If fails to start advertisement or update the advertised data, halt the processor. */

                                    if(apiResult != CYBLE_ERROR_OK)

                                    {

                                        CYASSERT(0);

                                    }

                                }

                                #endif