Logging is very important for developing embedded products, especially for connection based wireless products because the use of breakpoints will probably result in dropped connections. Whereas, we can easily address problems by walking through the log. This article will introduce a simple implementation of logging on EFR32 based devices. The key point of this article is to introduce a way to classify the log into different levels, and each level of log has its own identifier.
Let’s start with 2 design sketches, which demonstrate outputting the log via RTT and VCOM(UART).
Figure 1. Using RTT
Figure 2. Using VCOM
From the pictures, you can see the different level of logging uses different colors, this article introduces 5 levels of logging as below.
|Type||Error(Highest Level)||Warning||Information||Debug||Verbose(Lowest Level)|
Table 1.Log types and colors
The symbol LOG_PORT, defined in log.h, can be set to SEGGER_JLINK_VIEWER or PORT_VCOM to determine which terminal the output should be sent to.
The definition of LOG_LEVEL in log.h determines which level of logging should be output to the terminal. As you can see from the table 1, error has the highest level while verbose has the lowest level. For example, If the LOG_LEVEL is defined as information level, then error, warning and information log will be sent to terminal, the debug and verbose log which have lower level than information will not be sent to the terminal. See figure 3, which shows the log as information level without modifying anything from figure 1.
Figure 3. Log with information level
There are 5 corresponding functions to send the log, the input parameter of these five functions is the same as standard printf();.
Follow below steps to enable this feature in your project and customize it to meet your requirements.
After all the above is done, your project should be able to send the log to the terminal.
While developing with Silicon Labs Bluetooth SDK, users can use the API – gecko_cmd_le_gap_bt5_set_adv_data() to set the advertisement and scan response data. The data has a standard format, whereas the data passed to above API is uint8array. This article will focus on adding a middle layer between user application and the BG stack API to set the advertisement payload, which makes the payload more straightforward, visible and easier to understand for users.
For more information about the advertising data, you can go to the Bluetooth KBA Index and see the “Advertising” category.
Below is the architecture of the advertisement constructor, which is developed on the latest Bluetooth SDK - v2.8.1, it can also be used on other versions of SDK directly or with just simple modification, depending on the specific SDK version.
The example sets the advertisement and scan response data as below:
Figure 1. Advertisement details
Figure 2. Advertisement payload breakdown
Figure 3. Scan response payload breakdown
Schematics and other documentation for radio boards can be accessed easily from Simplicity Studio.
Studio is context sensitive, meaning it will try to show you the relevant content for the hardware that you are working with. You can plug in your kit using USB and Studio will recognize the kit automatically. In that case, the kit details will show up in the Devices window.
Alternatively, you can manually enter the kit / radio board number in the Solutions window. Studio has auto-complete feature that will suggest you list of available options, it is enough to enter just the first part of the board or kit ID (for example, typing BGM111 will show a list of all BGM111 radio boards). This method allows you to access schematics and other documentation for kits even if you don't have the physical kit available. For example, you can check the docs and schematics before even ordering a kit.
Following screenshot shows an example how to locate schematics, assembly drawing etc. for BGM13P radio board (BRD4306A). Note that the item that is selected in the Devices or Solutions tab dynamically changes the content that is shown on the right hand side of the window.
This same method can be used to access other documentation relevant to your target hardware, including:
This Knowledge Base Article (KBA) aims to act as a “master” KBA which keeps a curated index of all the Bluetooth related KBAs divided into logical categories for an easier and more convenient look-up. It may also include non-KBA content which is relevant for designing your Bluetooth application (e.g. app notes or web pages).
If you are just getting started with Silicon Labs Bluetooth solutions then your starting point should be QSG139: Getting Started with Bluetooth® Software Development. At the end of that document you are presented with the flowchart below which shows what documents should be read and in which order. Additionally you can check out our Bluetooth Training page for more training material.
The content listed below is grouped together into categories to make it easier for you to find what you are looking for. Want to know more about security, or looking for a peripheral example, then head down to the right section and see what KBAs or other relevant content has been created under those topics.
Each category has an associated index number and each individual KBA has its own index number within the category. The KBA's are prefixed with KBA_BT_AABB where AA is the category index and BB is the KBA index within that category. The category index numbers are as follows:
Note: Do you want to get automatic notifications when new content is added to the list? Just click the Follow button in upper right corner to subscribe to email notifications. We will make comments when new content is created to trigger those notifications.