Skip to content

Latest commit

 

History

History

platform_iadc_scan_multiple_external_input

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Platform - IADC scan multiple external inputs

Type badge Technology badge License badge SDK badge Build badge Flash badge RAM badge

Overview

This project demonstrates how to measure multiple external inputs with interrupt in scan mode using the IADC. The example uses a sleeptimer to schedule the measurement and logs the results. The inputs are considered as single-ended. The results of the measurements are sent via serial communication (EUSART) and can be observed as logs by using a serial terminal.

Gecko SDK version

  • GSDK v4.4.3

Hardware Required

Note:

Connections Required

Connect the board via the connector cable to your PC to flash the example.

Setup

To test this application, you can either create a project based on an example project or start with an "Empty C Project" project based on your hardware.

Create a project based on an example project

  1. Make sure that this repository is added to Preferences > Simplicity Studio > External Repos.

  2. From the Launcher Home, add your product name to My Products, click on it, and click on the EXAMPLE PROJECTS & DEMOS tab. Find the example project filtering by "multiple".

  3. Click the Create button on Platform - IADC scan multiple external input example. Example project creation dialog pops up -> click Create and Finish and the project should be generated.

create_project

  1. Build and flash this example to the board.

Start with an "Empty C Project" project

  1. Create an Empty C Project project for your hardware using Simplicity Studio 5.

  2. Copy all files in the inc and src folders into the project root folder (overwriting the existing file).

  3. Install the software components:

    3.1. Open the .slcp file in the project

    3.2. Select the SOFTWARE COMPONENTS tab

    3.3. Install the following components:

    • [Platform] → [Peripheral] → [IADC]

    • [Services] → [IO Stream] → [Driver] → [IO Stream: EUSART] (In case of an xG21 device IO Stream: USART should be used)

    • [Application] → [Utility] → [Log]

    • [Services] → [Timers] → [Sleep Timer]

    • [Third party] → [Tiny printf]

  4. Enable Virtual COM UART

    • [Platform] → [Board] → [Board Control] → [Configure] → [Enable Virtual COM UART]
  5. Build and flash the project to your board.

How It Works

The example uses the IADC to measure the voltage level of multiple external inputs in scan mode with interrupt. The inputs are considered as single-ended, thus the signals are measured with ground as the negative input. The reference voltage is 3.3V. The implementation contains the measurement of three inputs, and by adding more elements to the scan table this number can be raised even further.

The board specific pins are defined in the app.h file. These pins are connected to the EXP Header pins or to the Breakout Pins of the Wireless Starter Kit (WSTK).

The example uses a periodic sleeptimer service to schedule the measurements of the IADC and the display of the logs. The default measurement period is 5 seconds, which can be changed by modifying the TIMER_TIMEOUT macro in the 'app.c' file.

By using a serial terminal (like Tera Term) the measured values can be observed. By default the EUSART peripheral is used for the serial communication. Since there is no EUSART peripheral on the devices of the xG21 family, the USART peripheral is used there.

log

Pin Routing

Pin Name BRD4181b BRD4182a BRD4210a BRD4186c BRD4270b BRD4194A BRD4400C
IADC ENTRIE0 EXP_HEADER7 (PB0) EXP_HEADER7 (PB1) EXP_HEADER7 (PA5) WSTK_P19 (PB2) EXP_HEADER10 (PB4) EXP_HEADER7 (PB0) EXP_HEADER11 (PB4)
IADC ENTRIE1 EXP_HEADER9 (PB1) EXP_HEADER9 (PB2) EXP_HEADER11 (PA6) WSTK_P26 (PB4) EXP_HEADER15 (PB2) EXP_HEADER9 (PB1) EXP_HEADER13 (PB5)
IADC ENTRIE2 WSTK_P14 (PA0) EXP_HEADER15 (PB3) EXP_HEADER13 (PA7) EXP_HEADER13 (PA7) EXP_HEADER16 (PB3) EXP_HEADER15 (PB2) EXP_HEADER3 (PA11)