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

nrdf52840 missing NRF_LOG messages and SD not running on BT840

Hello.  I'm developing a project using nRF52840.  I've been working with the nRF52840Dev Board and I have a BLE project that runs there.  I'm developing in Segger IDE and using J-Link Terminal. Im developing a project based around PCA10056 board and s140.

I have 2 problems, both of which seem to have some feedback here on the Nordicsemi support site, but the instructions that I see haven't led to any success:

1) NRF_LOG messages. I can never find the messages from NRF_LOG (for example NRF_LOG_DEBUG("Notify observer 0x%08X => blocking", p_observer);  They simply don't appear in the RTT Viewer, even though all the settings are intended to direct them there.  To get around this, I have been using sprintf and SEGGER_RTT_WriteString.  However, I think that exposing these messages is important because of problem 2 is a deeper problem.


2) I've developed a custom board using a BT840 module.  I expected that the project that I've made would just run there (it uses SD, as a BLE peripheral).  The project is based on BLE SDK examples (however, the first piece of code to the SD (ble_stack_init() err_code = nrf_sdh_enable_request() hangs, which is different than the dev board.  

I'm now realizing that I need to master the bootloader/SD linkage/app linkage setup in the project download, and  


I've erased the the device (BT840) and loaded the bootloader per the manufacturers instructions, I'm realizing that there is probably more to do than this.  I see some references to options for external clocks and preprocessor directives that need to be set.  

Some direction on either of these 2 problems is helpful.

Parents
  • Hello,

     

    1) NRF_LOG messages. I can never find the messages from NRF_LOG (for example NRF_LOG_DEBUG("Notify observer 0x%08X => blocking", p_observer);  They simply don't appear in the RTT Viewer, even though all the settings are intended to direct them there.  To get around this, I have been using sprintf and SEGGER_RTT_WriteString.  However, I think that exposing these messages is important because of problem 2 is a deeper problem.

     I am not sure this is the issue, but are you using the RTT window in Segger Embedded Studio? If so, what you are seeing is a bug where it doesn't handle CR correctly. Open sdk_config.h, and check that these are set:

    #define NRF_LOG_BACKEND_RTT_ENABLED 1

    #define NRF_FPRINTF_FLAG_AUTOMATIC_CR_ON_LF_ENABLED 0

    Do you see the log messages if these are changed? Was the logging module included in the project when you started? If not, look at one of the examples of how this is initialized and processed. 

     

    2) I've developed a custom board using a BT840 module.  I expected that the project that I've made would just run there (it uses SD, as a BLE peripheral).  The project is based on BLE SDK examples (however, the first piece of code to the SD (ble_stack_init() err_code = nrf_sdh_enable_request() hangs, which is different than the dev board.  

    This is a typical symptom of the LFCLK not configured correctly. The nrf_sdh_ble_enable() (called from ble_stack_init()) waits for the LFCLK to start. If it is set to use an external LFXTAL that isn't present, it will wait forever. I guess your board doesn't have the external LFXTAL, as this is optional. At the same time, all examples in the SDK are targeted on boards that have the LFXTAL enabled. What you need to do if you don't have the LLFXTAL is to change to the following settings in sdk_config.h:

    #define NRF_SDH_CLOCK_LF_SRC 0
    #define NRF_SDH_CLOCK_LF_RC_CTIV 16
    #define NRF_SDH_CLOCK_LF_RC_TEMP_CTIV 2
    #define NRF_SDH_CLOCK_LF_ACCURACY 1

    And it should work with the internal RC Oscillator instead of the external LFXTAL.

    Let me know whether this solved your issues. 

    I am quite sure 2) should be solved, but if 1) wasn't solved: What RTT viewer are you using? The one in Segger Embedded Studio, or the standalone JLink RTT Viewer? If you use the standalone JLink RTT VIewer, does it work with an unmodified example that uses RTT backend for logging, such as the ble_app_uart example? And does it work in the RTT monitor in Segger Embedded Studio if you set the NRF_FPRINTF_FLAG_AUTOMATIC_CR_ON_LF_ENABLED to 0 in sdk_config.h in the same example?

    Best regards,

    Edvin

Reply
  • Hello,

     

    1) NRF_LOG messages. I can never find the messages from NRF_LOG (for example NRF_LOG_DEBUG("Notify observer 0x%08X => blocking", p_observer);  They simply don't appear in the RTT Viewer, even though all the settings are intended to direct them there.  To get around this, I have been using sprintf and SEGGER_RTT_WriteString.  However, I think that exposing these messages is important because of problem 2 is a deeper problem.

     I am not sure this is the issue, but are you using the RTT window in Segger Embedded Studio? If so, what you are seeing is a bug where it doesn't handle CR correctly. Open sdk_config.h, and check that these are set:

    #define NRF_LOG_BACKEND_RTT_ENABLED 1

    #define NRF_FPRINTF_FLAG_AUTOMATIC_CR_ON_LF_ENABLED 0

    Do you see the log messages if these are changed? Was the logging module included in the project when you started? If not, look at one of the examples of how this is initialized and processed. 

     

    2) I've developed a custom board using a BT840 module.  I expected that the project that I've made would just run there (it uses SD, as a BLE peripheral).  The project is based on BLE SDK examples (however, the first piece of code to the SD (ble_stack_init() err_code = nrf_sdh_enable_request() hangs, which is different than the dev board.  

    This is a typical symptom of the LFCLK not configured correctly. The nrf_sdh_ble_enable() (called from ble_stack_init()) waits for the LFCLK to start. If it is set to use an external LFXTAL that isn't present, it will wait forever. I guess your board doesn't have the external LFXTAL, as this is optional. At the same time, all examples in the SDK are targeted on boards that have the LFXTAL enabled. What you need to do if you don't have the LLFXTAL is to change to the following settings in sdk_config.h:

    #define NRF_SDH_CLOCK_LF_SRC 0
    #define NRF_SDH_CLOCK_LF_RC_CTIV 16
    #define NRF_SDH_CLOCK_LF_RC_TEMP_CTIV 2
    #define NRF_SDH_CLOCK_LF_ACCURACY 1

    And it should work with the internal RC Oscillator instead of the external LFXTAL.

    Let me know whether this solved your issues. 

    I am quite sure 2) should be solved, but if 1) wasn't solved: What RTT viewer are you using? The one in Segger Embedded Studio, or the standalone JLink RTT Viewer? If you use the standalone JLink RTT VIewer, does it work with an unmodified example that uses RTT backend for logging, such as the ble_app_uart example? And does it work in the RTT monitor in Segger Embedded Studio if you set the NRF_FPRINTF_FLAG_AUTOMATIC_CR_ON_LF_ENABLED to 0 in sdk_config.h in the same example?

    Best regards,

    Edvin

Children
No Data
Related