5 Replies Latest reply on Sep 27, 2016 7:53 PM by JoSu_1330331

    GPIO Pin 35 P32 conflict with HCI UART RX


      Hi, Ms./Mr.,


      I got some trouble when using GPIO Pin 35 P32 as a LED controller and four Button Keys.

      The LEDG can not keep low as program control, continuously.


      The program control LEDs by interrupt of button key press, as below:


      void io_test_interrupt_handler(UINT8 value)


        ble_trace1("Button Key pressed , value:%d", value);

        if(value==2)     //GPIO_PIN_BUTTONG action

             gpio_setPinOutput(GPIO_PIN_LEDG /16, GPIO_PIN_LEDG %16, LED_OFF);

        else if(value==4)     //GPIO_PIN_BUTTONR action

             gpio_setPinOutput(GPIO_PIN_LEDR /16, GPIO_PIN_LEDR %16, LED_OFF);

        else{          // GPIO_PIN_BUTTON1 or GPIO_PIN_BUTTON2 action

             gpio_setPinOutput(GPIO_PIN_LEDR /16, GPIO_PIN_LEDR %16, LED_ON);

             gpio_setPinOutput(GPIO_PIN_LEDG /16, GPIO_PIN_LEDG %16, LED_ON);




      The related GPIO port and setting as below, catch from platform.h:

      #define GPIO_PIN_BUTTON1        0


      #define GPIO_PIN_BUTTON2        4


      #define GPIO_PIN_BUTTONG        8


      #define GPIO_PIN_BUTTONR        33


      #define GPIO_PIN_LEDG           26


      #define GPIO_PIN_LEDR           32


      #define LED_ON                  0

      #define LED_OFF                 1

      #define GPIO_PIN_UART_TX       24

      #define GPIO_PIN_UART_RX       2


      The trouble are:

      1. The Greed LED will light on as key press. but the Rad LED will blanking a little while only. 
        What reason let the Red LED blanking on GPIO Pin 35 P32?
      2. When short HCI UART RX pin with 3V for a second, the Rad LED will start action correctly as Green LED did.
        No matter under Debug Viewer, or not. The blanking trouble disappear until power recycle again. 
      3. The function, "void io_test_interrupt_handler(UINT8 value)", seems only can handle three buttons.
        The value only show out 0, 1, 2 and 4 when related key pressed.
        Especially, "0" also means depressed and one button press or release.
        How could it handle more than three buttons?

      Dear expert, could you give me some help?  Thanks. Best Regards.

        • 1. Re: GPIO Pin 35 P32 conflict with HCI UART RX

          First, P8 and P33 are dual bonded and the same physical pin. You need to use two separate physical pins if you want two separate interrupts. Whichever one of them you use, you must disable the other.


          There are errors with your logical ORs to demarcate which button is which. You're treating GPIO_BUTTON as if it were GPIO_BUTTON0, when it's actually of the same value as GPIO_BUTTON1:

          It should be functional if you fix your pin assignment and change the logical ORs.


          This configuration worked for me:



          1 of 1 people found this helpful
          • 2. Re: GPIO Pin 35 P32 conflict with HCI UART RX

            Dear Jacob,


            If setting as below, how we know Button2, ButtonG & ButtonR were released:


                #define GPIO_SETTINGS_BUTTON1   (GPIO_INPUT  | GPIO_INIT_LOW  | 0x0000 | GPIO_INT)


            The function, void io_test_interrupt_handler(UINT8 value), are called when button key released and send value as zero:

            The value=zero are same as Button1 pressed.  It caused confuse.


            By the way, P8 and P33 are NOT dual bonded and has different physical pin on BCM20736S, that was I used chip.

            • 3. Re: GPIO Pin 35 P32 conflict with HCI UART RX

              Dear Jacob,


              Have you try to use GPIO Pin 35 P32 as LED controller?
              I can not control the LED well.


              Only after pull high a second of Pin HCI UART RX, it will be controlled by program:

                  gpio_setPinOutput(GPIO_PIN_LEDR /16, GPIO_PIN_LEDR %16, LED_ON);


                  gpio_setPinOutput(GPIO_PIN_LEDR /16, GPIO_PIN_LEDR %16, LED_OFF);


              I need use GPIO Pin 35 P32 as LED controller.

              • 4. Re: GPIO Pin 35 P32 conflict with HCI UART RX

                If there is confusion with the values coming through the interrupt handler, simplify your program by registering for different interrupt handlers for each pin. See my post for how to do this: How to Register for an Interrupt, Project 2 Wrap-Up


                I've looked at the data sheets, I can't find any chips with physical pin 35 that matches to P32. What chip are you working on?


                Have you tried configuring the pin anywhere but the default setup? Add this to the bottom of your create function:


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



                • 5. Re: GPIO Pin 35 P32 conflict with HCI UART RX

                  Dear Jacob,


                     Very thanks for your help.



                  According to your suggestion:

                  1. I will see your post, "How to Register for an Interrupt", later.
                  2. The Pin 35 matches to P32 on Page 13 of "BCM20736S Bluetooth Low Energy SiP Module Technical Reference"
                    Ref: BCM20736S Bluetooth Low Energy SiP Module Technical Reference
                  3. As your mention, I did try to add function, "gpio_configurePin( GPIO_PIN_LEDR /16,...", at the bottom of create function before.  And, just tried it again. Sorry, It did not work LEDR properly. 
                    The program just generated by "WICED Bluetooth Designer" and add parts of program just as the first post on the top.

                  Best Regards,
                  Joy Sun