1 2 Previous Next 22 Replies Latest reply on Jun 27, 2014 5:13 AM by userc_6692

    PWM control in BLE SDK


      We use pwm_transitionToSubstituteValues() to control PWM, but it failed even the return value is true.



      Is there any other PWM function?



      The sample code we use is proximity_plus() in SDK 1.0.1


      add the code in bleprox_mod_Create


      gpio_configurePin(1,12,GPIO_OUTPUT_ENABLE, 0); // P28


      // Configure ACLK as the reference clock of the PWM


      aclk_configure(256000, ACLK1, ACLK_FREQ_24_MHZ);




      ass the following function in the callback function bleprox_mod_appFineTimerCb()










        • 1. Re: PWM control in BLE SDK
          Im checking with the development team to see if we can provide any sample application code which will assist with the understanding of utilizing the BCM20732S PWM capability within an application.



          At this point, I am only aware of the Marcos, Enumerations and Functions defined within DocAPIIndex.html (Components->Peripheral Drivers->PWM)
          • 2. Re: PWM control in BLE SDK
            I have conformed with the team that calling pwm_start() every time the fine timer expires is not optimal; once you call start, it will start toggling the GPIO (P28 in this case).



            I am checking to see if we can recommend a more efficient means of calling the same function.
            • 3. Re: PWM control in BLE SDK
              More detail sample code or document of API is helpful for us.


              We tested the API for PWM and GPIO control, but we cant let it work well.


              Only workable is the the initial setting in BLE_PROFILE_GPIO_CFG bleprox_mod_gpio_cfg ={ }



              As we set the initial status is high for gpio, we cant find the way to pull it to low in application level.



              • 4. Re: PWM control in BLE SDK
                Take a look at the RAM based automation_io client application thats provided with the SDK. 



                I spoke with a developer and he was pretty sure that this application should provide working PWM code.
                • 5. Re: PWM control in BLE SDK
                  Is there any way I can observe what is going on in automation_io.c? I was playing around with hellosensor.c and it was pretty intuitive to see the different things I could do(press the button to have a count, write a number to have the LED flash a certain number times). Are there things I can check to see automation_io in action as well?
                  • 6. Re: PWM control in BLE SDK
                    SW1 (white button) on the Tag board interfaces to the BCM20732 via Pin 19 (VDDO/Digital-in).



                    If you were able to map this to a buzzer/LED also on the board (Digital-out), it seems that this demonstrate that the application was able to receive notification or indication when corresponding signal is changed.



                    Nothing has been created for this yet, but its an idea.
                    • 7. Re: PWM control in BLE SDK
                      We can use ble_pwn_init+ble_pwm_set and it can pull high for the PWM.


                      For the disable, we cant use ble_pwn_off to turn off the PWM.


                      Is there any sample code for the control?


                      The function description is limited and we didnt find the clear definition in the API.
                      • 8. Re: PWM control in BLE SDK
                        Heres a simple example that the firmware team provided:



                        void app_create(void)




                               // PWM sample. Use P26


                               UINT16 init_value = 0x000;


                               UINT16 toggle_val = 0x100;



                               aclk_configure(256000, ACLK1, ACLK_FREQ_24_MHZ);


                               gpio_configurePin(26/16,26%16,GPIO_OUTPUT_ENABLE, 0);







                        void app_timeout(UINT32 arg)




                            static int iiii = 0;







                            case 0:


                               // Change period


                               pwm_transitionToSubstituteValues(PWM0, 0x400, 0x00);




                            case 1:


                               // Invert


                               pwm_setInversion(PWM0, 1);




                            case 2:


                               // Disable inversion


                               pwm_setInversion(PWM0, 0);




                            case 3:


                               // Change frequency


                               pwm_transitionToSubstituteValues(PWM0, 0x50, 0x00);




                            case 4:


                               // Nothing




                            case 5:


                               pwm_startWithAlternateValues(PWM0, PMU_CLK,0x800, 0x100, 0);




                            case 6:


                               // Disable channel.


                               pwm_setReset(PWM0, 1);




                            case 7:


                               pwm_transitionToSubstituteValues(PWM0, 0x100, 0x00);







                            iiii = (iiii + 1) & 7;



                        • 9. Re: PWM control in BLE SDK
                          The following are 3 ways we tested to disable the PWM function include the suggestion, but we still cant let PWM work well.



                          Is there any description for each function?



                          • 10. Re: PWM control in BLE SDK
                            I will ask someone from the firmware team to respond.  Most are out for the holidays, so it may be next week before someone is able to respond.
                            • 11. Re: PWM control in BLE SDK

                              Is there any update about the PWM function?

                              • 12. Re: PWM control in BLE SDK

                                The post from the 24th with the three methods used to disable the PWM function, including function descriptions seems to have gotten cut off.


                                Can you repost the names of the three functions you would like more information on?

                                • 13. Re: PWM control in BLE SDK

                                  function “pwm_setReset(DWORD mask, BOOLEAN resetEnable);” to disable pwm, it does not work.

                                  It only stops pwm signal but not pull the level to low.

                                  I use this function with below methods but all are failed.


                                  #define AIO_PWM1       26

                                  #define AIO_PWM_BASE   26


                                         pwm_ setReset (1 << (AIO_PWM1- AIO_PWM_BASE), 1);

                                     //pwm_ setReset ((AIO_PWM1- AIO_PWM_BASE), 1);

                                      //pwm_ setReset (AIO_PWM1, 1);



                                  But, if I use this function “pwm_disableChannel(DWORD mask);”, it merely sometimes pull the PWM GPIO down failed.


                                      pwm_disableChannel(1 << (gpio - AIO_PWM_BASE));



                                  If we also set the PWM GPIO to be a BUZZER one, we could use the function “bleprofile_BUZBeep(bleprofile_p_cfg->buz_on_ms);” to control the pin.

                                  But this pin will become low automatically after  the time “buz_on_ms”.

                                  • 14. Re: PWM control in BLE SDK

                                    Did you disable output on the GPIO when you reset the PWM (and you can insert an internal pull-down/pull-up)? Do you have anything connected to the GPIO? If yes, then can you try disconnecting it and then see if the PWM goes low when you reset it?


                                            case 6:
                                               // Disable channel.
                                               pwm_setReset(PWM0, 1);
                                               gpio_configurePin(26/16, 26%16, GPIO_OUTPUT_DISABLE | GPIO_PULL_DOWN, 0);

                                    1 2 Previous Next