3 Replies Latest reply on Oct 5, 2017 5:39 AM by virajkhatri_2481501

    Unable to connect Peripheral to mobile

    virajkhatri_2481501

      In the attached project, I want to start buzzer (white LED) with accelerometer interrupt.

      Then when connected to any server (mobile in this case) I'll shut off the buzzer

       

      The buzzer is Switching ON but then the device is refusing to connect to the server

      (It shows up and the dynamic advertisement package is working properly)

      I cross checked all major things with the Find Me example project, nothing stands out

      (Find Me was working perfectly with the mobile app I am using "nRF connect" by Nordic Semiconductors)

       

      Problem is mostly in StackEventHandler and the setup of BLE in TopDesign, check there first please

       

      Any help Appreciated,

      Regards,

      Viraj

        • 1. Re: Unable to connect Peripheral to mobile
          e.pratt_1639216

          Change the BLE_bless_isr to have a higher priority interrupt (set it to 2, and leave the rest at 3). Possibly the device is refusing to connect as the interrupts from the BLESS are not working at the correct timing.

          Comment out the CyDelay(1000); and the CyBle_GapDisconnect(dummy); in the event case: CYBLE_EVT_GATT_CONNECT_IND

           

                  case CYBLE_EVT_GATT_CONNECT_IND:

                      UART_UartPutString("Triggered ||| ");

                      connectionHandle = *(CYBLE_CONN_HANDLE_T *)eventParam;

                      RED_Write(1);               /********************/   

                      GREEN_Write(0);             /*  Red,Blue - OFF  */

                      BLUE_Write(1);              /*    Green - ON    */

                      //CyDelay(1000);              /********************/

                      //CyBle_GapDisconnect(dummy);

                      break;

           

          Calling the CyDelay and CyBle_GapDisconnect() while inside the event will cause lots of problems I think.

          The event handler doesn't finish acting on the event until you exit the event handler and "return" to the bless system to finish processing.

          If you are wanting to have the device disconnect after a second, then you will want to use flags being set in the event handler and to act on those flags in the main loop/code. The event handler is still and IRQ/ISR for the bless system and freezing the device for the CyDelay() will lock up the entire chip for the delay. (This is due to the chip being single-threaded versus multithreaded PC programs.)

           

          The bless behaves like a peripheral that is clocked by calls to the CyBle_ProcessEvents() and calls back for data processing requests using the events. If you lock up the events, it will lock up the CPU/chip as well.

          1 of 1 people found this helpful
          • 2. Re: Unable to connect Peripheral to mobile
            virajkhatri_2481501

            I've changed the BLE_bless_isr priority to 2 (0x02) and the other 2 interrupts to 3 (0x03) and removed the delay & disconnect

            However I've encountered another problem in the Accelerometer, so I'll sort that out and then keep the progress posted

            Thanks,

            Viraj

            • 3. Re: Unable to connect Peripheral to mobile
              virajkhatri_2481501

              Yes It's working now, Thanks