5 Replies Latest reply on Oct 29, 2015 3:02 PM by userc_13905

    blecenhandleConnParamUpdateReq() recieves wrong parameters



      I'm trying to get the master to process a bleprofile_SendConnParamUpdateReq(100, 300, 1, 600) from a slave.  I'm developing code for both master and slave.  I can use blecm_ConnectionUpdate() to change the connection parameters, but I can not get the slave to change them.  It seems that the data received on the master is not correct but using a sniffer the data looks good.


      Here's data from the sniffer:

      Parallels Picture.png


      On the master when I dump out the trace, I see the following:


      16:34:53 - blecm evt handler:

      16:34:53 - 0e04010e200c

      16:34:53   Connection is UP.

      16:34:53   connUp

      16:34:53   noAdv

      16:34:53   ConnTimer stopped: 1

      16:34:53   NoConn

      16:34:55 -

      16:34:55 - l2cap Rx:

      16:34:55 - 40201700130004001b2a00aa140de008

      16:34:55 - 0000c7180800dd6ab33e89

      16:34:55 - Notification:2a, 16

      16:34:55 - aa140de0080000c7180800dd6ab33e89

      16:34:55 -

      16:34:55 - l2cap Rx:

      16:34:55 - 402010000c0005001201080064002c01

      16:34:55 - 01005802

      16:34:55 -

      16:34:55 - l2cap Tx:

      16:34:55 - 40200a0006000500130102000000

      16:34:55 -

      16:34:55 - blecm evt handler:

      16:34:55 - 0f0402011320

      16:34:55   ConnParamUpdateReq

      16:34:55   ConnParamUpdate:Min Interval: 100, Max Interval: 300

      16:34:55   ConnParamUpdate: Slave LAtency: 0, timeout: 0

      16:34:55 -

      16:34:55 - blecm evt handler:

      16:34:55 - 13050140000100


      It seems like both slave latency and supervisor timeouts are incorrect at 16:34:55.


      Here's the image footprint on the master.


      Patches start at              0x00204568 (RAM address)
      Patches end at                0x00205504 (RAM address)
      Application starts at         0x00205140 (RAM address)
      Application ends at           0x00206FD2 (RAM address)


      Patch size (including reused RAM)   3996 bytes
      Patch size                          3032 bytes
      Application size                    7826 bytes
      Total RAM footprint                10858 bytes (10.6kiB)


      Is this a bug on the BLE stack?  I'm using SDK2.2.1.71




        • 1. Re: blecenhandleConnParamUpdateReq() recieves wrong parameters

          I have used similar connection parameters successfully with an iPhone master, so I would suspect the bug is in the master, not the slave.  It may be that the master doesn't like your parameter selections for whatever reason. The master is not obligated to accept the parameters the slave requests, so I don't know if you can technically call it a bug, but it doesn't seem right. I'm using SDK 2.2.1 also.

          • 2. Re: blecenhandleConnParamUpdateReq() recieves wrong parameters

            Yes the problem is on the master, but I'm also using SDK2.2.1 on the master.  From the debug trace of the master you can see that slave latency and timeout are both zero while the slave sends those as 1, 600 and those are confirmed with the sniffer trace


            Here is the Wiced-smart function in question:


            int blecenhandleConnParamUpdateReq(LEL2CAP_HDR *l2capHdr)


                LEL2CAP_COMMAND_HDR *cmdPkt = (LEL2CAP_COMMAND_HDR *) l2capHdr;


                extern void lel2cap_sendConnParamUpdateRsp(UINT16 identifier, UINT16 result);


                TRACE(TRACE_INFO, MODULE_ID_BLEAPP, "ConnParamUpdateReq", TVF_D(0));


                if(cmdPkt->len == 8)


                    LEL2CAP_CMD_CONN_PARAM_UPDATE_REQ *req =

                                                                  (LEL2CAP_CMD_CONN_PARAM_UPDATE_REQ *) (&(cmdPkt->code));


                    TRACE(TRACE_INFO, MODULE_ID_BLEAPP, "ConnParamUpdate:Min Interval: %d, Max Interval: %d", TVF_WW(req->minInterval, req->maxInterval));

                    TRACE(TRACE_INFO, MODULE_ID_BLEAPP, "ConnParamUpdate: Slave LAtency: %d, timeout: %d", TVF_WW(req->slaveLatency, req->timeout));












                    lel2cap_sendConnParamUpdateRsp(req->identifier, 0); //always accept


                    return 0;



                return -1;



            The problem is the the req->slaveLatency and req->timeout are not correct.  Note I've also tested this by modifying all four parameters and the minInterval and maxInterval are updated correctly but the other two seems to be always zero.


            It seems that the *l2capHdr is not filled out with the received data from the caller.

            • 3. Re: blecenhandleConnParamUpdateReq() recieves wrong parameters

              I've enabled cfa_mm_MemFreeBytes() and blecm_DidStackOverflow() to see if this is related to some stack issue.  There's plenty of free memory and no overflows.


              Anyone else see the master not getting the correct parameters?




              • 4. Re: blecenhandleConnParamUpdateReq() recieves wrong parameters

                Hello userc_13905


                You need add a patch to your make file: