NS Medical Devices is using cookies

We use them to give you the best experience. If you continue using our website, we'll assume that you are happy to receive all cookies on this website.

ContinueLearn More X
Home » pressreleases » Safe Microcontroller Programming Practices

Press
Release

Safe Microcontroller Programming Practices

Ambient Assisted Living (AAL) research aims to develop technologies for comfortable living and life in old age. These technologies are designed to improve older people’s quality of life and help them continue to lead independent lives. The care of the elderly is already a serious cost factor for national economies today and it will be even more so in the future. AAL research can make a critical contribution to controlling these costs and providing older people with a better quality of life.

At konplan Systemhaus we have been busy working on medical devices at various levels for a number of years. In ongoing projects, we are exploring application scenarios and solutions for the meaningful use of networked devices. We contribute to these research projects through the Luzern iHomeLab, an intelligent building, which is controlled entirely through IoT.

Design consideration of safety is one of the critical factors to ensure a system is robust in design, able to operate flawlessly in diverse environments, and does not interfere with other devices. This article focuses on design tips for using microcontrollers in such applications with extended safety requirements.

Defensive software design is a set of techniques to address the issues caused by improper software responses. The following specific software techniques are recommended for good defensive software design:

Enable the WatchDog Function

A WatchDog function forces a system reset when the application software fails to execute as expected. It is important to make sure that the device will not stop operating even if the software begins operating incorrectly. Allowing the microcontroller to remain in an undefined state is very dangerous and unacceptable, especially for applications with safety requirements.

Fill Unused Memory

Unused memory should be filled with suitable content such that the microcontroller does not execute any unexpected instructions when the normal execution flow is disturbed. The execution of these special instructions will force the processor to go through the fault routine and take the appropriate action to recover.

Define all Interrupt Vectors

Defining the interrupt vectors for each unused interrupt function ensures that the microcontroller will jump into a predefined interrupt routine when any particular unused interrupt flag is falsely triggered. The microcontroller is then able to resume correctly after the interrupt function.

Reconfirm Edge-Triggered Interrupts

Confirmation of edge-triggered interrupts is an essential technique to verify that input events are valid and driven by the correct sources. Checking within the interrupt service routine that the input signal was actually generated by the intended source will enable detection of noise on the input. If this is happening regularly in a design then the conclusion should be to provide filtering in hardware but a professional software engineer expects the worst case in any situation.

Enable Slew Rate Control

Slew rate control should be enabled for output port pins, where available. When enabled, slew rate control limits the rate at which an output can change state. This reduces the output rise and fall times, helping to minimize radiated emissions generated on output port switching and reducing interference with other susceptible devices.

Conclusion

Good software design can improve performance and operating stability in noisy environments. In general, the software design cannot control the physical media which injects noise into the system, or reduce the absolute magnitude of noise generated from external sources. However, software can provide intelligent corrective actions in fault conditions and implement precautionary features for system protection.

konplan is the one-stop solution provider for professional Medical Device Engineering in Switzerland. konplan provides design, development, quality assurance and documentation services for medical products to companies worldwide. konplan’s certified processes are tailored to the requirements of ISO 62304, 62366, 60601-1, 14971 and 13485.

Contact