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.

MultiRole 2.1 problems



I have installed the multi-role demo for stack 2.1 and I experienced some problem.

First, in the GAP_LINK_ESTABLISHED_EVENT handler,

the connection handle was not assigned, so I fixed that

    case GAP_LINK_ESTABLISHED_EVENT:
      {
        if (pEvent->gap.hdr.status == SUCCESS)
        {          
          LCD_WRITE_STRING("Connected!", LCD_PAGE3);
          LCD_WRITE_STRING_VALUE("Connected to ", gapRoleNumLinks(GAPROLE_ACTIVE_LINKS) ,10, LCD_PAGE0);
          
          connHandle = pEvent->linkCmpl.connectionHandle;
          connecting_state = 0;

Then I noticed a problem when the time came to exchange the MTU.

I modified the function to find that the problem is that GATT_ExchangeMTU returns 0x01 aka FAILURE:

/*********************************************************************
 * @fn      SimpleBLECentral_startDiscovery
 *
 * @brief   Start service discovery.
 *
 * @return  none
 */
static void SimpleBLEMulti_startDiscovery(void)
{
  attExchangeMTUReq_t req;
  
  // Initialize cached handles
  svcStartHdl = svcEndHdl = charHdl = 0;
    
  discState = BLE_DISC_STATE_MTU;
  
  // Discover GATT Server's Rx MTU size
  req.clientRxMTU = maxPduSize - L2CAP_HDR_SIZE;
  
  // ATT MTU size should be set to the minimum of the Client Rx MTU
  // and Server Rx MTU values
  bStatus_t status = GATT_ExchangeMTU(connHandle, &req, selfEntity);
  LCD_WRITE_STRING_VALUE("exch mtu code ",status ,10, LCD_PAGE0);
}

Why would that be?

This is very frustrating, I had a lot of issues and was politely but with a lot of insistence asked to use the new multi-role demo for stack 2.1.

It is not perfect, cant complain about that, but doing so required me to spend a lot of time, and now I am stuck with this problem.

  • Hello Claude,

    We'll look into this. As you can see, MultiRole is quite complex, so thank you in advance for your patience & understanding.

    Best wishes
  • Hello Claude. For the majority of the application code, the connection handle is selected by the menu keys.  However, the connection handle used during discovery (MTU exchange, service discovery, etc) immediately after connection does need to use the connection handle form the link established event as you have figured out. I think the solution here is to use a second variable (connHandleDisc) for this. However, I'm still seeing 0x01 (FAILURE) returned from the MTU exchange. I'm currently debugging this and should have a solution soon.

  • Hi Tim,

    Thanks for looking into this.

  • Hello. It looks like what happened was I included an older patch when I updated it to add the manifest. I've updated the patch on the wiki now so there hopefully shouldn't be any problems.

    Regarding the connection handle business...there is only one variable used so this assumes that no menu keys are pressed to select a different connection between the time a connection is established and the characteristic is discovered. If you need this functionality, you can implement this as mentioned above.
  • Hello,

    I've still the same issue with the GATT_ExchangeMTU returning 1. Do I need to reinstall the BLE stack 2.1?

  • If you're still seeing problems I would recommend cleaning everything: reinstall the stack and use the latest multiRole code from GitHub: github.com/.../multi_role

  • Before I will test the original project and adapt it all again, please could you give me the reason what was causing the return 1 of the GATT_ExchangeMTU function? What code is changed during the last update?

    Additional notes, I'm using two nodes running both the multi role project and one is connecting automatically to the other multi role node. It seems it only happens between two multi role nodes. If the node is connecting to my laptop it's working. I'm using CCS.

    Thanks,

    Peter

  • Hi.  Since there is a known working version of this I don't want to support a broken version. Both code bases are available so you are free to compare them.