This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Merging two or more examples

Hello

I am getting started on nRF SDK and I went through all the examples (at least those I'm interested about) successfully. 

Now, I need to merge couple of examples together. For simplicity let's say I'm merging an uart example into the twi_scanner one.

What I did, was

  • to compare "Options" of two projects, and added missing include paths. For this example, I added /libraries/uart and /libraries/uart paths into the twi example
  • Added required #includes, in my case these were #include "app_uart.h" and #include "nrf_uart.h"
  • I've checked sdk_config.h and found that UART was enabled.

And it wasn't enough. For some reason linker fails, and complains it cant find references to any app_uart functions. Funny, since "Go to definitions" finds the file easily. 

So what am I missing? What else should be done?

P.S. I have already searched for help in the DevZone, and found useful threads like this one, but all the links in it are outdated and not working anymore. 

  • Pero Krivic said:
    <error> app: ERROR 8 [NRF_ERROR_INVALID_STATE] at D:\Nordic\nRF5_SDK_17.1.0\examples\MERS\MERS_twi_scanner\main.c:160
    PC at: 0x00006281
    <error> app: End of error report

    Which function is being called on line 160 of main.c?

    Pero Krivic said:

    I think there seems be a conflict with NRF_LOG and uart. The error is gone if  I  set

    #define NRF_LOG_BACKEND_UART_ENABLED 0

    But gets funny now, since the printf() prints into the JLINK console in Segger IDE instead to my UART console (what is a completely different USB port). Is this a topic for another ticket, or you think it can be resolved quickly?

    Do you have NRF_LOG_BACKEND_RTT_ENABLED defined to 1?
    If so, the logger will route its loggings to the RTT backend, outputting it on either the SES Debug Terminal or a standalone RTT terminal like Segger RTT viewer.
    You are correct that there may only exist a single UART instance in your application, since the nRF52832 only has 1 UART instance - so if it is used by the logger, you can not use it in your application and visa versa.
    In that case, you can switch the logger to use RTT instead.

    Best regards,
    Karl

  • Hello Karl, 

    for some reason DevZone form doesnt allow me to reply to your latest comment, I'm writing here to say that I consider the matter solved and to thank you for your valuable time and effort to help me out. The initial issue has been solved by adding the .c file as you explained. Further issues have been solved by looking after the NRF_LOG backend.

    Have a nice day

  • Hello again, wesperos

    I am happy to hear that both the original and auxiliary issue is now resolved, that's great!

    It is no problem at all for me to help you, no worries :)

    Please do not hesitate to open another ticket if you should encounter any other issues or questions in the future.

    Good luck with your development!

    Best regards,
    Karl

Related