nRF5340 BLE DFU from NET core

Hello! 
Introduction. Responsibilities of the cores in my device:
1. app core. 
1.1. data processing from a stereo microphone
1.2. data sending to net core.
2. net core. 
2.1. ble communication, services supporting. 
2.2. data receiving from app core.

Everything works fine :)
But now I want to add BLE DFU )

As I understood from examples, I should use app core for smp server, so I should use ble communication support on app core, which changes my whole architecture.

Could please anyone help me with that situation? :)

Parents
  • Hi,

    What you want to do is not the standard way to do stuff, so it is not supported or tested.

    However, it can be done.

    First, tell me: Do you want to update both cores?

    How large is your network core application?

    Regards,
    Sigurd Hellesvik

  • For both cores:

    [192/196] Linking CXX executable zephyr\cpuapp.elf
    Memory region    Used Size      Region Size   %age Used
    FLASH:               85552 B         1 MB              8.16%
    RAM:                  399824 B        448 KB          87.15%
    IDT_LIST:           0 GB               2 KB              0.00%

    [210/210] Linking C executable zephyr\cpunet.elf
    Memory region    Used Size       Region Size  %age Used
    FLASH:               254588 B        256 KB          97.12%
    RAM:                  56096 B           64 KB           85.60%
    SRAM1:              0 GB                64 KB           0.00%
    IDT_LIST:            0 GB               2 KB              0.00%

  • It's looks like I should control the transmission thought the notify callback, am I right?
    As I understand the schema:
    [App Core] bt_gatt_notify() ───► [BLE stack] ───► [RPMsg/IPM] ───► [Network Core] ───► [Air]

  • I will try to get you a sample that shows the throughput you need on the nRF5340.
    Guessing I will know in a day or two.

  • That would be great!

  • 3730.throughput_test.zip

    1. Connect to it with the Android app nRF Connect and enable notifications.

    2. Press button 1

    3. Watch logs

  •   could you please specify which version of sdk should I use to build your project?  

Reply Children
  • I tested with v3.0.0 yesterday, if I remember correctly

  • I tested with my phone (nrf Connect).
    I got about 300kbps. 

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    00> [00:00:58.365,325] <inf> app: att MTU updated to 23 bytes
    00> [00:00:58.365,417] <inf> app: Connected
    00> [00:00:58.504,089] <inf> app: att MTU updated to 498 bytes
    00> [00:00:59.089,263] <inf> app: Connection paramaters updated.
    00> - Interval: 7.50 ms
    00> - Latency: 0
    00> - Timeout: 5000 ms
    00> [00:00:59.299,133] <inf> app: att MTU updated to 498 bytes
    00> [00:00:59.344,207] <inf> app: Connection paramaters updated.
    00> - Interval: 48.75 ms
    00> - Latency: 0
    00> - Timeout: 5000 ms
    00> [00:01:03.788,055] <inf> app: Connection paramaters updated.
    00> - Interval: 30.0 ms
    00> - Latency: 0
    00> - Timeout: 4000 ms
    00> [00:01:07.991,790] <inf> app: Notifications enabled
    00> [00:02:23.094,390] <inf> app: Notification size : 495
    00> [00:02:23.094,451] <inf> app: Starting file transfer
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
     

  • I forgot to say thank you for your example)
    I got more faster speed for 6400KB ! 
     

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    00> [00:04:05.062,805] <inf> app: Notification size : 495
    00> [00:04:05.062,866] <inf> app: Starting file transfer
    00> [00:04:05.119,628] <inf> app: Sent 6400 bytes (6 KB) in 57 ms at 898 kbps
    00> [00:04:08.617,431] <inf> app: Notification size : 495
    00> [00:04:08.617,492] <inf> app: Starting file transfer
    00> [00:04:08.681,762] <inf> app: Sent 6400 bytes (6 KB) in 64 ms at 800 kbps
    00> [00:04:11.662,994] <inf> app: Notification size : 495
    00> [00:04:11.663,055] <inf> app: Starting file transfer
    00> [00:04:11.711,853] <inf> app: Sent 6400 bytes (6 KB) in 48 ms at 1066 kbps
    00> [00:04:14.157,989] <inf> app: Notification size : 495
    00> [00:04:14.158,050] <inf> app: Starting file transfer
    00> [00:04:14.201,965] <inf> app: Sent 6400 bytes (6 KB) in 43 ms at 1190 kbps
    00> [00:04:18.228,851] <inf> app: Notification size : 495
    00> [00:04:18.228,912] <inf> app: Starting file transfer
    00> [00:04:18.302,856] <inf> app: Sent 6400 bytes (6 KB) in 74 ms at 691 kbps
    00> [00:04:20.673,400] <inf> app: Notification size : 495
    00> [00:04:20.673,461] <inf> app: Starting file transfer
    00> [00:04:20.736,785] <inf> app: Sent 6400 bytes (6 KB) in 63 ms at 812 kbps
    00> [00:04:22.440,429] <inf> app: Notification size : 495
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX


  • I've modified your example to fit my task. And I made two options, with waiting for sending and without, like yours. The waiting for sending option turned out to be slower.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    00> [00:00:23.436,218] <inf> app: Notifications enabled
    00> [00:00:34.197,937] <inf> app: Start sending data, start time: 34197
    00> [00:00:34.197,967] <inf> app: Sending slab 0
    00> [00:00:34.197,967] <inf> app: Notification size : 495
    00> [00:00:34.198,028] <inf> app: Starting slab transfer
    00> [00:00:34.198,028] <inf> app: enqueue_notify_data, len = 495
    00> [00:00:34.198,089] <inf> app: Queue count = 1
    00> [00:00:34.198,089] <inf> app: Ready to send
    00> [00:00:34.198,364] <inf> app: enqueue_notify_data, len = 495
    00> [00:00:34.198,425] <inf> app: Queue count = 2
    00> [00:00:34.198,425] <inf> app: enqueue_notify_data, len = 495
    00> [00:00:34.198,486] <inf> app: Queue count = 3
    00> [00:00:34.198,516] <inf> app: enqueue_notify_data, len = 495
    00> [00:00:34.198,547] <inf> app: Queue count = 4
    00> [00:00:34.198,577] <inf> app: enqueue_notify_data, len = 495
    00> [00:00:34.198,608] <inf> app: Queue count = 5
    00> [00:00:34.198,638] <inf> app: enqueue_notify_data, len = 495
    00> [00:00:34.198,669] <inf> app: Queue count = 6
    00> [00:00:34.288,696] <inf> app: Queue count = 11
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    00> [00:01:23.992,523] <inf> app: Start sending data, start time: 83992
    00> [00:01:23.992,553] <inf> app: Sending slab 0
    00> [00:01:23.992,553] <inf> app: Notification size : 495
    00> [00:01:23.992,614] <inf> app: Starting slab transfer
    00> [00:01:24.051,696] <inf> app: Sent 6400 bytes (6 KB) in 59 ms at 867 kbps
    00> [00:01:24.151,794] <inf> app: Sending slab 1
    00> [00:01:24.151,794] <inf> app: Notification size : 495
    00> [00:01:24.151,855] <inf> app: Starting slab transfer
    00> [00:01:24.260,375] <err> app: Sent 6400 bytes (6 KB) in 109 ms at 469 kbps
    00> [00:01:24.360,443] <inf> app: Sending slab 2
    00> [00:01:24.360,443] <inf> app: Notification size : 495
    00> [00:01:24.360,504] <inf> app: Starting slab transfer
    00> [00:01:24.443,084] <inf> app: Sent 6400 bytes (6 KB) in 83 ms at 616 kbps
    00> [00:01:24.543,182] <inf> app: Sending slab 3
    00> [00:01:24.543,212] <inf> app: Notification size : 495
    00> [00:01:24.543,273] <inf> app: Starting slab transfer
    00> [00:01:24.623,077] <inf> app: Sent 6400 bytes (6 KB) in 80 ms at 640 kbps
    00> [00:01:24.723,175] <inf> app: Sending slab 4
    00> [00:01:24.723,175] <inf> app: Notification size : 495
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  •   about your approach with delay. 
    How did you determine the delay time and what will happen with packet?
    I mean this code:

        err = bt_custom_tx_send(current_conn, dummy_data, pkt_len);
        if (err) {
          LOG_INF("bt_custom_tx_send() failed (err %d)", err);
          /* Wait for queued notifications elements to be freed */
          k_msleep(5); // why 5ms? Will the package be lost?
        } else {
          bytes_remaining -= pkt_len;
        }