This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

set cc2540 in discovery mode very urgent

Other Parts Discussed in Thread: CC2540

Hi

I want to set the dongle cc2540 in the discovery mode when  the dongle recieve the event of terminate link but i don't know how i can do it .

 if(pGapDevDiscEvent->opcode == GAP_LINK_TERMINATED_EVENT)

{ //how i can put the dongle in the discovery mode

    HalLedSet(HAL_LED_2, HAL_LED_MODE_OFF);

}

Best Regards

  • Send an event there and in the code of the event starts advertising :)

    Good luck.

    Also check the forum for things like GAPROLE_ADVERT_ENABLED and GAPROLE_ADVERT_OFF_TIME.

    It is not difficult.

  • I work on a code of my  friend, so a part of the setting of   the connection I did not understand very well , I tried to do  what you have  said but the dongle don't work too.i will show to you the part code I did:

    if(pGapDevDiscEvent->opcode == GAP_LINK_TERMINATED_EVENT)
      { 

      osal_set_event(hciExtApp_TaskID,LINK_ETAB1);

         HalLedSet(HAL_LED_2, HAL_LED_MODE_OFF);
      }

    in the fonction of prossecing the event:


    uint16 HCI_EXT_App_ProcessEvent( uint8 task_id, uint16 events ){

       if(events &  LINK_ETAB1)
      {   
        gapEstLinkReq_t linkReq;
            
        linkReq.taskID = hciExtApp_TaskID;
        linkReq.highDutyCycle = 0x00;
        linkReq.whiteList = WL_NOTUSED;
        linkReq.addrTypePeer = ADDRTYPE_PUBLIC;
        linkReq.peerAddr[0] =  pGapDevDiscEvent->pDevList->addr[0];
        linkReq.peerAddr[1] =  pGapDevDiscEvent->pDevList->addr[1];
        linkReq.peerAddr[2] =  pGapDevDiscEvent->pDevList->addr[2];
        linkReq.peerAddr[3] =  pGapDevDiscEvent->pDevList->addr[3];
        linkReq.peerAddr[4] =  pGapDevDiscEvent->pDevList->addr[4];
        linkReq.peerAddr[5] =  pGapDevDiscEvent->pDevList->addr[5];
        
        GAP_EstablishLinkReq( &linkReq );    
         
        
        return (events ^ LINK_ETAB);
      }   
      }

    Can you help me please ,more than one month that I am the above and I have not succeeded.

    Best Regards

  • I have always worked with the keyfob being the advertiser.

    On the other hand, I do not wark with HCI commands.

    But I guess it should be very similar to the:

    osal_set_event( simpleBLETaskId, START_DEVICE_EVT );

    In fact, this is the last line in the SimpleBLECentral_Init function :)

    Good luck.

  • Can you tell me what  do you  when you recieve the event of" terminate  link "in your remot control  .if is't possible  can you send me the part of code  .

    Best Regards

  • I do not have code, I'm just trying to help you.

  • Thank you for your answer

    Best Regards