Hello all, I’m experimenting with mynewt for several weeks now and I’m especially impressed by the statistics, logging and image update functionality. I’m having problems with getting all the statistics using newtmgr via BLE.
I took bleprph as base, added ADC and enabled several stats, logs and so on. To reduce flash size I had to switch off debug and reduce the logging. When I started the program I got an Assert-reboot-loop. The target board is a bbc microbit. This seems to be cause of the error: ble_att_svr_entry_mem = malloc( OS_MEMPOOL_BYTES(ble_hs_max_attrs, sizeof (struct ble_att_svr_entry))); if (ble_att_svr_entry_mem == NULL) { rc = BLE_HS_ENOMEM; goto err; } I tweaked these four config values to fix the crash-loop. BLE_ACL_BUF_COUNT: 4 # was 4 BLE_ACL_BUF_SIZE: 128 # was 255 MSYS_1_BLOCK_COUNT: 4 # was 12 MSYS_1_BLOCK_SIZE: 292 # was 292 The program boots now, I can see and connect to the BLE services and all this is fine. If I use newtmgr via ble transport to read the statistics, some of them are responding, others return just Error: 2. mpstat and taskstat also don’t work. But „image list“ is working, I could even upload a new image. My question is: What are the best config settings to reduce ram usage, so that an app runs in 16 kb with least impact on functionality? Some hints to reduce flash size would also be appreciated :-) newtmgr -c ble0b stat list stat groups: ble_att ble_gap ble_gattc ble_gatts ble_hs ble_l2cap ble_ll ble_ll_conn ble_phy stat newtmgr -c ble0b stat ble_att Error: 2 newtmgr -c ble0b stat ble_gap Error: 2 newtmgr -c ble0b stat ble_gattc Error: 2 newtmgr -c ble0b stat ble_gatts stat group: ble_gatts 34 chr_def_reads 8 chr_val_reads 22 chr_val_writes 17 chrs 0 dsc_reads 46 dsc_writes 5 dscs 183 svc_def_reads 0 svc_inc_reads 6 svcs newtmgr -c ble0b stat ble_hs stat group: ble_hs 24 conn_create 23 conn_delete 107 hci_cmd 319 hci_event 0 hci_invalid_ack 0 hci_timeout 1 hci_unknown_event 0 reset 1 sync newtmgr -c ble0b stat ble_l2cap stat group: ble_l2cap 75 chan_create 72 chan_delete 0 proc_timeout 1 sig_rx 0 sig_tx 0 sm_rx 0 sm_tx 0 update_fail 0 update_init 0 update_rx newtmgr -c ble0b stat ble_ll Error: 2 newtmgr -c ble0b stat ble_ll_conn Error: 2 newtmgr -c ble0b stat ble_phy stat group: ble_phy 37138 phy_isrs 0 radio_state_errs 61 rx_aborts 6 rx_crc_err 0 rx_hw_err 0 rx_late 3210 rx_starts 3143 rx_valid 650425 tx_bytes 0 tx_fail 30779 tx_good 0 tx_hw_err 1 tx_late newtmgr -c ble0b mpstat Error: 2 newtmgr -c ble0b taskstat Error: 2 newtmgr -c ble0b image list Images: slot=0 version: 0.4.4 bootable: true flags: active confirmed hash: 4f940c21db9af70698b4f07b6c89e1694022935da5cddd7f1e75f77d2b69e9c4 Split status: N/A (0) =================== This is my configuration: MacBook with blehci running on microbit, connected via adafruit FT242H. blehci is from master blehostd from repository.blehostd: type: github vers: 0-latest user: runtimeco repo: blehostd newtmgr conn show ble0c Connection profiles: ble0b: type=ble, connstring='own_addr_type=random,peer_addr_type=public,peer_addr=0B:0A:0A:0A:0A:0A,bhd_path=blehostd.elf,ctlr_path=/dev/cu.usbserial-142' bleprph was taken from branch mynewt_1_0_0_rc1_tag, but same results with current master pkg.deps: - "@apache-mynewt-core/boot/split" - "@apache-mynewt-core/kernel/os" - "@apache-mynewt-core/mgmt/imgmgr" - "@apache-mynewt-core/mgmt/newtmgr" - "@apache-mynewt-core/mgmt/newtmgr/transport/ble" - "@apache-mynewt-core/net/nimble/controller" - "@apache-mynewt-core/net/nimble/host" - "@apache-mynewt-core/net/nimble/host/services/ans" - "@apache-mynewt-core/net/nimble/host/services/gap" - "@apache-mynewt-core/net/nimble/host/services/gatt" - "@apache-mynewt-core/net/nimble/host/store/ram" - "@apache-mynewt-core/net/nimble/transport/ram" - "@apache-mynewt-core/sys/console/full" - "@apache-mynewt-core/sys/shell" - "@apache-mynewt-core/sys/log/full" - "@apache-mynewt-core/sys/stats/full" - "@apache-mynewt-core/sys/sysinit" - "@apache-mynewt-core/sys/id" - "@mynewt-nrf51-adc-driver/libs/adc_nrf51_driver" syscfg.vals: LOG_LEVEL: 2 LOG_CLI: 1 # Disable central and observer roles. BLE_ROLE_BROADCASTER: 1 BLE_ROLE_CENTRAL: 0 BLE_ROLE_OBSERVER: 0 BLE_ROLE_PERIPHERAL: 1 # Disable unused eddystone feature. BLE_EDDYSTONE: 0 # Log reboot messages to a flash circular buffer. REBOOT_LOG_FCB: 1 LOG_FCB: 1 CONFIG_FCB: 1 # Enable newtmgr commands. STATS_NEWTMGR: 1 LOG_NEWTMGR: 1 # Enable Config. CONFIG_NEWTMGR: 1 # OS main/default task OS_MAIN_STACK_SIZE: 428 SHELL_TASK: 1 STATS_CLI: 1 STATS_NAMES: 1 # RAM reduction BLE_ACL_BUF_SIZE: 128 MSYS_1_BLOCK_COUNT: 4 MSYS_1_BLOCK_SIZE: 292 ADC_0_SCALING: NRF_ADC_CONFIG_SCALING_INPUT_ONE_THIRD ADC_0_INPUT: NRF_ADC_CONFIG_INPUT_2 ADC_0_SAMPLES: 1 BLE_LL_CFG_FEAT_LE_ENCRYPTION: "0" BLE_SM_LEGACY: "0"