This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

NRF_LOG_INIT affecting the working of the code

Hello,

I have designed my own PCB with nrf52832 chip on it. I program the chip using the Nordic development kit with PCA10040 programmer. I need to check the values of some variables in my code when it runs on my PCB. To do that, I am printing some statements in my code using NRF_LOG_INFO on J-Link RTT Viewer. The variables which I want to check lies in a while loop in the main function of the code, but I initialize the log in the main function before the while loop using :

uint32_t err_code = NRF_LOG_INIT(NULL);
APP_ERROR_CHECK(err_code);

The question is that when I initialize the NRF_LOG_INIT, one of my pins (PIN 6) is set to 5 V even when my code instructs to write 0 V on that particular pin. In this scenario, the logs are printed on the J-Link correctly. 

I tried commenting these two lines of code of NRF_LOG_INIT(NULL) and the code works perfectly fine i.e. the pin is set to 0 V as was instructed by the nrf_gpio_pin_write(6,0) function, but the logs obviously doesn't get written on J-Link as it is not initialised.

Since I am not familiar with the working NRF_LOG_INIT(NULL), how do I make the logs print on the J-Link to debug my code without messing up the operation of nrf_gpio_pin_write(6,0) for that pin? I have attached the sdk_config.h file.sdk_config.h

Thanks!

Regards,

Piyush

  • Ah, I see. Could you share some part of the schematics and/or code to show how you configure the GPIO? This because - a chain of thought - one would like to ensure that all GPIOs are configured properly if it matters at start-up. Often strange things can occur (e.g. because of spike currents) when pins are not configured yet. In your case -if you don't already do this at the beginning - you could try to use the internal pull-down of the pin connected to the MOSFET and set it at value 0 before anything else.

Related