一、Firmware
1. sdk_config.h
#define NRF_LOG_BACKEND_RTT_ENABLED 1
#define NRF_LOG_ENABLED 1
2. header files
#include "nrf_log.h"
#include "nrf_log_ctrl.h"
#include "nrf_log_default_backends.h"
3. initialization function
void log_init(void)
{ret_code_t err_code = NRF_LOG_INIT(NULL);APP_ERROR_CHECK(err_code);NRF_LOG_DEFAULT_BACKENDS_INIT();
}
4. flush log buffer function
NRF_LOG_PROCESS();
5. main function
int main(void)
{log_init();NRF_LOG_INFO("RTT_LOG");for(;;){if (NRF_LOG_PROCESS() == false){nrf_pwr_mgmt_run();}
}
二、Software
1. JLink.exe
2. JLink RTT Viewer