Hi
I'm using a SparkFun Pro nRF52840 Mini which has a UART on PIN 17(TX) and 15(RX). I've written a very simple piece of code to blink the onboard LED on and off and to write to NRF_LOG as a basic starting block for application development. I've connected a serial UART to PINs 17 & 15 (tested that this is working using loop back via CoolTerm).
I'm unable to get any output of the serial using NRF_LOG. The application compiles and the LED blinks as requested.
Within sdk_config.h :-
// <e> NRF_LOG_BACKEND_UART_ENABLED - nrf_log_backend_uart - Log UART backend //========================================================== #ifndef NRF_LOG_BACKEND_UART_ENABLED #define NRF_LOG_BACKEND_UART_ENABLED 1 #endif // <o> NRF_LOG_BACKEND_UART_TX_PIN - UART TX pin #ifndef NRF_LOG_BACKEND_UART_TX_PIN #define NRF_LOG_BACKEND_UART_TX_PIN 17 #endif
main.c :-
#include "nordic_common.h"
#include "boards.h"
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include "app_uart.h"
#include "app_error.h"
#include "nrf_delay.h"
#include "nrf.h"
#include "bsp.h"
#include "nrf_log.h"
#include "nrf_log_ctrl.h"
#include "nrf_log_default_backends.h"
static void log_init(void)
{
ret_code_t err_code = NRF_LOG_INIT(NULL);
APP_ERROR_CHECK(err_code);
NRF_LOG_INFO(err_code)
NRF_LOG_DEFAULT_BACKENDS_INIT();
NRF_LOG_INFO("\r\nbrf_logging_enabled\r\n");
}
int main(void)
{
/* Configure board. */
bsp_board_init(BSP_INIT_LEDS);
// Initialize.
log_init();
/* Toggle LEDs. */
while (true)
{
for (int i = 0; i < LEDS_NUMBER; i++)
{
bsp_board_led_invert(i);
nrf_delay_ms(500);
NRF_LOG_INFO("\r\nChange Stete!!!!!\r\n");
}
}
}