11 Replies Latest reply on Apr 4, 2014 12:26 PM by vsesto

    How to turn on LED

    vsesto


      On page 13 of BCM20732S Technical Reference Manual on page 13 it shows Pin 39 has having dual functionality.

       

      I want to be able to use GPIO:28 alternate function LED1 from the description

       

      How do I go about getting this to work?

        • 1. Re: How to turn on LED
          vsesto

          Let me re-phrase this ...

           

          What simple call do I need to make to keep it powered ON when chip is powered ON?

           

          I got it to blink etc .. .is there a "keep LED ON API"?

          • 2. Re: How to turn on LED
            ArvindS_76

            You can use one of the GPIO API to always drive the GPIO that is connected to the LED instead of using the bleprofile API.

            • 3. Re: How to turn on LED
              vsesto

              Is there a simple example of this or a document to reference?

               

              I am using bleprofile_LEDOn and bleprofile_LEDBlink ... seems like the LEDOn function just blinks once

               

              I would have thought that would keep on the LED on

              • 4. Re: How to turn on LED
                vsesto

                Hello

                 

                What I did to get it to work with the bleprofile LED functions was the following … but I am looking to find a way to keep the LED turned on.

                 

                How do I go about doing this? It is unclear.

                 

                1.

                 

                #include "platform.h" // LED

                 

                 

                2.

                 

                Changed in BLE_PROFILE_CFG

                 

                    /.status_led_enable           =/ 1,       // if 1 status LED is enable

                 

                 

                3.            Added PIN 28 as GPIO_SETTINGS_LED

                 

                 

                BLE_PROFILE_GPIO_CFG glucose_monitor_gpio_config =

                 

                {

                 

                    /.gpio_pin =/

                 

                    {

                 

                        1, 0, 3, 4, 28, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1

                 

                    },

                 

                    /.gpio_flag =/

                 

                    {

                 

                        GPIO_OUTPUT | GPIO_INIT_LOW | GPIO_WP,

                 

                        GPIO_INPUT | GPIO_INIT_LOW | GPIO_BUTTON1 | GPIO_INT,

                 

                        GPIO_INPUT | GPIO_INIT_HIGH | GPIO_BUTTON2 | GPIO_INT,

                 

                        GPIO_INPUT | GPIO_INIT_HIGH | GPIO_BUTTON3 | GPIO_INT,

                 

                        GPIO_SETTINGS_LED,

                 

                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0

                 

                        //0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0

                 

                    },

                 

                };

                 

                 

                4. In the timer … added some code to turn ON LED every seconds as a KEEP ALIVE type of blink. BUT what I want it to do is just stay illuminated when powered up for DEBUG purposes so I know chip is ON. But it just blinks …

                 

                               if( (blebgm_apptimer_count % 5) == 0)

                                {

                                     ble_traceprintf("*** BT ALIVE! *** \r\n");

                                      bleprofile_LEDOn();

                                }

                • 5. Re: How to turn on LED
                  ArvindS_76

                  Assuming your LED is connected to P26 and is active low:

                   

                  1. Don't set up P26 in your BLE_PROFILE_GPIO_CFG structure.

                  2. Drive P26 low when you want to turn it on.

                   

                  #include "gpiodriver.h"

                   

                  void application_create(void)

                  {

                       // all other application initialization

                   

                       // Drive P26 low. If the LED is hooked up right, it will turn on

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

                  }

                  • 6. Re: How to turn on LED
                    vsesto

                    Should the led_enable on the field in BLE_PROFILE_CFG also be set to “0” or “1” ?

                    • 7. Re: How to turn on LED
                      ArvindS_76

                      Set it to 0. You are basically controlling the LED yourself instead of letting the SDK do it for you.

                      • 8. Re: How to turn on LED
                        vsesto

                        So this does not work for me.

                         

                        When I tried using the other mechanism where I setup GPIO 28 using the BLE_PROFILE_GPIO_CFG I do see the LED light up so I know that it is connected correctly.

                         

                        The document has pin 39 and GPIO 28 for the LED. Is there some other special setting for the LED on this GPIO that I need to do with this function?

                        • 9. Re: How to turn on LED
                          vsesto

                          So this does not work for me.

                           

                          When I tried using the other mechanism where I setup GPIO 28 using the BLE_PROFILE_GPIO_CFG I do see the LED light up so I know that it is connected correctly.

                           

                          The document has pin 39 and GPIO 28 for the LED. Is there some other special setting for the LED on this GPIO that I need to do with this function?

                          • 10. Re: How to turn on LED
                            ArvindS_76

                            No, nothing special needs to be done for this LED to function. There was a typo in my message earlier that I corrected to gpio_configurePin(26/16, 26%16, GPIO_OUTPUT_ENABLE, 0); Since your LED is connected to P28, use 28 instead of 26.

                            1 of 1 people found this helpful
                            • 11. Re: How to turn on LED
                              vsesto

                              This works with the divide by 16 etc ... thanks!

                               

                              This can be closed out.