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

    Real clock  and ble problem

    ArTc_3305816

      Hi

      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;

          rtc_init();

       

          void wiced_hal_gpio_disable_all_inputs();

          wiced_hal_adc_set_input_range(ADC_RANGE_0_3P6V);

       

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

             {

                 voltage_val_adc_in_mv [j]= wiced_hal_adc_read_voltage(CHANNEL_TO_MEASURE_DC_VOLT);

       

               rtc_getRTCRawClock(&rtcClock1);

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

             }

        • 1. Re: Real clock  and ble problem
          AnjanaM_61

          Hello,

           

          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

           

          Thanks,

          Anjana

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

            Hi

            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
              ArTc_3305816

              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
                AnjanaM_61

                Hello,

                 

                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?

                 

                Thanks,

                Anjana

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

                  Hii

                  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
                    AnjanaM_61

                    Hi,

                     

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

                    This will be discussed there

                     

                    Thanks,
                    Anjana