Login Register
Single Connection SDK
Oct 27, 2021 08:42




I have been using for a couple of months IDE/TelinkSDKv1.3.1 downloaded from and everything was working fine.

I have noticed on this page SDK version 3.4.2.

I have downloaded it and tried to compile my code that I used before and I couldn't. The option to set your own pin for BLE security paring (using smp_param_own.paring_tk) was removed from this SDK. Why? If you have a device without any interface (display) you can't do anything without a preset pin!

I found that I have a previous version 3.4.1 of the SDK, that I downloaded earlier.

This version has the option to set your own pin (using smp_param_own.paring_tk)

I compiled my code and tested it on the device and found some problems.

Here are my tests:

device #1 - compiled using multiconnection SDK

device #2 - compiled using single connection SDK v.1.3.1 and then using version 3.4.1

Device #1 connects to device #2.

From Device #1 I call blc_gatt_pushWriteRequest(conn_handle, att_hnd1, buffer, 1)
In BLE GATT data handler call-back - app_gatt_data_handler(u16 connHandle, u8 *pkt) I receive the following:

Response from Device #2 when compiled with SDK v1.3.1

handle 9C 80 opcode 13

Opcode 0x13 = ATT_OP_WRITE_RSP

Response from Device #2 when compiled with SDK v3.4.1

Nothing received!

Then from Device #1, I call: blc_gatt_pushReadRequest(conn_handle, att_hnd1);
In BLE GATT data handler call-back -app_gatt_data_handler(u16 connHandle, u8 *pkt) I receive the following:
Response from Device #2 when compiled with SDK v1.3.1

handle 00 80 opcode 0B
opcode 0B data E1 00

Opcode 0x0B = ATT_OP_READ_RSP

Response from Device #2 when compiled with SDK v3.4.1

Nothing received!

So what is the problem?

Sdk v3.4.1 should be newer, better than v1.3.1, but it doesn't work. And I can't use latest v3.4.2, because some functionality has been removed.

And because Telink provides only precompiled device libraries, I can't really debug to find out what is wrong. And another day wasted!

Any help would be greatly appreciated, otherwise I will be stuck with old SDK v1.3.1.

5 replies
wes58 [Author] Oct 29, 2021 08:55


To get responses I had to add in the code in Sdk v3.4.1 this call:

blc_l2cap_initMtuBuffer(mtu_rx_fifo, MTU_RX_BUFF_SIZE_MAX, mtu_tx_fifo, MTU_TX_BUFF_SIZE_MAX);

This wasn't in the Sdk v1.3

And another day lost.

Why can't we download the handbook for Single Connection SDK for 825x devices from Telink website.

Why do we have to contact sales to get it?

If you go to the website for nRF chips, for example, you can get there everything for their chips.

When will Telink update SDK v3.4.2 to include an option for setting your own pin - like it was in previous versions of the SDK?

Gilbert Oct 30, 2021 20:39

Just yesterday, I found on a Chinese technical resource site for developers, there are handbooks for Single connection SDK 3.4.0, seems released in late 2019,after hard seeking for months. But the main contents are in Chinese,   

The watermark in the pdf contents shows 'Share under NDA'. Although some of it may be dated, I think most contents are helpful, but for developers overseas, the Chinese version may not be meaningful.

I'm a manager as well as the main SW engineer of a starter. 2 years ago someone who had been an engineer of Telink recommended their chips(he already left then), and after cancelling of 826x supply early this year I turned to 825x.  But I hardly get effective supports.  no new- released handbook has really impacted our time-to-market performance.

And thanks to wes58 , we all have seen your contribution to this forum.  Hope we can get better technical support soon.

WeiSun Nov 03, 2021 10:10

Hi, wes58. 

For security, the definition of smp_param_own has been packaged into precompiled libraries in the latest SDK (v3.4.2.0).

You can use the function 'blc_smp_setTK_by_PasskeyEntry (u32 pinCodeInput)' in smp.h to set your own pin. 

wes58 [Author] Nov 03, 2021 13:37

Hi, WeiSun,

Are you sure about this function - blc_smp_setTK_by_PasskeyEntry?

I will try it later on.

But I remember, that when I tried Multi Connection SDK v4.0.0.0 I used function blc_smp_setTK_by_PasskeyEntry().

And I found out that this function can only be used in GAP_EVT_SMP_TK_REQUEST_PASSKEY

It didn't work in GAP_EVT_SMP_TK_DISPALY, you could only use smp_param_own.paring_tk in old Single Connection SDK

int app_host_event_callback (u32 h, u8 *para, int n){
 u8 event = h & 0xFF;

  uint32_t * p = (uint32_t *)&smp_param_own.paring_tk[0];
  memset(p, 0, sizeof(smp_param_own.paring_tk));

  gap_smp_TkReqPassKeyEvt_t* p = (gap_smp_TkReqPassKeyEvt_t*)para;  
  blc_smp_setTK_by_PasskeyEntry(p->connHandle, PIN_CODE);

That's why, in the latest version of the Multi Connection SDK there is another function added blc_smp_setDefaultPinCode(u32 pinCodeInput) which works for setting pincode in GAP_EVT_SMP_TK_DISPALY

In smp.h for this SDK there is the following:

* @brief This function is used to set the default pincode displayed by our side When using the PasskeyEntry.
* @param[in] pinCodeInput - Input pincode value. Value range [000000~999999].
* @return none.
void blc_smp_setDefaultPinCode(u32 pinCodeInput);
void blc_smp_setDefaultPinCode_master(u32 pinCodeInput);
void blc_smp_setDefaultPinCode_slave(u32 pinCodeInput);

* @brief This function is used to set TK by passkey entry method.
* param[in] connHandle - Current ACL connection handle.
* @param[in] pinCodeInput - TK's value, input range [000000, 999999].
* @return none.
u8 blc_smp_setTK_by_PasskeyEntry (u16 connHandle, u32 pinCodeInput);

So I think it will be the same in Single Connection SDK. As I said, I will try it later.

WeiSun Nov 03, 2021 17:28

Yes, you are right. The function blc_smp_setTK_by_PasskeyEntry() can only be used in GAP_EVT_SMP_TK_REQUEST_PASSKEY, It didn't work in GAP_EVT_SMP_TK_DISPALY.  

If you want to use smp_param_own.paring_tk in lastest Single Connection SDK, you can set it as extern variable to access and redeclare the associated struct. 

In the future, the BLE team will consider improving these Settings.