Using embOS with Nordic BLE

From SEGGER Wiki
Jump to: navigation, search

Shipments of embOS for Cortex-M contain several start projects for Nordic Semiconductor's nRF51 and nRF52 devices. Those projects may be used to utilize Nordic's Bluetooth Low Energy (BLE) soft devices, but require a few modifications to do so because of concurrent concepts within embOS and the BLE stack.

Affected functionality Problem description Solution
embOSView via J-Link embOSView communication via J-Link will reserve 32 bytes on the system stack.
Nordic's BLE, however, will also utilize that stack and is not aware of any reserved bytes.
Effectively, the stack gets corrupted by concurrent accesses and the application will fail.
Configure the define OS_VIEW_IFSELECT in the source file RTOSInit_nRF5x.c to any value but OS_VIEW_IF_JLINK (e.g., OS_VIEW_DISABLED, or OS_VIEW_IF_UART if available).
NVIC VTOR All interrupts are routed through the BLE, which also configures the vector table offset register (VTOR). Reconfiguration of that register will cause the application to fail. Comment or delete the line SCB->VTOR = (OS_U32)&__Vectors; from the function OS_InitHW() inside the source file RTOSInit_nRF5x.c.
__WFI() Issuing a wait for interrupt instruction from outside the BLE will cause the BLE to fail. By default embOS will not call __WFI(). However, a commented __WFI() instruction is included in the function OS_Idle() inside the source file RTOSInit_nRF5x.c for demonstration purposes. Check that it still is commented when utilizing the BLE.

Please be aware that in previous shipments of embOS, __WFI() may not be commented by default and the line to configure VTOR may read slightly different; the given solutions to enable the embOS project for usage with the BLE, however, are still the same.