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%

  •  
    * Thanks, I will investigate all three ways. 

    * Net core flash usage is so big. I reduced it by logging disabling. Could you please tell me how to reduce it more efficiently? I attached the file from 'rom_report'. The section 'no paths' takes 50% :(
    net_core_flash_usage.txt

    * To be honest, I had doubts about my architecture. The app core continuously accumulates data from the microphone for a certain time and transmits it in chunks to the network core, which then sends the data via BLE. I did this to unload the app core so that it would not send data over BLE. Maybe I use the wrong way and there would be no problems with continuously receiving and sending data. I need your opinion.

  • static struct bt_gatt_attr smp_bt_attrs[] = {
        /* SMP Primary Service Declaration */
        BT_GATT_PRIMARY_SERVICE(&smp_bt_svc_uuid),

        BT_GATT_CHARACTERISTIC(&smp_bt_chr_uuid.uuid,
                       BT_GATT_CHRC_WRITE_WITHOUT_RESP |
                       BT_GATT_CHRC_NOTIFY,
    #ifdef CONFIG_MCUMGR_TRANSPORT_BT_AUTHEN
                       BT_GATT_PERM_WRITE_AUTHEN,
    #else
                       BT_GATT_PERM_WRITE,
    #endif
                       NULL, smp_bt_chr_write, NULL),
        BT_GATT_CCC(smp_bt_ccc_changed,
    #ifdef CONFIG_MCUMGR_TRANSPORT_BT_AUTHEN
                       BT_GATT_PERM_READ_AUTHEN |
                       BT_GATT_PERM_WRITE_AUTHEN),
    #else
                       BT_GATT_PERM_READ | BT_GATT_PERM_WRITE),
    #endif
    };

    With corresponding CONFIG_x values in 'peripheral_lbs' example we have attributes without response where mcumgr writes the data. 
    I think I can write BLE service wrapper of smp service to get data and send it to app core (data, len). On app core I can write smp_uart wrapper to receive data. What do you think about it?
  • valeriy_simakov said:
    static struct bt_gatt_attr smp_bt_attrs[] = {
        /* SMP Primary Service Declaration */
        BT_GATT_PRIMARY_SERVICE(&smp_bt_svc_uuid),

        BT_GATT_CHARACTERISTIC(&smp_bt_chr_uuid.uuid,
                       BT_GATT_CHRC_WRITE_WITHOUT_RESP |
                       BT_GATT_CHRC_NOTIFY,
    #ifdef CONFIG_MCUMGR_TRANSPORT_BT_AUTHEN
                       BT_GATT_PERM_WRITE_AUTHEN,
    #else
                       BT_GATT_PERM_WRITE,
    #endif
                       NULL, smp_bt_chr_write, NULL),
        BT_GATT_CCC(smp_bt_ccc_changed,
    #ifdef CONFIG_MCUMGR_TRANSPORT_BT_AUTHEN
                       BT_GATT_PERM_READ_AUTHEN |
                       BT_GATT_PERM_WRITE_AUTHEN),
    #else
                       BT_GATT_PERM_READ | BT_GATT_PERM_WRITE),
    #endif
    };

    Im not a BLE expert, but I can suggest that if you want to verify this, check our DFU SMP service ( and .c file), as this is the closest we got to that.

    But yes, this implementing of your own service for SMP.

    valeriy_simakov said:
    I think I can write BLE service wrapper of smp service to get data and send it to app core (data, len).

    Nice!

    valeriy_simakov said:
    On app core I can write smp_uart wrapper to receive data. What do you think about it?

    I would suggest that you use DFU Target on the application core to receive the data. This is the library we have for custom handling of received DFU binaries.

  • Hi  
    Well, I'm stuck on the "wrapper of smp service" on the app core side. I couldn't find an example of DFU Target usage in my sdk. 
    Now I'm trying to use the "common way". I'm worried about BLE speed, because now I use BLE stack on the app core. But as I understand physically, net core will send the final data, am I right?

  • I mean, does the app core use the ble api via rpmsg in net core ? Аnd all the ble stack is contained in the network core.

Reply Children
No Data
Related