7 Replies Latest reply on Jun 30, 2015 9:48 AM by kwang

    How to set ID-timer ?

    userc_19040

      I found there are two timer like find timer and 1 sec timer on BCM20737.

       

      IR_TX function is implemented in my application. It needs to repeat between IR_LED on and off.

       

      For example, It has to acts as IR_LED_ON in 200ms and IR_LED_OFF in 800ms.(not us)

       

      Are there any ID-timer defined by programmer? I ran IR_LED_ON function in 200ms .

       

      I want to implement restarting IR_LED_ON function in 800ms .

       

      Some solution supports like function; start_timerEx( uint8 taskID, uint16 event_id, uint32 timeout_value );

       

      I 'm looking forward to BRCM experts' reply.

       

      Thanks in advance.

        • 1. Re: How to set ID-timer ?
          BoonT_56

          We certainly have a catalog of threads on timer itself but I'm not sure have we begin to support IR, at least I don't see any sample app in the SDK.

           

          MichaelF_56

           

          WICED Smart Forums

          • 2. Re: How to set ID-timer ?
            userc_19040

            I found the good example implementing IR_TX.

             

            Refer to below link. I succeed my ir_tx function.

             

            http://community.broadcom.com/message/3621#3621

             

            I am looking for any ID-timer defined by programmer.

            • 3. Re: How to set ID-timer ?
              BoonT_56

              You may check out the below where they described the timer callback using the hw_timer.h

               

              BCM20737S Timer Module

              • 4. Re: How to set ID-timer ?
                BoonT_56

                userc_19040

                 

                Is this still an issue?

                 

                userc_3750

                • 5. Re: How to set ID-timer ?
                  userc_19040

                  I use bt_clock_based_periodic_timer_Enable() function to implement various Timers.

                   

                   

                  I manage to implement IR LED on-off functions .

                   

                   

                  I wonder my ir code produces different timing in IR_LED on`.

                   

                   

                  My ir code is as below.(Repeating between   holding IR_LED on 200ms and IR LED off 200ms)

                   

                   

                  I call bt_clock_based_periodic_timer_Enable(application_timer_expired_callback, NULL, 400000/625);

                   

                   

                  The registered callback function repeats.

                   

                   

                  int application_timer_expired_callback(void* context)

                  {

                       // 400 ms timer callback, do something.

                    ble_trace1("\rtimer_expired_callback()=%ld",ir_tx_ms);

                   

                    irtx_abortCurrentTransaction();

                      //Todo: do you actions here every 1 second

                   

                   

                      send_buffer[0]=HIGH(3400);

                      send_buffer[1]=HIGH(3400);

                      send_buffer[2]=HIGH(3400);

                      send_buffer[3]=HIGH(3400);

                      send_buffer[4]=HIGH(3400);

                      send_buffer[5]=HIGH(3400);

                      send_buffer[6]=HIGH(3400);

                      send_buffer[7]=HIGH(3400);

                   

                      //Send IR Code in 120 second.

                      if(ir_tx_ms < 120000)

                      {

                    irtx_sendData(send_buffer, 8, irtxClockSet);

                    ir_tx_ms=ir_tx_ms+400;

                    }else{

                    bt_clock_based_periodic_timer_Disable();

                    }

                       // Context was not allocated and so does not need to be freed. So return no action.

                       return BLE_APP_EVENT_NO_ACTION;

                  }

                  The below picture says IR timing in the oscilloscope measurement.

                  new_20150617_182731.jpg

                   

                  The red rectangles show IR wave forms. I wonder why my code produces different IR wave forms.

                   

                  I just repeat the same buffer value in my source code.

                   

                  Thanks in advance.

                  • 6. Re: How to set ID-timer ?
                    jota_1939431

                    Hello Victor,

                     

                    1.  The BT clock only gets multiple of 1.25 milliseconds,
                    2.  The bt_clock_based_periodic_timer_enable is not serialized, so application timer as far as callback is going to be called in interupted context
                    3.  If you enable ble trace in this function the connection might eventually drop
                    4.  You cannot trace in this function - It has to be in app thread context which means you have to rewrite this function. 
                    5.  You need to post event to the application thread. 
                    6.  If you look at the running speed cadence, below, which does event seralization, you can trace as much as you like.
                    7.  If you want timing, check on hw_timer.h it is the right thing to do. 
                    8.  Since you only get multiple of 1.25 milliseconds, bt blcock based periodic timer is not serialized.
                    9.  If you are performing "long running stuff" your connection can be droppped.
                    10. If you want more accurate timing use hw_timer.h and the link is here http://community.broadcom.com/thread/4768

                     

                     

                    Hope this helps

                    Thanks

                    JT

                     

                     

                     

                    • 7. Re: How to set ID-timer ?
                      kwang

                      Hi userc_19040, did you get a chance to look at running_speed_cadence?

                       

                      -Kevin