New to Eclipse and OnSemi and want to debug to UART

Hi
I have not used Eclipse before.
I can successfully build and debug the ‘ble_peripheral_server_bond’ example.
To enable PRINT() to go out via uart I have to change the value of OUTPUT_INTERFACE in printf.h

That printf.h is NOT a local file so changing it will affect all my builds.

In printf.h I see …
#ifndef OUTPUT_INTERFACE
#define OUTPUT_INTERFACE OUTPUT_DISABLED
#endif

And in other places I came across the phrase 'change OUTPUT_INTERFACe in project settings

Given I have no prior experience of Eclipse, how do I view ‘project settings’?

Look forward to hearing from you and thank you in advance

Solved!

Right click the project->Protperties->Tool Setings-> C Compiler -> Preprocessor and the add

OUTPUT_INTERFACE=OUTPUT_UART

1 Like

Hi,

Thank you for making useful thread on our Community Forum. If you have any further questions please feel free to contact us.

I have used BLE SDKs from many. Nordic, Dialog Semi, CSR, Silabs to name a few.

The OnSemi startup guide is so far the best I have some across in terms of detail.

To make it perfect, in the relevant section in debugging where PRINT macro is mentioned it does say that the #define value needs to be changed to enable it. I struggled because I have used Eclipse for the first time.
Hopefully, you will add the following to the guide …

Right click the project->Protperties->Tool Setings-> C Compiler -> Preprocessor and the add
OUTPUT_INTERFACE=OUTPUT_UART

1 Like

Hi,

Thank you for your post. Surely, we will discuss your suggestion within the organization.

Thank you for using our Community Forum.

Hi @mtunwired

Please note that in our latest SDK 3.5 release was included instructions on how to add Printf Debug Capabilities according your suggestions. Please refer to section 7.1.1 in RSL10_getting_started_guide.pdf available in RSL10 Documentation Package

Thank you for using our Community Forum.

@rastislav.stefun Where is the Tool Settings option? You mean in Properties → C/C++ Build → Settings?
( Using
ON Semiconductor IDE Version: 3.4.0.48
Eclipse Version: 2020-12
Build id: 20210226-1917 on Windows 10 )

The manual at section 7.1.1 says the same thing written here but its still not clear how to enable it (testing it on the Blinky project). I have tried including app_trace.c/h in my project (as mentioned in RSL10_getting_started_guide.pdf)), as well as not including it and only changing printf.h (As described here: https://www.onsemi.com/forum/t/kb-how-to-activate-printf-at-see-the-output-at-terminal-serial-console/640). Again, the printf.h file is not part of the individual project, so changing this will affect all other project builds. I am not sure if that’s how this is actually done, or I’m just not understanding the instructions. Nothing works. Either there is a compiler error, or when there are no compiler errors, there is no UART communication (I cannot see anything on the serial port terminal in Eclipse, serial port terminal was opened using the instructions given in the previous link

I just want to see a basic example of how to send debug messages to PC using the printf() function in the blinky program. (By the way, the “ble_peripheral_server_bond” example mentioned in the getting started guide is the one example that doesn’t have the app_trace.c/h files included; using 3.5.285 version of the CMSIS pack). Can I please have a basic working example project for printf, or at least clear steps on how to create one? Also a working example for displaying messages using RTT will be greatly appreciated.

Hi @mahaju,

I have attached two Blinky hex files to this reply that you can use to verify your RTT and UART hardware setup.

I have verified on my end that both of these firmware are able to use the PRINTF functionality to print the expected output over UART and RTT, so please load these firmware onto your RSL10 EVB and let us know if you are able to see the expected output.

This will let us know if the issue is caused by the Hardware setup or by something wrong in the Firmware build.

blinky_RTT.hex (19.3 KB)
blinky_UART.hex (20.4 KB)

@brandon.shannon Thank you very much for your reply. I am really sorry but I am currently using RSL10 development board using eclipse and I download my programs from the IDE using the elf file. I am not sure how to download the hex version. If you can let me know how to download hex using Eclipse and the RSL10 development board USB connection, I will test the UART program and let you know the results.

My initial problem was with the UART debugging. For RTT, this instruction worked: KB: How to enable debug messages to RTT in "blinky" sample
I need to connect an external j-link connector and for Eclipse on Windows the preprocessor settings are at
Project properties -> C/C++ build -> Settings -> Tool Settings -> Cross Arm C Compiler -> Preprocessor
We need to press the “+” sign next to Defined symbols (-D) and add the RTT preprocessor symbols. There was no need to manually add the RTT .c/h files to my project, as mentioned in one of the printf related header files.

Hi @mahaju,

It is good to hear that you have the RTT printouts working now, as this means you have setup the “PRINT Utility” CMSIS Components properly. You are also correct that the RTT files do not need to be added manually, as there is a selection-box within the projects “.rteconfig” file that will automatically import the RTT and Print files into the /RTE/ directory, as well as adding it to the list of include directories.

As another note, you can make the changes to the interface being used (UART, RTT, Disabled) directly within the imported ‘printf.h’ utility file instead of adding it to the -D Preprocessor settings. This has the added benefit of having a small enumerated list of the values needed to set each of the interface options.

As for loading a hex file, this can be doing using either: the J-Link Commander tool that comes with a standard J-Link installation, or by using our Standalone Flash Loader that can be found in the RSL10 Software Utility Pack on the RSL10 product page (this tool is simply an Abstracted UI that will automatically call the appropriate J-Link command line arguments to load the hex).

@brandon.shannon is the RTT enabling method different for ble_peripheral_asha sample program or is it same for everything? I am having trouble seeing RTT debug messages in the asha program as I mentioned here: Issue in receiving audio data in RSL10 - 'BLE-IOT-GEVB ' - #18 by mahaju
I was trying to get the ASHA sample program running and I don’t have LPDSP32 tools and I am not sure how to use ASHA on my phone yet, but I assumed at least the BLE initialization debug message, etc, should be visible on the RTT viewer when the asha sample is downloaded?

I have tested both your hex files

  1. RTT works perfectly

  2. For UART I am using the terminal viewer built into eclipse. In the beginning I was getting a continuous stream of random characters, but now I am only getting a single ‘V’ in the terminal. My serial console settings are
    Baud rate: 115200
    Data size: 8
    Parity: None
    Stop bits: 1
    Encoding: Default (IOS-8859-1)

I have tried the other encoding options available and they give the same results as well. I am using same settings for serial port terminal in Windows Device Manager. What could be the issue here?

Also I have tried the same serial port settings, and set the preprocessor option to OUTPUT_INTERFACE=0 in the default blinky sample program in the installed RSL10 software package. With this, I don’t get anything in the serial console. What could be going on here?

Hi @mahaju,

This is strange and very different then what we are seeing on our side.

Using your exact Serial Port settings (except for UTF-8 encoding) we are able to see the proper UART output on various Terminal software.

Two things I can suggest are:

  1. Ensure that you no hardware interacting with the DIO4 and DIO5 pins on the RSL10 EVB, as this will cause interference with the UART transfer. This includes the button which is attached to DIO5 on the EVB.
  2. Can you use a Digital Logic analyzer and two different DIO UART pins (other than DIO4 and DIO5) to read the UART data using a different method? This will ensure the COM Ports and UART functionality of the PC you are interfacing with is not the problem.