This information supplies sensible insights into Z-Wave firmware improvement, overlaying coding, debugging, improvement environments, and energy evaluation instruments utilized by skilled IoT engineers. Readers will study advisable workflows for Silicon Labs and Trident IoT SDKs, Visible Studio Code integration, sleep-current debugging, and greatest practices for constructing dependable Z-Wave gadgets.
Introduction
Every of the silicon distributors, Silicon Labs and Trident IoT, have their very own coding and debugging instruments and strategies. Every vendor has coaching on their instruments which is able to aid you up the educational curve. On this a part of the journey, I current my suggestions and hints that can assist you up that steep studying curve. Step one is to observe the coaching movies or learn the getting began guides from every vendor. They’re properly price your time. Whereas the movies aren’t significantly entertaining, you possibly can skip by some elements and watch them at 1.5x which is what I did.
Vendor Coaching
Silicon Labs Simplicity Studio 6
Shifting from Simplicity Studio 5 to model 6 requires vital studying because the Built-in Improvement Surroundings (IDE) is now based mostly on Microsoft’s Visible Studio Code as an alternative of eclipse. Whereas some elements are acquainted, the IDE is markedly completely different and can take some getting used to. Simplicity Studio 6 (SSv6) is new and has a number of wrinkles and tough spots that Silicon Labs might be smoothing out within the coming months. Don’t hesitate to file a case on the help portal or contact your Silicon Labs FAE for assist. Step one is to put in SSv6 and Visible Studio (VS) Code and the Silicon Labs extension for VS Code. Open SSv6 and also you get a broad view of all of the wi-fi protocols Silicon Labs helps, click on on Z-Wave to open the checklist of pattern functions. Choose a pattern software corresponding to Swap On/Off which is advisable to begin with. I like to recommend utilizing the Copy Contents possibility. Utilizing the Hyperlink SDK and Copy Challenge Sources possibility limits VS Code’s potential to search out and search by information. The ProjectName.slcp file will open which is the place most configuration takes place. The Software program Elements tab is the doorway to putting in command courses or peripheral drivers. Search then set up and configure command courses or APIs as wanted on your software. The Pin Instrument exhibits a graphical and tabular illustration of the GPIOs. The .slpb file is the post-build editor which is the place the scripts for keys and OTA file creation are configured however I like to recommend leaving these at their defaults. Now for the large step – within the higher proper nook is the Open in VS Code. Click on on that to open the Microsoft instrument.
Microsoft Visible Studio Code
You probably have not been utilizing VS Code already, you have got been lacking out and now could be the time to get conversant in it. The rise in productiveness is properly definitely worth the studying curve to get began. Make sure the Silicon Labs extension is put in and related to SSv6 – you need to see the Si menu on the left for the extension and a white dot within the decrease proper lets it’s related to SSv6. Once you make configuration modifications in SSv6, VS Code might be knowledgeable and instantly replace the undertaking.
My suggestions and tips for utilizing VS Code:
- All the time press
to avoid wasting after modifying a file! - SSv5 would mechanically save if you click on on Construct, VS Code does NOT
- It has taken me weeks for this to develop into a behavior. I’ve been debugging for an hour solely to comprehend the change I made isn’t within the obtain as a result of I didn’t hit save
- Copilot AI is a large productiveness enchancment – study it – use it!
- Add a remark to any line of code by typing “//” on the finish, Copilot normally produces a good, typically wordy, touch upon what the code is doing
- Begin typing any perform, Copilot fills within the required parameters in the proper format(s)
- Begin typing “for”, “whereas” or “swap”, Copilot fills in a lot of a probable block of code and as you fill in additional code, Copilot guesses what else you want – press TAB to just accept the suggestion
- Copilot hallucinates – it’s not excellent so watch out and clearly verify the outcomes
- Looking for variables or features is completely different in VS Code than SSv5
- Hovering will show some data, ask Copilot for extra particulars
- Proper Click on opens a popup with many choices – suggest Discover All References
- Use the Search menu on the left as an alternative of the bar throughout the highest
- In Information to Embrace – add “*.c,*.h” in any other case the search will embrace object information, .map information and different ineffective hits
- Word that the search is throughout your total workspace so look rigorously at which undertaking the search result’s in
- I typically nonetheless find yourself greping to search out issues
- Can’t see a file within the Si Extension? Use the Explorer tab (higher left) to see all of the information
- Clear after which Construct from scratch if one thing isn’t working
- From the Silabs Extension you possibly can flash firmware, open a terminal, open commander, and different instruments
- The gnudbg debugger is dependable
- however I nonetheless use Segger Ozone after I hit a very squirrely downside
- Get a brand new laptop with a minimum of 32GB of RAM
- SSv6 and VSCode are reminiscence hogs
- I purchased a brand new laptop computer with an i9 CPU and 32GB which made the expertise extra environment friendly and secure
Trident IoT
Trident takes a fairly completely different method to embedded programming than Silicon Labs. Constructing a undertaking, compiling and flashing are executed utilizing their command line instrument referred to as “Elcap”. Elcap depends on Docker or Podman containers to make for a unified improvement atmosphere whatever the platform: Home windows, Linux or Mac. Trident has a VS Code plugin referred to as “TIDE” which makes for a well-known atmosphere for writing and exploring the embedded code. These options make for frictionless setup because the atmosphere is encapsulated throughout the container. The container atmosphere additionally makes help simpler as your entire atmosphere could be recreated months or years later and reproduce the similar firmware obtain. Additionally they declare that upgrading to newer SDK variations might be attainable with a single command line. Silicon Labs builders normally should rebuild their total software ranging from a recent pattern software in a more recent SDK to improve.
I’ve not had sufficient time utilizing the Trident instruments to make a full set of Suggestions and Methods. I plan to implement Geographic Command Class V2 in each Silicon Labs and Trident within the coming months and can current extra Suggestions in a future weblog put up.
Trident IoT Suggestions and Methods:
- Use the newest model of elcap – elcap about
- elcap self physician – checks your atmosphere, execute this if one thing isn’t working
- The issue is you normally want to begin the Docker Desktop software
- Append –assist to any elcap command for extra data
- Trident depends on the Segger Ozone Debugger
- VS Code integration with Ozone is anticipated in a future launch
- elcap creates a Segger .jdebug file for Ozone as a part of the construct course of
- In config.cmake set the next so Ozone finds all supply code
- Set(ZWDSK_CONFIG_USE_SOURCES “ON”)
- Takes just a little longer to compile however can single step ALL the code
- Flip it off once more when near launch for sooner compile instances
- Use a Segger J-Hyperlink to debug your individual PCB
- The connector pinout is NOT the identical because the Silabs MiniSimplicity header
- The Trident devkit has a J-Hyperlink in-built however doesn’t debug exterior PCBs
- The DKR-HOST can be utilized to debug trident based mostly PCBs
- The construct atmosphere relies on CMake
- To configure the undertaking, edit:
- txt
- App/CMakeLists.txt
- Configuration might be simplified in a future launch
- Full reference firmware is out there on request for a number of sensor varieties
- Begin the PCC, Zniffer or Tridents personal cross-platform Z-Wave/Zigbee Sniffer from elcap
- To configure the undertaking, edit:
Sleep Debug
One of the difficult debug duties is making certain the system sleeps when it’s alleged to and is awake when wanted. The important thing to debugging sleep is to have a great energy provide sensing instrument. Silicon Labs has the Superior Power Monitor (AEM) constructed into the WSTK improvement board and as a software program instrument in SSv6. The AEM with the newer WSTK2 (BRD4002) runs at 100kHz and has first rate present vary from microamps to 500mA. The important thing to any present sense instrument is to even have a number of digital logic channels to toggle GPIOs whereas additionally capturing the present. The business normal instrument for measuring present is from Joulescope and their JS220. After getting one among these, you can not debug a battery powered IoT system with out one.
The screenshot above exhibits the facility consumed by a ZG28 beneath numerous sleep circumstances. Initially the present is beneath 3 microamps giving years of battery life. Then the {hardware} timer wakes the chip as much as take a sensor studying and finally transmits the info at +20dBm. Word the 2 digital indicators on the backside which assist correlate precisely what the firmware is doing in numerous energy consumption modes. The JS220 has 4 of those digital indicators to establish what firmware is executing wherein energy mode. The 300Khz pattern fee is 3X different instruments which suggests you possibly can see even quick radio transmissions which different instruments can’t measure. Beneath is a desk of energy sensing instruments I’ve used. Should you’ve obtained a favourite I’ve not seen earlier than, let me know!
| Instrument |
MSRP |
Specs | Feedback |
| Joulescope JS220 |
$999 |
.5nA-3A
300kHz |
Trade chief however costly |
| Silicon Labs AEM |
$179 |
100nA-495mA
100kHz |
Value is for a brand new WSTK2+ZG28 radio board
|
| Nordic PPK2 |
$99 |
200nA-1A
100kHz |
Value chief for a great instrument
When present modifications quickly it struggles switching between shunt resistors and misses vital spikes |
| TinyCurrent |
$75 |
1uA-2.5A
300kHz |
3 swap selectable shunts and opamp you connect with your oscilloscope |
| Oscilloscope Present Probes |
$1500+ |
10mA-15A
50MHz |
Present probes for oscilloscopes normally would not have ample decision to measure microamp currents wanted for Z-Wave sleep debug and are very costly |
Subsequent Steps
Half 5 of the Z-Wave Developer’s Journey discusses an often-overlooked schedule hit that in my opinion is totally essential, Firmware Hardening. Builders should remember that IoT gadgets are sometimes wired to mains energy and should run for years with out ever rebooting. Thus, the firmware should be resilient to account for inconceivable circumstances that ought to by no means occur, however in the actual world they typically do. Remaining related to the Z-Wave community and by no means “bricking” is essential to the success of your product and the popularity of Z-Wave. Do you have got some Suggestions and Methods to share? Please attain out to me instantly by way of e mail.
In regards to the Writer
Eric Ryherd has been on the forefront of Z-Wave innovation since 2003, starting as a advisor and later serving as a Discipline Utility Engineer at Silicon Labs. Over the course of his profession, he has contributed to the design and improvement of a variety of Z-Wave merchandise, together with sensors, distant controls, motorized window shades, and in-wall dimmers, lots of that are available on the market at this time.
Though he “retired” in 2022, Eric stays deeply engaged in embedded programs and Z-Wave improvement by his weblog, DrZWave.weblog, and ongoing IoT consulting initiatives. He’s additionally a well-known face at Z-Wave Alliance Unplug Fests, the place he incessantly serves because the lead coordinator, supporting interoperability and developer collaboration.






