Seriarization (UART) Read blob Failure

Hi, I send application data using Read blob PDU from nRF52832. nRF52832 firmware is connectivity of  Serialization of nRF5_SDK_17.0.2 for UART interface.

After connection, application data is sent using Read blob response. the Unit of transmission is 22byte for application data.

nRF52832 sent broken data at offset 0x0042. And, nRF52832 could not send application data at offset 0x0058.

Why? 

nRF52832 Serialization UART command sequence is below.

SEQ: SD_BLE_CFG_SET (BLE_COMMON_CFG_VS_UUID)
TX : 08 00 00 69 01 00 00 00 01 02
RX : 06 00 01 69 00 00 00 00

SEQ: SD_BLE_ENABLE
TX : 02 00 00 60
RX : 06 00 01 60 00 00 00 00

SEQ: SD_BLE_GAP_ADDR_SET
TX : 0a 00 00 6c 01 00 11 22 33 44 55 66
RX : 06 00 01 6c 00 00 00 00

SEQ: SD_BLE_UUID_VS_ADD
TX : 14 00 00 62 01 67 07 60 a4 84 5d 26 ae 12 41 64 ce 61 28 e5 a6 01
RX : 08 00 01 62 00 00 00 00 01 02

SEQ: SD_BLE_UUID_VS_ADD
TX : 14 00 00 62 01 cd e4 71 b6 c2 2a e6 9e 44 41 8d 88 45 68 78 f3 01
RX : 08 00 01 62 00 00 00 00 01 03

SEQ: SD_BLE_GATTS_SERVICE_ADD
TX : 08 00 00 a8 01 01 a4 84 02 01
RX : 09 00 01 a8 00 00 00 00 01 0e 00

SEQ: SD_BLE_GATTS_CHARACTERISTIC_ADD
TX : 26 00 00 aa 00 00 01 3e 01 00 00 00 00 00 00 00 01 11 11 02 00 01 01 a4 84 02 01 11 11 1d 00 00 00 02 02 00 01 04 00 01
RX : 0f 00 01 aa 00 00 00 00 01 10 00 00 00 11 00 00 00

SEQ: SD_BLE_GATTS_CHARACTERISTIC_ADD
TX : 26 00 00 aa 00 00 01 3e 01 00 00 00 00 00 00 00 01 11 11 02 00 01 01 b6 c2 03 01 11 11 1d 00 00 00 02 02 00 01 04 00 01
RX : 0f 00 01 aa 00 00 00 00 01 14 00 00 00 15 00 00 00

SEQ: SD_BLE_GAP_ADV_SET_CONFIGURE
TX : 38 00 00 72 01 ff 01 01 00 00 00 10 00 01 02 01 06 0c ff 42 04 43 4e 54 31 01 89 54 42 00 02 00 00 00 00 00 01 01 01 00 00 2c 01 00 00 50 46 00 01 00 00 00 00 00 00 01 00 00
RX : 08 00 01 72 00 00 00 00 01 00

SEQ: SD_BLE_GAP_ADV_START
TX : 04 00 00 73 00 00
RX : 06 00 01 73 00 00 00 00

SEQ: BLE_GAP_EVT_CONNECTED

RX : 34 00 02 10 00 03 00 00 d1 d2 d3 d3 d2 d1 01 10 00 10 00 00 00 00 01 00 01 00 00 00 10 00 01 02 01 06 0c ff 42 04 43 4e 54 31 01 89 54 42 00 02 00 00 00 00 00 01

SEQ: BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST
RX : 0d 00 02 51 00 03 00 01 10 00 a4 84 02 00 00
TX : 24 00 00 b0 03 00 01 01 00 00 01 00 00 16 00 01 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15
RX : 06 00 01 b0 00 00 00 00

SEQ: BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST
RX : 0d 00 02 51 00 03 00 01 10 00 a4 84 02 16 00
TX : 24 00 00 b0 03 00 01 01 00 00 01 16 00 16 00 01 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25 26 27 28 29 2a 2b
RX : 06 00 01 b0 00 00 00 00

SEQ: BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST
RX : 0d 00 02 51 00 03 00 01 10 00 a4 84 02 2c 00
TX : 24 00 00 b0 03 00 01 01 00 00 01 2c 00 16 00 01 2c 2d 2e 2f 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f 40 41
RX : 06 00 01 b0 00 00 00 00

SEQ: BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST
RX : 0d 00 02 51 00 03 00 01 10 00 a4 84 02 42 00
TX : 24 00 00 b0 03 00 01 01 00 00 01 42 00 16 00 01 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f 50 51 52 53 54 55 56 57 <- Peer device can receive this application but a part of this data is broken.
RX : 06 00 01 b0 00 00 00 00

SEQ: BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST
RX : 0d 00 02 51 00 03 00 01 10 00 a4 84 02 58 00
TX : 24 00 00 b0 03 00 01 01 00 00 01 58 00 16 00 01 58 59 5a 5b 5c 5d 5e 5f 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d  <- Peer device cannot receive this application data.

B.R.

Parents Reply Children
  • I use attached simple script for python with pyserial. 

    # Serialization (Application chip) serial communication script
    
    import serial
    import array
    
    # *** Open serial port ***
    ser = serial.Serial("COM15", 115200)
    print('\nSeria; port: {0}'.format(ser.name), end='\n\n')
    
    
    ###############################################################
    print('SEQ: SD_BLE_CFG_SET (BLE_COMMON_CFG_VS_UUID)')
    ###############################################################
    
    # *** TX data ****
    txdat=[0x08,0x00,0x00,0x69,0x01,0x00,0x00,0x00,0x01,0x02]
    
    send_binary =bytes(txdat)
    ser.write(send_binary)
    
    print('TX : ', end='')
    for w in txdat:
        print("%02x" % w, end=' ')
    print()
    
    # *** RX data ****
    b_reply = ser.read(1)
    result = ser.read_all()
    
    print('RX :', end=' ')
    for r in b_reply + result:
        print("%02x" % r, end=' ')
    print(end='\n\n')
    
    
    ###############################################################
    print('SEQ: SD_BLE_ENABLE')
    ###############################################################
    
    # *** TX data ****
    txdat=[0x02,0x00,0x00,0x60]
    
    send_binary =bytes(txdat)
    ser.write(send_binary)
    
    print('TX : ', end='')
    for w in txdat:
        print("%02x" % w, end=' ')
    print()
    
    
    # *** RX data ****
    b_reply = ser.read(1)
    result = ser.read_all()
    
    print('RX :', end=' ')
    for r in b_reply + result:
        print("%02x" % r, end=' ')
    print(end='\n\n')
    
    
    ###############################################################
    print('SEQ: SD_BLE_GAP_ADDR_SET')
    ###############################################################
    
    # *** TX data ****
    txdat=[0x0A,0x00,0x00,0x6C,0x01,0x00,0x11,0x22,0x33,0x44,0x55,0x66]
    
    send_binary =bytes(txdat)
    ser.write(send_binary)
    
    print('TX : ', end='')
    for w in txdat:
        print("%02x" % w, end=' ')
    print()
    
    # *** RX data ****
    b_reply = ser.read(1)
    result = ser.read_all()
    
    print('RX :', end=' ')
    for r in b_reply + result:
        print("%02x" % r, end=' ')
    print(end='\n\n')
    
    
    ###############################################################
    print('SEQ: SD_BLE_UUID_VS_ADD')
    ###############################################################
    
    # *** TX data ****
    txdat=[0x14,0x00,0x00,0x62,0x01,0x67,0x07,0x60,0xA4,0x84,0x5D,0x26,0xAE,0x12,0x41,0x64,0xCE,0x61,0x28,0xE5,0xA6,0x01]
    
    send_binary =bytes(txdat)
    ser.write(send_binary)
    
    print('TX : ', end='')
    for w in txdat:
        print("%02x" % w, end=' ')
    print()
    
    
    # *** RX data ****
    b_reply = ser.read(1)
    result = ser.read_all()
    
    print('RX :', end=' ')
    for r in b_reply + result:
        print("%02x" % r, end=' ')
    print(end='\n\n')
    
    
    ###############################################################
    print('SEQ: SD_BLE_UUID_VS_ADD')
    ###############################################################
    
    # *** TX data ****
    txdat=[0x14,0x00,0x00,0x62,0x01,0xCD,0xE4,0x71,0xB6,0xC2,0x2A,0xE6,0x9E,0x44,0x41,0x8D,0x88,0x45,0x68,0x78,0xF3,0x01]
    
    send_binary =bytes(txdat)
    ser.write(send_binary)
    
    print('TX : ', end='')
    for w in txdat:
        print("%02x" % w, end=' ')
    print()
    
    
    # *** RX data ****
    b_reply = ser.read(1)
    result = ser.read_all()
    
    print('RX :', end=' ')
    for r in b_reply + result:
        print("%02x" % r, end=' ')
    print(end='\n\n')
    
    
    ###############################################################
    print('SEQ: SD_BLE_GATTS_SERVICE_ADD')
    ###############################################################
    
    # *** TX data ****
    txdat=[0x08,0x00,0x00,0xA8,0x01,0x01,0xA4,0x84,0x02,0x01]
    
    send_binary =bytes(txdat)
    ser.write(send_binary)
    
    print('TX : ', end='')
    for w in txdat:
        print("%02x" % w, end=' ')
    print()
    
    
    # *** RX data ****
    b_reply = ser.read(1)
    result = ser.read_all()
    
    print('RX :', end=' ')
    for r in b_reply + result:
        print("%02x" % r, end=' ')
    print(end='\n\n')
    
    
    ###############################################################
    print('SEQ: SD_BLE_GATTS_CHARACTERISTIC_ADD')
    ###############################################################
    
    # *** TX data ****
    txdat=[0x26,0x00,0x00,0xAA,0x00,0x00,0x01,0x3E,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x11,0x11,0x02,0x00,0x01,0x01,0xA4,0x84,0x02,0x01,0x11,0x11,0x1D,0x00,0x00,0x00,0x02,0x02,0x00,0x01,0x04,0x00,0x01]
    
    send_binary =bytes(txdat)
    ser.write(send_binary)
    
    print('TX : ', end='')
    for w in txdat:
        print("%02x" % w, end=' ')
    print()
    
    
    # *** RX data ****
    b_reply = ser.read(1)
    result = ser.read_all()
    
    print('RX :', end=' ')
    for r in b_reply + result:
        print("%02x" % r, end=' ')
    print(end='\n\n')
    
    
    ###############################################################
    print('SEQ: SD_BLE_GATTS_CHARACTERISTIC_ADD')
    ###############################################################
    
    # *** TX data ****
    txdat=[0x26,0x00,0x00,0xAA,0x00,0x00,0x01,0x3E,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x11,0x11,0x02,0x00,0x01,0x01,0xB6,0xC2,0x03,0x01,0x11,0x11,0x1D,0x00,0x00,0x00,0x02,0x02,0x00,0x01,0x04,0x00,0x01]
    
    send_binary =bytes(txdat)
    ser.write(send_binary)
    
    print('TX : ', end='')
    for w in txdat:
        print("%02x" % w, end=' ')
    print()
    
    
    # *** RX data ****
    b_reply = ser.read(1)
    result = ser.read_all()
    
    print('RX :', end=' ')
    for r in b_reply + result:
        print("%02x" % r, end=' ')
    print(end='\n\n')
    
    
    ###############################################################
    print('SEQ: SD_BLE_GAP_ADV_SET_CONFIGURE')
    ###############################################################
    
    # *** TX data ****
    txdat=[0x38,0x00,0x00,0x72,0x01,0xFF,0x01,0x01,0x00,0x00,0x00,0x10,0x00,0x01,0x02,0x01,0x06,0x0C,0xFF,0x42,0x04,0x43,0x4E,0x54,0x31,0x01,0x89,0x54,0x42,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x00,0x00,0x2C,0x01,0x00,0x00,0x50,0x46,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00]
    
    send_binary =bytes(txdat)
    ser.write(send_binary)
    
    print('TX : ', end='')
    for w in txdat:
        print("%02x" % w, end=' ')
    print()
    
    
    # *** RX data ****
    b_reply = ser.read(1)
    result = ser.read_all()
    
    print('RX :', end=' ')
    for r in b_reply + result:
        print("%02x" % r, end=' ')
    print(end='\n\n')
    
    
    ###############################################################
    print('SEQ: SD_BLE_GAP_ADV_START')
    ###############################################################
    
    # *** TX data ****
    txdat=[0x04,0x00,0x00,0x73,0x00,0x00]
    
    send_binary =bytes(txdat)
    ser.write(send_binary)
    
    print('TX : ', end='')
    for w in txdat:
        print("%02x" % w, end=' ')
    print()
    
    
    # *** RX data ****
    b_reply = ser.read(1)
    result = ser.read_all()
    
    print('RX :', end=' ')
    for r in b_reply + result:
        print("%02x" % r, end=' ')
    print(end='\n\n')
    
    
    ###############################################################
    print('SEQ: BLE_GAP_EVT_CONNECTED')
    ###############################################################
    
    # *** RX data ****
    b_reply = ser.read(3)
    ope_code = ser.read(1)
    #result = ser.read_all()
    result = ser.read(50)
    
    print('RX :', end=' ')
    for r in b_reply + ope_code + result:
        print("%02x" % r, end=' ')
    print()
    
    chk_code = bytes([0x10]);
    if ope_code != chk_code:
        print('ERR: Invalid opecode')
        exit()
    
    print()
    
    
    ###############################################################
    print('SEQ: BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST')
    ###############################################################
    
    # *** RX data ****
    b_reply = ser.read(3)
    ope_code = ser.read(1)
    result = ser.read_all()
    
    print('RX :', end=' ')
    for r in b_reply + ope_code + result:
        print("%02x" % r, end=' ')
    print()
    
    chk_code = bytes([0x51]);
    if ope_code != chk_code:
        print('ERR: Invalid opecode')
        exit()
    
    # *** TX data ****
    txdat=[0x24,0x00,0x00,0xB0,0x03,0x00,0x01,0x01,0x00,0x00,0x01,0x00,0x00,0x16,0x00,0x01,0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F,0x10,0x11,0x12,0x13,0x14,0x15]
    
    send_binary =bytes(txdat)
    ser.write(send_binary)
    
    print('TX : ', end='')
    for w in txdat:
        print("%02x" % w, end=' ')
    print()
    
    # *** RX data ****
    b_reply = ser.read(1)
    result = ser.read_all()
    
    print('RX :', end=' ')
    for r in b_reply + result:
        print("%02x" % r, end=' ')
    print(end='\n\n')
    
    
    ###############################################################
    print('SEQ: BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST')
    ###############################################################
    
    # *** RX data ****
    b_reply = ser.read(3)
    ope_code = ser.read(1)
    result = ser.read_all()
    
    print('RX :', end=' ')
    for r in b_reply + ope_code + result:
        print("%02x" % r, end=' ')
    print()
    
    chk_code = bytes([0x51]);
    if ope_code != chk_code:
        print('ERR: Invalid opecode')
        exit()
    
    # *** TX data ****
    txdat=[0x24,0x00,0x00,0xB0,0x03,0x00,0x01,0x01,0x00,0x00,0x01,0x16,0x00,0x16,0x00,0x01,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F,0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B]
    
    send_binary =bytes(txdat)
    ser.write(send_binary)
    
    print('TX : ', end='')
    for w in txdat:
        print("%02x" % w, end=' ')
    print()
    
    # *** RX data ****
    b_reply = ser.read(1)
    result = ser.read_all()
    
    print('RX :', end=' ')
    for r in b_reply + result:
        print("%02x" % r, end=' ')
    print(end='\n\n')
    
    
    ###############################################################
    print('SEQ: BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST')
    ###############################################################
    
    # *** RX data ****
    b_reply = ser.read(3)
    ope_code = ser.read(1)
    result = ser.read_all()
    
    print('RX :', end=' ')
    for r in b_reply + ope_code + result:
        print("%02x" % r, end=' ')
    print()
    
    chk_code = bytes([0x51]);
    if ope_code != chk_code:
        print('ERR: Invalid opecode')
        exit()
    
    # *** TX data ****
    txdat=[0x24,0x00,0x00,0xB0,0x03,0x00,0x01,0x01,0x00,0x00,0x01,0x2C,0x00,0x16,0x00,0x01,0x2C,0x2D,0x2E,0x2F,0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F,0x40,0x41]
    
    send_binary =bytes(txdat)
    ser.write(send_binary)
    
    print('TX : ', end='')
    for w in txdat:
        print("%02x" % w, end=' ')
    print()
    
    # *** RX data ****
    b_reply = ser.read(1)
    result = ser.read_all()
    
    print('RX :', end=' ')
    for r in b_reply + result:
        print("%02x" % r, end=' ')
    print(end='\n\n')
    
    
    ###############################################################
    print('SEQ: BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST')
    ###############################################################
    
    # *** RX data ****
    b_reply = ser.read(3)
    ope_code = ser.read(1)
    result = ser.read_all()
    
    print('RX :', end=' ')
    for r in b_reply + ope_code + result:
        print("%02x" % r, end=' ')
    print()
    
    chk_code = bytes([0x51]);
    if ope_code != chk_code:
        print('ERR: Invalid opecode')
        exit()
    
    # *** TX data ****
    txdat=[0x24,0x00,0x00,0xB0,0x03,0x00,0x01,0x01,0x00,0x00,0x01,0x42,0x00,0x16,0x00,0x01,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F,0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57]
    
    send_binary =bytes(txdat)
    ser.write(send_binary)
    
    print('TX : ', end='')
    for w in txdat:
        print("%02x" % w, end=' ')
    print()
    
    # *** RX data ****
    b_reply = ser.read(1)
    result = ser.read_all()
    
    print('RX :', end=' ')
    for r in b_reply + result:
        print("%02x" % r, end=' ')
    print(end='\n\n')
    
    
    ###############################################################
    print('SEQ: BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST')
    ###############################################################
    
    # *** RX data ****
    b_reply = ser.read(3)
    ope_code = ser.read(1)
    result = ser.read_all()
    
    print('RX :', end=' ')
    for r in b_reply + ope_code + result:
        print("%02x" % r, end=' ')
    print()
    
    chk_code = bytes([0x51]);
    if ope_code != chk_code:
        print('ERR: Invalid opecode')
        exit()
    
    # *** TX data ****
    txdat=[0x24,0x00,0x00,0xB0,0x03,0x00,0x01,0x01,0x00,0x00,0x01,0x58,0x00,0x16,0x00,0x01,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F,0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D]
    
    send_binary =bytes(txdat)
    ser.write(send_binary)
    
    print('TX : ', end='')
    for w in txdat:
        print("%02x" % w, end=' ')
    print()
    
    # *** RX data ****
    b_reply = ser.read(1)
    result = ser.read_all()
    
    print('RX :', end=' ')
    for r in b_reply + result:
        print("%02x" % r, end=' ')
    print(end='\n\n')
    
    
    # *** Close serial port ***
    ser.close()
    

  • Hi,

    Could you reproduce this problem?

    I must solve it by the end of this week.

    If you have any updated information, please let me know.

    B.R.

  • Hi, 

    I add this verification result.

    The build configration was "Debug" under this problem.

    If it is changed to "Release", this problem doesn't occur. 

    Can you explain the reason of this difference?

    B. R.

  • H.O said:
    If it is changed to "Release", this problem doesn't occur. 

    Good!

    H.O said:
    Can you explain the reason of this difference?

    Could be some timing issue / race condition.

Related