Page 1 of 1

BLE init writes to flash

Posted: Fri Dec 21, 2018 1:54 pm
by PeterR
I wanted to profile free CPU load.
I cannot just create my own lowest priority task as FreeRTOS needs its own idle task to hover up old tasks.

I enabled legacy hooks & added vApplicationIdleHook() to profile interval between calls.
I use a flag to return from vApplicationIdleHook() until the application main is running.
On enabling the flag:

Code: Select all

I (5239) BTDM_INIT: BT controller compile version [bc0b51f]
I (5239) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
I (5359) phy: phy_version: 4000, b6198fa, Sep  3 2018, 15:11:06, 0, 0
I (5599) BLE_SERVER: ble_sk_server_start init bluetooth

Guru Meditation Error: Core  1 panic'ed (Cache disabled but cached memory region accessed)
Core 1 register dump:
PC      : 0x400d53e4  PS      : 0x00060034  A0      : 0x80093c55  A1      : 0x3ffbe890
0x400d53e4: vApplicationTickHook at C:/Users/Stuart/AppData/Roaming/SPB_16.6/esp/main/main/app_main.cpp:56

A2      : 0xf37fa0a0  A3      : 0x00000001  A4      : 0x3ffc8c34  A5      : 0x00000001
A6      : 0x00000001  A7      : 0x000000fe  A8      : 0x80092f6d  A9      : 0x0000abab
A10     : 0x003fffff  A11     : 0x3ffdc580  A12     : 0x7fffffff  A13     : 0x3f40534f
A14     : 0x00000001  A15     : 0x000000fe  SAR     : 0x0000001d  EXCCAUSE: 0x00000007
EXCVADDR: 0x00000000  LBEG    : 0x00000000  LEND    : 0x00000000  LCOUNT  : 0x00000000
Core 1 was running in ISR context:
EPC1    : 0x40086915  EPC2    : 0x00000000  EPC3    : 0x00000000  EPC4    : 0x400d53e4
0x40086915: spi_flash_op_block_func at C:/Users/Stuart/AppData/Roaming/SPB_16.6/esp/esp-idf/components/spi_flash/cache_utils.c:82 (discriminator 1)

0x400d53e4: vApplicationTickHook at C:/Users/Stuart/AppData/Roaming/SPB_16.6/esp/main/main/app_main.cpp:56


Backtrace: 0x400d53e4:0x3ffbe890 0x40093c52:0x3ffbe8c0 0x400950cd:0x3ffbe8f0 0x400847e2:0x3ffbe900 0x40086912:0x00000000
0x400d53e4: vApplicationTickHook at C:/Users/Stuart/AppData/Roaming/SPB_16.6/esp/main/main/app_main.cpp:56

0x40093c52: xPortSysTickHandler at C:/Users/Stuart/AppData/Roaming/SPB_16.6/esp/esp-idf/components/freertos/port.c:436

0x400950cd: _frxt_timer_int at C:/Users/Stuart/AppData/Roaming/SPB_16.6/esp/esp-idf/components/freertos/portasm.S:303

0x400847e2: _xt_lowint1 at C:/Users/Stuart/AppData/Roaming/SPB_16.6/esp/esp-idf/components/freertos/xtensa_vectors.S:1105

0x40086912: spi_flash_op_block_func at C:/Users/Stuart/AppData/Roaming/SPB_16.6/esp/esp-idf/components/spi_flash/cache_utils.c:82 (discriminator 1)
Where the functions following ESP log "__func__ init bluetooth" are esp_bluedroid_init() & esp_bluedroid_enable()

The error manifests as a cache faults presumably as BLE has started a write to FLASH.
1) How would I detect cache disable & so exit (I have IRAM issues & cannot really log instrumentation into IRAM)
2) Is it really necessary for BLE to write to FLASH?

EDIT: Also looks like I am getting calls from both CPUs.
1) Are ticks common/synched on each CPU
2) How do I tell which CPU I am using at any time?