Use peripherals in a real-time capable application

Important

This is the Azure Sphere (Legacy) documentation. Azure Sphere (Legacy) is retiring on 27 September 2027, and users must migrate to Azure Sphere (Integrated) by this time. Use the Version selector located above the TOC to view the Azure Sphere (Integrated) documentation.

Real-time capable applications (RTApps) can map peripherals for their exclusive use. To use one or more peripherals in an RTApp:

  • Add the peripheral to the application manifest.
  • Add an interrupt handler (if required) and other supporting code to the application.
  • Add code to ensure that each peripheral will be in a known good state on start up.

Important

For hardware-specific information about how to program peripherals for an RTApp, see the documentation from your hardware manufacturer. For register base addresses, interrupt numbers, clock rate, sampling frequency, and other details about the MT3620, see the MT3620 Datasheet and the MT3620 M4 User Manual; if questions remain, you can request details from Avnet by emailing Azure.Sphere@avnet.com.

All resources that an RTApp uses must be specified in the application manifest. In an RTApp, you must use the name for the resource that is assigned to AppManifestValue in the hardware definition JSON file for the target chip. You can't use the high-level name assigned to the resource in the hardware definition header file. For example, to find the value to identify I2C on ISU0 on MT3620 hardware, look in the the mt3620.json file in the HardwareDefinitions folder that is installed in the Microsoft Azure Sphere SDK folder. This peripheral is defined as follows in the JSON file:

 {"Name": "MT3620_ISU0_I2C", "Type": "I2cMaster", "MainCoreHeaderValue": "(0)", "AppManifestValue": "ISU0", "Comment": "MT3620 ISU 0 configured as I2C"},

Note that the value assigned to AppManifestValue for the I2C peripheral is "ISU0".

Concurrently loaded applications cannot share resources; resource use is exclusive to a single application. The Azure Sphere OS performs several important tasks when it loads the application:

  • Configures multiplexing, so that the pins associated with the peripheral are configured for the requested functionality.
  • Sets up core mapping, which involves configuring firewalls so that the application has access to the registers associated with the requested peripherals.
  • Checks the manifest and fails to load the application if it claims resources that have already been claimed by another app.

The remainder of this section provides details about using specific peripherals.

Note

The Azure Sphere OS does not reset peripherals on start up. Your applications should ensure that peripherals are in a known-good state on start up or after restart.

A device reboot is triggered when a new application that uses peripherals is installed and the following conditions are met:

If a device reboot is initiated, wait until the reboot is complete and the device becomes responsive.

Topic Description
Use ADCs in real-time capable applications Describes how to use analog-to-digital converters (ADCs) with Azure Sphere.
Use GPIO in real-time capable applications Describes how to use general purpose input/output (GPIO) with Azure Sphere.
Use GPT in real-time capable applications Describes how to use general purpose timers (GPT) with Azure Sphere.
Use I2C in real-time capable applications Describes how to use Inter-Integrated Circuit (I2C) for serial communication.
Use I2S in real-time capable applications Describes how to use Integrated Interchip Sound (I2S) with Azure Sphere
Use PWM in real-time capable applications Describes how to use pulse width modulation (PWM) with Azure Sphere.
Use SPI in real-time capable applications Describes how to use Serial Peripheral Interface (SPI) for serial communication.
Use UARTs in real-time capable applications Describes how to use UARTs for serial communication.
Use external interrupts in real-time capable applications Describes how to use external interrupts in an RTApp to respond to external signals.
Use watchdog timers in real-time capable applications Describes the effects of using watchdog timers on the MT3620 real-time cores.