2 Replies Latest reply on Mar 19, 2019 9:37 AM by p.schroeer_1536336

    INVALID_PARAMETER error while connecting

    p.schroeer_1536336

      Hi,

       

      I'm using a CYBLE-212006 module in combination with PSoC Creator 4.2.

       

      I try to connect to a ble peripheral as shown in Day011_Central_Observer project from 100 Projects in 100 Days.

       

      1. I scan for peripherals
      2. Everytime I found one, I store this peripheral in an array
      3. After stopping the scan I try to connect to the selected peripheral.
      4. When I call apiResult = CyBle_GapcConnectDevice(&connectPeriphDevice[Periph_Selected]); the Api result is CYBLE_ERROR_INVALID_PARAMETER

       

       

      What does this error mean and how to fix?

       

      Here a a code snipped:

       

       

       

       

      CYBLE_GAP_BD_ADDR_T     connectPeriphDevice[10];

       

      /*

      * Function Name: Get_Adv_Scan_Packets

      */

       

      void Get_Adv_Scan_Packets(CYBLE_GAPC_ADV_REPORT_T* scanReport){

      uint8 RepIndex; //Index for Bytes in Scan Response Packet {

              if (devIndex < 9) {

                   IsDetected = 1;

                  // Receiving Advertisement Packet

                  if ((scanReport->eventType == CYBLE_GAPC_CONN_UNDIRECTED_ADV)||

                      (scanReport->eventType == CYBLE_GAPC_CONN_DIRECTED_ADV)||

                      (scanReport->eventType == CYBLE_GAPC_SCAN_UNDIRECTED_ADV)||

                      (scanReport->eventType == CYBLE_GAPC_NON_CONN_UNDIRECTED_ADV)){

                    

                      memcpy(connectPeriphDevice[devIndex].bdAddr, scanReport->peerBdAddr,

                      sizeof(connectPeriphDevice[devIndex].bdAddr));

                   

                      devIndex++;

                  }

              }

              else {

                  printf ("Device Counts Exceeds 10 \r\n");

              }

          }

      }

       

       

       

      //This function is called in main.c

       

      void Handle_ble_Central_Observer_State(void) {

           if (CYBLE_STACK_STATE_BUSY == CyBle_GattGetBusStatus()){

                /*If stack is busy wait for ready signal*/

                return;

           }

       

           if (!IsConnected) {

                if(CYBLE_STATE_DISCONNECTED == CyBle_GetState()) {

                    if(IsSelected) {

                          apiResult = CyBle_GapcConnectDevice(&connectPeriphDevice[Periph_Selected]);     //ERROR

                          if(CYBLE_ERROR_OK != apiResult ){

                               printf ("Connection Request to peripheral failed \r\n");

                          }

                      IsSelected = 0;

                   }

                }

           }

      }

       

       

      Thanks!

       

      Pascal

        • 1. Re: INVALID_PARAMETER error while connecting
          SayaniS_66

          Hello,

           

          CYBLE-212006 is a Extended Range module and so this feature needs to be enabled in the code before programming. Please incorporate the following lines and it should work.

           

          Please define the test register to switch the PA/LNA hardware control pins :

           

          #define CYREG_SRSS_TST_DDFT_CTRL 0x40030008

           

          Then, in the event CYBLE_EVT_STACK_ON, please include the following code snippet to enable the PA/LNA and configure the Link Layer to automatically switch PA control pin P3[2] and LNA control pin P3[3]:

           

          case CYBLE_EVT_STACK_ON:

          CY_SET_XTND_REG32((void CYFAR *)(CYREG_BLE_BLESS_RF_CONFIG), 0x0331);

          CY_SET_XTND_REG32((void CYFAR *)(CYREG_SRSS_TST_DDFT_CTRL), 0x80000302);

           

          -Sayani.

          • 2. Re: INVALID_PARAMETER error while connecting
            p.schroeer_1536336

            Hi, your post is a good hint, but I already did that. Anyway, I solved the issue by just coping the ble 3.51 module from a github project into my project. I don't know the reason but in my project there was only a 3.50 version available. The component updater didn't show me any available update for this module. After the cooy process everything works fine for me! Regards Pascal