Join IoT Central | Join our LinkedIn Group | Post on IoT Central


jacob beningo (2)

Recovering from a system failure or a software glitch can be no easy task.  The longer the fault occurs the harder it can be to identify and recover.  The use of an external watchdog is an important and critical tool in the embedded systems engineer toolbox.  There are five tips that should be taken into account when designing a watchdog system.

Tip #1 – Monitor a heartbeat

The simplest function that an external watchdog can have is to monitor a heartbeat that is produced by the primary application processor.  Monitoring of the heartbeat should serve two distinct purposes.  First, the microcontroller should only generate the heartbeat after functional checks have been performed on the software to ensure that it is functioning.  Second, the heartbeat should be able to reveal if the real-time response of the system has been jeopardized.

Monitoring the heartbeat for software functionality and real-time response can be done using a simple, “dumb” external watchdog.  The external watchdog should have the capability to assign a heartbeat period along with a window that the heartbeat must appear within.  The purpose of the heartbeat window is to allow the watchdog to detect that the real-time response of the system is compromised.  In the event that either functional or real-time checks fail the watchdog then attempts to recover the system through a reset of the application processor.

Tip #2 – Use a low capability MCU

External watchdogs that can be to monitor a heartbeat are relatively low cost but can severely limit the capabilities and recovery possibilities of the watchdog system.  A low capability microcontroller can cost nearly the same amount as an external watchdog timer so why not add some intelligence to the watchdog and use a microcontroller.  The microcontroller firmware can be developed to fulfill the windowed heartbeat monitoring with the addition of so much more.  A “smart” watchdog like this is sometimes referred to as a supervisor or safety watchdog and has actually been used for many years in different industries such as automotive.  Generally a microcontroller watchdog has been reserved for safety critical applications but given the development tools and the cost of hardware it can be cost effective in other applications as well.

Tip #3 – Supervise critical system functions

The decision to use a small microcontroller as a watchdog opens nearly endless possibilities of how the watchdog can be used.  One of the first roles of a smart watchdog is usually to supervise critical system functions such as a system current or sensor state.  One example of how a watchdog could supervise a current would be to take an independent measurement and then provide that value to the application processor.  The application processor could then compare its own reading to that of the watchdog.  If there were disagreement between the two then the system would execute a fault tree that was deemed to be appropriate for the application.

Tip #4 – Observe a communication channel

Sometimes an embedded system can appear to be operating as expected to the watchdog and the application processor but from an external observer be in a non-responsive state.  In such cases it can be useful to tie the smart watchdog to a communication channel such as a UART.  When the watchdog is connected to a communication channel it not only monitor channel traffic but even commands that are specific to the watchdog.  A great example of this is a watchdog designed for a small satellite that monitors radio communications between the flight computer and ground station.  If the flight computer becomes non-responsive to the radio, a command could be sent to the watchdog that is then executed and used to reset the flight computer.

Tip #5 – Consider an externally timed reset function

The question of who is watching the watchdog is undoubtedly on the minds of many engineers when using a microcontroller for a watchdog.  Using a microcontroller to implement extra features adds some complexity and a new software element to the system.  In the event that the watchdog goes off into the weeds how is the watchdog going to recover? One option would be to use an external watchdog timer that was discussed earlier.  The smart watchdog would generate a heartbeat to keep itself from being reset by the watchdog timer.  Another option would be to have the application processor act as the watchdog for the watchdog.  Careful thought needs to be given to the best way to ensure both processors remain functioning as intended.

Conclusion

The purpose of the smart watchdog is to monitor the system and the primary microcontroller to ensure that they operate as expected.  During the design of a system watchdog it can be very tempting to allow the number of features supported to creep.  Developers need to keep in mind that as the complexity of the smart watchdog increases so does the probability that the watchdog itself will contain potential failure modes and bugs.  Keeping the watchdog simple and to the minimum necessary feature set will ensure that it can be exhaustively tested and proven to work.

Originally Posted here

 

Read more…

5 Tips for Expanding your Embedded Skills

As embedded systems engineers, we work in a field that is constantly changing. Not only does change come quickly, the amount of work and the skills we need in order to successfully do our jobs is constantly expanding. A firmware engineer used to need to know the microcontroller hardware and assembly language. Today, they need to know the hardware, several languages, machine learning, security, and dozen other topics. In today’s post, we are going to look at five ways to expand your skillset and stay ahead of the game.

Tip #1 – Take an online course

Taking an online course is a great way to enhance and add to your skillset. If anyone tries to tell you that you don’t need additional coursework don’t let them fool. I’ve often been called an expert in embedded systems, but just like everyone else, I need to take courses to learn and maintain my skillset. In fact, just this week I took a course on Test Driven Development taught by James Grenning, the expert in TDD. I’ve been playing with TDD on and off for several years but despite that familiarity, working with an expert in a subject matter will dramatically improve your skills. I was able to pick James’ brain on TDD, enhance my skills and walked away with several action items to work on over the next several months.

Start by identifying an area of your own skillset that is deficient, rusty or even an area that you want to just move to the next level in. Then find the expert on that topic and take an online, interactive or self-paced course with them. (I won’t mention my own courses that you can find here … ooopps!  )

Tip #2 – Read a book

Books can be a great way to enhance your skills. There are dozens of books on embedded system design that can easily be found at any bookstore or online. Some books are better than others. I’ve started to write-up reviews on the books that I’ve read in order to provide you with recommendations on books. This is just in its infancy and can be found at: https://www.beningo.com/?s=book (I’ll be adding a category in the near future to the blog).

You might also want to check out Jack Ganssles book reviews as well which you can find at: http://www.ganssle.com/bkreviews.htm

Books that I am currently working through myself that I’ve been finding to be fantastic so far include:

  • TinyML
  • Clean Code
  • The object-oriented thought process

Tip #3 – Watch a webinar

Webinars are a great way to get a high-level understanding of a new skill or topic. I don’t think a day goes by where I don’t get an advertisement for a webinar in my inbox. Unfortunately, all webinars are not created equal. I’ve come across many webinars that sound fantastic, only to later discover that they are totally marketing focused with little real technical information. I produced anywhere from 8 – 12 webinars per year and always try to include high-level theory, some low-level details and then a practical example through a demonstration. It doesn’t always work out that way and every now and then they undoubtedly flirt with being marketing versus technical, but I always try to make sure that developers get what they need and know where they need to go to dive deeper.

Over the coming months keep a close eye on webinars as a potential source to enhance your skills. I know that I’ll be attending several on Bluetooth Mesh networking (hoping they aren’t pure marketing pitches), and I will also be pulling together several of my own.

Tip #4 – Build something for fun

There is no better way to learn a new skill than to do something! I’ve always found that people who attend my webinars, courses, etc learn more if there are demonstrations and hands-on materials. It’s great to read about machine learning of continuous integration servers but unless you set one up, it’s just theory. We all know that the devil is in the details and applying the skill is what sharpens it.

I highly recommend that developers build something for fun. More than a decade ago when I wanted to learn how to design and layout PCB’s and work with USB firmware, I decided that I was going to develop a USB controlled light bar. I went through an accelerated development schedule and designed schematics and a PCB, had it fabricated and then hand soldered the parts. I wrote all the firmware and eventually had a working device. I learned so much building that simple light bar and even used it for as an example during interviews when I was looking for a new job (this was before I started my business).

Even today, I will still pick a project when I want to learn something. When I was evaluating MicroPython I built an internet connected weather station. It forced me to exercise many details and forced me to solve problems that I otherwise might not have considered if I hadn’t dived into the deep end.

Tip #5 – Find a mentor

The times that I’ve accelerated my understanding of something the most has usually been under the guidance of a mentor or coach. Someone who has mastered the skill you are trying to work with, has made every mistake and can share their wisdom. It’s certainly possible to learn and advance without a mentor but having feedback and the ability to answer a question and then get an educated response can dramatically accelerate the time involved. That’s one of the reasons why I often host interactive webinars and even have a coaching and trusted advisor offering for my clients. It’s just extremely helpful!

Conclusions

No matter how good you are at developing embedded software, hardware and systems, if you don’t take the time to update your skills then within just a few years you’ll find that everyone else is passing you by. You’ll be less efficient and find that you are struggling. Continuing education is critical to engineers to ensure that they are up to date on the latest and greatest practices and contribute their products success.

Originally posted here

Read more…

Sponsor