I understand that this is a very novice quesiton but I'm new to the C SDK and C in general.
I would like to use UART for debug during development. I had found this post but it no longer seems relevant with the 2.6 SDK.
I can find most of the reffered files in /Applications/Simplicity\ Studio.app/Contents/Eclipse/developer/sdks/gecko_sdk_suite/v2.0/hardware/kit/common/drivers
but not all, for example I'm missing: retargetserialconfig.h.
Also after doing step one it already says: retargetserial.h no such file or directory while I can clearly see it listed in the project.
I would very much apriciate it if the guide could be updated for the 2.6 SDK.
Sorry, indeed, v2.6 contains a lot of changes in the project structure, and it is not documented yet. We will update the article.
To use UART in v2.6, do the followings:
1) Copy retargetio.c, retargetserial.c and retargetserial.h from C:\SiliconLabs\SimplicityStudio\v4\developer\sdks\gecko_sdk_suite\v2.0\hardware\kit\common\drivers
to your project
2) Include stdio.h and retargetserial.h files to your file, e.g. in main.c
3) Call RETARGET_SerialInit(); before using the stdio functions (printf, getchar, etc.)
4) Enable VCOM in hal-config.h (or disable if you want to use an external UART/USB adapter)
#define HAL_VCOM_ENABLE (1)
5) If you do not use the VCOM, you can change the UART settings to meet your needs in hal-config-board.h using
Thanks for updating the instructions, much apriciated.
I'm affraid I'm still stuck tough, probably due to a novice error.
The IDE keeps telling me: fatal error: retargetserial.h No such file or directory
I'm pretty sure the file is in the project as you can tell from this screenshot
EDIT: I got rid of the error by copying the file to the project instead of linking it as suggested here
Again my apoligies for asking help with every step but I'm not there yet.
I've managed to complete your instructions and I can now build without errors.
However, I'm unable to see the print anywhere. I'm using a WTSK with a radio board connected to a Mac.
I've been checking in Coolterm and in Network analyzer (serial 0, 1 admin and debug) but nothing comes up.
Retargetserial does not use the Serial 0/1, Admin ports.
You have to connect to the JLink CDC UART port with a terminal program. I do not know Coolterm, but I guess it should work.
If it still does not work, you may try upgrading your WSTK firmware with Simplicity Commander.
Thanks for your fast response!
CoolTerm is a simple serial port terminal application availible for Mac OS similar to that of many windows apps.
I've been using the settings bellow that have always worked for me while developing in BGscript
Is there anything off in my settings?
I have made a fresh install of simplicity a view days ago so I would assume it's still up to date.
Here's a screenshot of my adapter firmware version, is it the latest?
Would it maybe be possible to share an empty example project with UART and a sample print so I can test against that?
There is new wstk firmware, but 1.2.2 should be perfect.
I guess this usbmodem1411 port is the one that is provided by the WSTK and not by an external UART/USB converter, right?
I can send you an example project, if you specify the part number.
Yes the port number is provided by the WTSK there is nothing but the adapter board connected.
The part number is: ERF32BG13
The example would be much apriciated!
Find attached the example project.
Another question: have you programmed a bootloader into your device? Maybe you application does not even start because of some bootloader problem. Can you confirm that your application is running? E.g. if you use soc empty example, is it advertising?
The devices are preprogrammed with a dummy bootloader, which does nothing but starts the application, so that is fine.
Thanks for the example!
I have not modified the bootloader. It does advertise when I load the empty project.
I will try your example and see if that works.
Is there a particular way to load your example into Simplicity?
What I've done is:
1. Start a new empty project
2. Copy and replace all C and H files in the "workspace" folder
3. Build and run the app.
I can see it advertising but I can't see the printf in coolterm.
Doing it any other way (for example trough import) results in an error:
The file seems to be making local refferences to your machine: C:\Users\arkalvac\SimplicityStudio\v4_workspace
Use File > Import > Existing Projects into Workspace, and select the zip file.
I got it to work, Thanks!
I'm now first building using the hammer icon then run > debug.
I do notice that it takes very long time for the programme to run compared to bgscript.
Is there any way to start running an app faster?
I would not need all the debug screens, just my terminal.
Glad to hear that. Once you have built your application you can flash the .hex file with Simplicity Commander, and your app starts immediately.
I'd so glad to find this post, this should be an KB article.
Is there one for SWO?
Also, I'd like to add a few screenshots about how to connect using PUTTY.
Step1: In my case, I'm using Thunderboard Sense 2, so I found the serial port setting from UG309
Step2: Find my COM port number from my device manager. So it's COM4 in my case. I also changed the port setting to match UG309
Step3: Setup PUTTY, and connect
Step4: push RESET button on my Thunderboard sense 2. Yeah!