Hi !
I'm running the ble_app_hrs_freertos example from SDK11 on the nRF52 dev. kit.
I would like to toggle some GPIOs to monitor the CPU activity and the FreeRTOS context. More specifically I would like to :
- Have a GPIO in logic state low while the CPU is asleep and in logic state high while the CPU is running (in softdevice, in a task, in an interrupt, etc.)
- Have a GPIO in logic state high while the CPU is working in the softdevice part and in logic state low when it isn't
Can you help me achieve this ? I already know how to monitor FreeRTOS tasks activity by redefining traceTASK_SWITCHED_OUT and traceTASK_SWITCHED_IN but I can't find how to monitore softdevice activity and the overall CPU activity. This also allow to monitor the Idle task activity, but it doesn't cover the softdevice and interrupts parts, does it ?
Here are my traceTASK_SWITCHED_OUT and traceTASK_SWITCHED_IN macros (25 being the GPIO I use for the Idle task) :
#ifndef traceTASK_SWITCHED_OUT
/* Called before a task has been selected to run. pxCurrentTCB holds a pointer
to the task control block of the task being switched out. */
#define traceTASK_SWITCHED_OUT() if(xTaskGetIdleTaskHandle() == pxCurrentTCB) \
{ nrf_gpio_pin_clear(25); } \
else { nrf_gpio_pin_clear((int)pxCurrentTCB->pxTaskTag ); }
#endif
#ifndef traceTASK_SWITCHED_IN
/* Called after a task has been selected to run. pxCurrentTCB holds a pointer
to the task control block of the selected task. */
#define traceTASK_SWITCHED_IN() if(xTaskGetIdleTaskHandle() == pxCurrentTCB) \
{ nrf_gpio_pin_set(25); } \
else { nrf_gpio_pin_set((int)pxCurrentTCB->pxTaskTag ); }
#endif