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

Serial Viewer (RRT) Help

Hello,

I am just starting working with the nRF52 development kit and have a couple guidance questions. I'm very new to the Keil environment and am having a little trouble trying to get some simple things working. Please forgive the simplicity of my questions but I'm new to this. Ideally, I'd like to hook up an LCD screen and rotary encoder to one end of my link, and after I learn to implement these items I'd like to set up some bluetooth applications. Before I can accomplish any of this however, I have to figure out a way to get real time serial outputs so I can observe how everything is working and for assistance in debug and eventually, radio and bluetooth verification.

I initially tried the Keil Serial windows, but with no avail I followed the tutorial here (devzone.nordicsemi.com/.../) but my RTTViewer does not offer a nRF52 for an option, and does not find an "emulator" when attempting to connect. It then asks for an IP address which I don't know. I am unsure what the correct method to go about viewing serial output from the microcontroller is. Does anyone have any guidance on how to view real time serial output from the nRF52?

Additionally, is there any where to look for help setting up and printing to a typical 16x2 character LCD screen like this (www.newhavendisplay.com/nhd0216k1zflybw-p-284.html) and also interfacing with a simple (quadrature or grey code output) rotary encoder?

These two items would allow me to get started working on some of my projects and then get the radios and bluetooth talking.

Thanks for any help or input on this topic!

  • I see the "SEGGER_RTT.c" folder/file in the RTT folder within the nrf52832.... folder, but II still get the same errors during compile. I updated to the newest version of Keil (5.17) from my older 5.16 version, and the errors still persist. I tried on multiple examples now, and it doesn't seem to be liking the simple SEGGER_RTT_WriteString() command... I am curious where printf outputs to and if I can just use that?

    I really am unsure why this is not working if I have the files added. I also have tried adding the include path for the main.c file as well as the "target" (nRF52) but still cannot compile.

    Any suggestions?

    Thanks for taking the time to work through this with me Einar!

  • Yust so we are on the same page. Can you try to do this with the blinky example of the nRF52 SDK version 0.9.2? I just did this, following these exact steps. I would expect them to work for you as well.

    1. Download this archive, extract it and copy the RTT and Syscalls folder from the zip file into C:\Keil_v5\ARM\Pack\NordicSemiconductor
    2. In your blinky project, go to Project -> Options for Target ... -> C/C++ and add C:\Keil_v5\ARM\Pack\NordicSemiconductor\RTT to the include path, without removing anything. This is easier if you click the button with thre dots "..." right of the include path, so that you can see each path on a separate line. When done, click "OK".
    3. In Keil, right-click on the project-folder and click Add Group. Name it RTT
    4. Right click on the new group and select Add existing files to group 'RTT'. Navigate to C:\Keil_v5\ARM\Pack\NordicSemiconductor\RTT and add SEGGER_RTT.c. Then click "Close"
    5. Put #include "SEGGER_RTT.h" together with the other include statements in the top of the code.
    6. Write SEGGER_RTT_WriteString(0, "Hello World!\n"); in the beginning of your main() function.

    I have assumed that your Keil installation directory is C:\Keil_v5. If it is not, adapt any paths accordingly.

    Does this do the trick?

  • Einar,

    I missed this response as it was lower down and I didn't see it. I followed the steps that you have laid out step by step, which seem to be the same as the tutorial - only for the blinky example. I am curious if I'm adding the "RTT" folder to the right spot - I right Click "nrf52832_xxaa" and click add group - However I am not given the option to add group if I actually right click "Project: blinky_blank_..." like the instructions say "right click on the project folder".

    Upon following all of the outlined steps I receive only one error now, instead of three. I have copied the error here:

    ..\..\..\main.c(27): error:  #5: cannot open source input file "SEGGER_RTT.h": No such file or directory
    

    I really don't know what I'm doing wrong here, or why this is so difficult and confusing. Is there another way to read real time (serial) communication? Where can I view sprint and printf outputs (serial windows don't show them) and why is RTT preferred over this?

    Thanks for looking into this again.

  • You are doing it right when you right click "nrf52832_xxaa" in order to create the RTT Group.

    The error you get indicates that SEGGER_RTT.h is not in the include path. Can you verify the following?

    1. you have copied the files from the archive, including SEGGER_RTT.h, to <Keil-install-dir>\ARM\Pack\NordicSemiconductor\RTT\ (replace <Keil-install-dir> with wherever you ave Keil installed)?

    2. you have added the directory where y ou copied the files RTT (<Keil-install-dir>\ARM\Pack\NordicSemiconductor\RTT) to the include path (Step 2 in my answer). You can use the absolute path here. To be confident you get it right, navigate to the location using the file explorer and copy the path from the address bar and past it into Keil.

  • Einar - I Finally got it working, I think clicking the little add path navigation box may have done the trick, I think there must have been an error in my add paths. Thank you immensely!

    Now I'm able to get this working - is there a list of easy to use print commands with RTT?

    I've completed the tutorial, but the color coding does not work (any tips?), and I'm still a little unsure of how to specifically print different data types (like ints and other) to the RTT with "SEGGER_RTT_printf" - is there anywhere that clarifies how this is done? I'm still struggling with understanding some of the basic code and wanted to be able to print things out the help me the code and concepts.

    Are there additionally some basic tutorials that you could recommend that you think would help guide me to start interfacing with the various components I listed originally?

    Thanks for all the help again, its greatly appreciated!

Related