15. The Software Cursor
While we are demonstrating the usefulness of the Power Profiler, it is worth mentioning that it is possible to place a software cursor in the profiler plot when we are using one of the PRO development kits.
SDK6 provides a neat little feature that let’s us do this simply by calling a function, arch_set_pxact_gpio()
.
This can be useful if we want to ensure that a timer is actually triggered, or if we want to measure the time and/or energy it takes to execute a function in our implementation.
- The software cursor function has two different variants depending on the SmartBond™ device that you are using:
With the DA1453x you must provide a GPIO port and pin pair as arguments. On DA14531 DEVKITP
P0_11
is already set up to be used for this on the development kit.SDK6 will automatically assign
P1_3
when you build your code for the DA14585 or DA14586
Note
In an earlier section, we already used the P0_11
pin on the DA14531 DEVKITP as an input with pull-up. This will conflict with the cursor trigger signal and we will need to reconfigure the input to another pin, and place an additional jumper on the development kit. The DA14535 and DA14585 PRO kit does not require any changes.
First, place the Cursor Trigger jumper
J8, pin 1 to 2
as shown below:Figure 27 Add the Cursor Trigger jumper as shown above in order to use the software cursor
- In DA1453x ,
J24
has been designed to configure the Cursor Trigger on desired pin: Figure 28 Add the Cursor Trigger jumper as shown above in order to use the software cursor (DA14535-00FXDEVKT-P)
Please be careful that J8 on DA1453x DEVKITP is not user configureable.
- In DA1453x ,
Next, in user_periph_setup.h move the input function pin
P0_10
(the change is highlighted):#if defined (__DA14531__) #define BTN_PORT GPIO_PORT_0 #define BTN_PIN GPIO_PIN_10 #else #define BTN_PORT GPIO_PORT_1 #define BTN_PIN GPIO_PIN_1 #endif
In the following, we will put a software cursor in the Power Profiler at the exact time when a Bluetooth® connection is established.
In the
user_on_connection()
function of user_peripheral_template.c, add the following at the end of the function:#if defined (__DA14531__) arch_set_pxact_gpio((GPIO_PORT)0,(GPIO_PIN) 11); #else arch_set_pxact_gpio(); #endif
If we build the project and run it again, we should see the time cursor in the current plot:
Figure 29 A SW cursor appears at the time of BLE connection (DA14531 in buck mode)
We can now make a couple of observations. First, and most importantly, we see the green time cursor. It is also apparent that we connected on the second advertising channel of the advertising event. The device is then in a connection and we see the first connection event about 7.5ms after our cursor. The connection event consists of a receiver opening event followed by a very short transmitter pulse. After the connection event, the device enters sleep mode and wakes up in time for the next event (not shown here).
It should be obvious that the Power Profiler can help us get a very detailed understanding of what the device is doing at any given moment.