6 Replies Latest reply on Jun 10, 2019 5:20 AM by AnjanaM_61

    Real clock  and ble problem



      I have a problem with my code where it gives me this event BTM_BLE_CONNECTION_PARAM_UPDATE and this is when I use the rtcClock1.reg32map.rtc32[2];

      can anyone give me a hint as to why and what should I do?

      this is part of my code:

          int i          = 4000;

          int f          = 1;

          int dt         = 500;

          volatile uint16_t voltage_val_adc_in_mv[2*(i+1)];

          volatile uint16_t Time[2*(i+1)];                                                  //initializing the time here

          volatile uint16_t vddio_mv = 0;

          volatile uint16_t temperature;


          vddio_mv = wiced_hal_adc_read_voltage(ADC_INPUT_VDDIO); /* Input channel to measure Reference voltage for Voltage divider calculation for Thermistor */

          WICED_BT_TRACE("\r\nVDDIO_mV\t%d \r\n", vddio_mv);


          // Initialize Time

          tRTC_REAL_TIME_CLOCK rtcClock1;

          rtcConfig.oscillatorFrequencykHz = 32;



          void wiced_hal_gpio_disable_all_inputs();



             for (int j=0 ; j <= i ; j++)


                 voltage_val_adc_in_mv [j]= wiced_hal_adc_read_voltage(CHANNEL_TO_MEASURE_DC_VOLT);



               Time[j]        = rtcClock1.reg32map.rtc32[2];


        • 1. Re: Real clock  and ble problem



          Could you please clarify your query?

          Are you asking how to read the RTC time when BTM_BLE_CONNECTION_PARAM_UPDATE event triggers?

          Please clarify.


          If the query is about how to use rtc block, You may refer to ex13_rtc ( CypressAcademy_WBT101_Files/Projects/wbt101key/ch02 at master · cypresssemiconductorco/CypressAcademy_WBT101_Files · Git…  ) from the gitHub for rtc usage




          2 of 2 people found this helpful
          • 2. Re: Real clock  and ble problem


            sorry for the late response.

            in the for loop at the end of the indicated code, I want to get the real time or the "current" time of each loop

            so I am placing: Time[j]        = rtcClock1.reg32map.rtc32[2];

            but when put this expression, then I can't detect the services of the BLE and the device gets disconnected.

            My question is: what am I doing wrong? and how should I proceed?

            • 3. Re: Real clock  and ble problem

              Hello ,

              I've checked the ex13_rtc and although it is very informative but my problem is not solved for many reasons:


              1) the time in the example goes down to seconds but what I want is in microseconds since I want to acquire data each 200 microseconds and  know the exact time of that acquisition. I was able to do this when I wasn't using the Bluetooth  with the function "rtcClock1.reg32map.rtc32[2];". now I am not able to trigger the notification nor see the services I've created.


              2)the same error occurred when I tried to add the  current time function of the ex13_rtc


              Do you have any suggestions?

              regards and thank you


              • 4. Re: Real clock  and ble problem



                Please note  RTC of our chip doesn't have microseconds accuracy. Also please use the current time function , not rtcClock1.reg32map.rtc32[2] .


                We are not sure how you are implementing the application .

                1. Which chip are you using?

                2. Could you please share the project and steps to reproduce the issue? So that we can suggest accordingly.

                3. Without RTC BLE is working properly?




                1 of 1 people found this helpful
                • 5. Re: Real clock  and ble problem


                  Thank you for your response an time:


                  1. I am currently using the evaluation kit CYW920719Q40EVB-01

                  2.It started working once I reduced the number of iterations

                  3.Yes it was working properly without the RTC BLE


                  I am still working on the project code, found some new issues that are causing problem:

                  1) Regarding the time accuracy; if I use the current time function, will it be more accurate than the RTC? I am acquiring 4 ADC values and I need an accurate time of this acquisition.

                  2) I have a problem when I am sending more than 20 numbers simultaneously  


                  Please check in the file accelerometer_app.c and on line 268, if I increase the number of I to greater than 20, the BLE isn't sending all values.

                  II have a strategy that I want to adapt and I think that I may see some improvements and that is if I separate my acquisition class from my sending class and then iterate the entire sending class to send all values rather than a loop inside it. will it be better and would it solve my problem?

                  • 6. Re: Real clock  and ble problem



                    I noticed new thread created for this issue: Maximum attribute length

                    This will be discussed there