Reply
Posts: 6
Registered: ‎05-01-2017
Accepted Solution

SWO debug printf in IDE for the EFR32BG, again where is the latest updated that works?

Ok, not to bring this up again, but as a NOOB to Sil. Labs stuff I see a ton of people trying to get a

simple "printf" to some console they can debug with.  I also wish to run benchmarks and print out

results so don't care about real time or that issue for simple benchmarking.

 

However, wow, what a failure of Si. Labs. to leave this in the weeds as they appear to have?

There is a bunch of posts on SWO and VCOM for various kits and boards and what not but not

a clear solution for the EFR32BG that absolutely works.  Is this kit so new that this is an unfinished

work?   Where is Si. Labs on this?

 

Loads of SWO and VCOM discussions for the EFM32 that DO NOT WORK, or compile for the

BT Starter Kit with the 4200A radio board.  Being new, I have no idea what this thing can do via

the USB cable.  Obviously the IDE is talking to the Segger chip on the debug board but it is not

at all clear how the radio board (4100A) could talk to the IDE via. the debug board and it's single

USB cable to the IDE... probably some serial channel visualization going on, where documented?

 

Am I wasting my time because SWO won't ever work for this kit and radio board?

Do I need to spend hours more to see what VCOM is and try to get that up?

Do I need to connect wires and a TTL to RS232 adapter to connect to a terminal?

 

Your SWO examples barf when compiled because the defines in that piece of code that is

tossed about are undefined.  For the EFR32BG this isn't a ready drop in for "printf".  All I

really see are Q&A for people with the EFM32 variants.  The EFR32 people are appear

to still be fighting this "should be simple" issue.

 

Hoping the rest of development with the BT starter kit goes easier as I have to use

many of the internals to build out this product for my client....

 

Any help, advice, working examples would be appreciated at this point!

 

Highlighted
Posts: 37
Registered: ‎09-26-2015

Re: SWO debug printf in IDE for the EFR32BG, again where is the latest updated that works?

Hi @anasazi,

 

I just attempted to set up SWO printf with the soc-thermometer sample app on BRD4100A, and it seems to work fine. You mentioned BRD4200A, but that board doesn't exist as far as I can tell.

 

This is what I did:

  • Created a Bluetooth sample application in Simplicity Studio
  • Using a file browser, I navigated to the install location of the SDK (<studio install location>/developer/sdks/gecko_sdk_suite/v1.0/)
  • I drag-and-dropped the following three files into my project in Simplicity Studio:
    • hardware/kit/common/bsp_trace.c
    • hardware/kit/drivers/retargetswo.c
    • hardware/kit/drivers/retargetio.c
  • When asked how to import the files, I selected "Link" relative to "STUDIO_SDK_LOC"
  • In main.c, I added #includes of stdio.h and retargetswo.h
  • In main(), I added a call to RETARGET_SwoInit(), followed by printf("Hello World\n");

I then verified that the printf() was readable through SWO by opening a terminal, and using Simplicity Commander with the command "commander swo read" to read SWO output. Other tooling like JLink Commander could also be used.

 

Alternatively, to use VCOM (= "Virtual COM", which is an UART connection to the board controller, which then passes the data on to the computer using USB-CDC), replace retargetswo.c with retargetserial.c from the same location, and call RETARGET_SerialInit() instead of RETARGET_SwoInit()  in main() [note: bsp_trace.c is not needed when not using SWO, so that file can also be removed].

 

In order to open the isolation switch between the board controller and the EFR32 on the Wireless Starter Kit, the macro RETARGET_VCOM needs to be added to the project. This can be done by right-clicking the project->Properties->C/C++ General->Paths and Symbols->Symbols->GNU C->Add.

 

After doing this, I could also verify that I got serial output on the CDC port associated with my Wireless Starter Kit.

 

Another tip, if you prefer to use IP rather than USB to connect to the Starter Kit: The SWO output is available on port 4900, and the VCOM output is available on port 4901. I often use telnet to connect to the kit.

 

I agree with your sentiment that all this information isn't easily accessible and collected in one place, though. The hardware part is documented in the WSTK main board user guide, and partially in the radio board user guide, and the software part is partially in API references, sample applications and Knowledge Base articles.

 

Regards,
Aksel

 

Posts: 6
Registered: ‎05-01-2017

Re: SWO debug printf in IDE for the EFR32BG, again where is the latest updated that works?

Thanks for this quick  tutorial.  I found what you suggest works and I picked up several other

nice ways to do things in the Studio.  It's probably all documented somewhere as Si. Labs does

appear to have a ton of info. on line.  I got the VCOM using Ethernet working as you said, that

does appear easy to do with TELNET on Linux.  That's all I needed.  I reread the PDFs for the

SLWSTK6020A board and the BRD4100A and found the Ethernet ports and such which I had

missed in my first read.

As always there is so much to get up to speed on with each new set of IC's and IDE's that

are provided and this takes time.  Good quick steps as you have shown really help and I can

get your EFR32BG tested and qualified for our product.  Marketing always pushes the devel.

time on stuff like this, so jump starting is a must...

I had a typo in the board type, it was correct later in the post.... butter fingers again...

Cheers All

 

Posts: 3,021
Registered: ‎02-07-2002

Re: SWO debug printf in IDE for the EFR32BG, again where is the latest updated that works?

[ Edited ]

Hello Aksel,

 

A very nice write up.


asmellby wrote:

In order to open the isolation switch between the board controller and the EFR32 on the Wireless Starter Kit, the macro RETARGET_VCOM needs to be added to the project. This can be done by right-clicking the project->Properties->C/C++ General->Paths and Symbols->Symbols->GNU C->Add.

 


That is very important information. So if I understand you right, if I want to use VCOM on my own board using Debug Mode OUT, I have to put RETARGET_VCOM in the application that runs in the MCU on the WSTK itself.

 

It seems a bit clumsy to me, but if that is how the board was laid out, we will have to live with that. A more logical approach would have been if the debug controller that implements the VCOM would open the isolation switch, e.g. on port open.

 

Upon further investigation I believe the former was wrong. It seems RETARGET_VCOM will connect the VCOM lines from the radio board to the board controller.

Posts: 37
Registered: ‎09-26-2015

Re: SWO debug printf in IDE for the EFR32BG, again where is the latest updated that works?

Hi @vanmierlo,

the VCOM line from the board controller to the Simplicity header branches out before the isolation switch, so no, you don't need to do that. In fact, doing it might cause interference on the UART lines.

 

Below, I've added a screenshot from the BRD4001A WSTK Mainboard schematic. In yellow, you can see the path from BC_VCOM (UART on the board controller) to EXT_VCOM (UART on the Simplicity header). In red, you see the path to VCOM (UART on the radio board).

 

When you set debug mode OUT, BC_EXT_HEADER_ENABLE gets set by the board controller, which causes the yellow path to open all the way through U715A to the Simplicity header (P701). When you want to use VCOM on the radio board, the target code should assert VCOM_ENABLE to open U602A instead. This is what happens when you define RETARGET_VCOM with the retargetserial driver.

 

I.e. when you have your own PCB connected through the Simplicity header, you don't need to do anything, but when using a radio board on the starter kit, RETARGET_VCOM should be defined if you want to use the UART for debug prints.

 

 

ext-vcom.png

Aksel

Posts: 3,021
Registered: ‎02-07-2002

Re: SWO debug printf in IDE for the EFR32BG, again where is the latest updated that works?

Hello @asmellby,

 

Yes I found that myself as well. But thanks for the answer and explaining when BC_EXT_HEADER_ENABLE is actually set.

 

Btw. Is there a good reason why the connectors on the WSTK have no designators?  The schematic shows P701, but on the board you have no clue which connector that might be.

Posts: 6
Registered: ‎05-01-2017

Re: SWO debug printf in IDE for the EFR32BG, again where is the latest updated that works?

That last reply with schematic really clued me in and I found the schematic for the WSTK and

the BRD4100A and see what I should already have dug into and found out.  Although with your

tips and hints it makes a bunch more sense when looking at the WSTK schemo what all those

data paths are about and where things can be routed to....  this thread should help others I hope.

 

Posts: 7
Registered: ‎07-11-2017

Re: SWO debug printf in IDE for the EFR32BG, again where is the latest updated that works?

Has anyone gotten this to work for BRD4300A board?