HI all,
i am using NRF52832. I have a custom bootloader because it needs to be able to receive an update file via BLE, even if the main application is broken. Also there is no space for two slots for he main app.
So there is just the custom bootloader + main app. The bootloader seems to be working fine. The main app works also as expected when I use a minimal examples (blinky with button triggering an interrupt). However, once I enable BT in my Config with CONFIG_BT=y and CONFIG_BT_PERIPHERAL=y then the app crashes in a very early startup phase in Zephyr, causing a hard fault.
My setup is like this:
Overlay flash partition used for main app.
/ { chosen { zephyr,code-partition = &app_partition; }; aliases { flash0 = &flash0; }; }; &flash0 { partitions { compatible = "fixed-partitions"; boot_partition: partition@0 { label = "bootloader"; reg = <0x00000000 0x00030000>; }; app_partition: partition@30000 { label = "app"; reg = <0x00030000 0x00050000>; }; }; };
Config of main app:
CONFIG_SERIAL=y CONFIG_CPP=y CONFIG_STD_CPP17=y CONFIG_BT=y CONFIG_BT_PERIPHERAL=y CONFIG_BT_DEVICE_NAME="name" CONFIG_USE_DT_CODE_PARTITION=y CONFIG_INIT_ARCH_HW_AT_BOOT=y CONFIG_MPU_ALLOW_FLASH_WRITE=y
If the debugger can be trusted, then the fault occurs somewhere in system_nrf52.c near:
#if NRF52_ERRATA_12_ENABLE_WORKAROUND /* Workaround for Errata 12 "COMP: Reference ladder not correctly calibrated" found at the Errata document for your device located at https://infocenter.nordicsemi.com/index.jsp */ if (nrf52_errata_12()){ *(volatile uint32_t *)0x40013540 = (*(uint32_t *)0x10000324 & 0x00001F00) >> 8; } #endif
I am not sure what causes this problem and also not how to debug further. Maybe I am doing something wrong. Any help will be appreciated. Thanks!