1. Introduction

1.1. Before You Start

Before you start you need to:

  • Install the latest SmartSnippets Studio
  • Download the latest SDK for the DA1468x platforms

These can be downloaded from the Dialog Semiconductor support portal.

Additionally, for this tutorial either a Pro or Basic Development kit is required.

The key goals of this tutorial are to:

  • Provide a basic understanding of adapters concept
  • Explain the different APIs and configurations of GPADC adapters
  • Give a complete sample project demonstrating the usage of GPADC and battery adapters

1.2. GPADC Adapters Introduction

This tutorial explains GPADC adapters and how to configure the DA1468x family of devices to perform analog-to-digital conversions, including battery measurements. The latter can be considered as a special use case of the GPADC interface.

The GPADC adapter is an intermediate layer between the GPADC Low Level Drivers (LLDs) and a user application. It allows the user to utilize the GPADC interface in a simpler way than when using pure LLDs functions. The key features of GPADC adapters are:

  • Synchronous writing/reading operations block the calling freeRTOS task while the operation is performed using semaphores rather than relying on a polling loop approach. This means that while the hardware is busy transferring data, the operating system (OS) scheduler may select another task for execution, utilizing processor time more efficiently. When the transfer has finished, the calling task is released and resumes its execution.
  • It ensures that only one application task can use the GPADC interface after acquiring it.
  • Placing code between ad_gpadc_acquire() and ad_gpadc_release() ensures that only one task can use the GPADC interface to perform analog-to-digital conversions. During this period no other task can use the GPADC interface until the ad_gpadc_release() function is called by the owning task.
  • Power Manager (PM) of the chip is aware of the GPADC peripheral usage and, before the system enters sleep, it checks whether or not there is activity on the GPADC block.

Note

Adapters are not implemented as separate tasks and should be considered as an additional layer between the application and the LLDs. It is recommended to use adapters for accessing a hardware block.

'Adapters Communication'

Fig. 1 Adapters Communication