audioamp11  2.1.0.0
Main Page

AudioAMP 11 click

AudioAmp 11 Click is a compact add-on board reproducing input audio signals with desired volume and power levels at sound-producing output elements. This board features the NAU8224, a high-performance stereo Class-D audio amplifier from Nuvoton Technology. This flexible I2C configurable audio amplifier can drive a 4Ω load with up to 3.1W output power. In addition to the possibility of digital control (using only one enable pin), the NAU8224 also has many useful gain settings from 6dB to 24dB. Besides, it is equipped with protection features, allowing a reliable operation.

click Product page


Click library

  • Author : Nenad Filipovic
  • Date : Jan 2023.
  • Type : I2C type

Software Support

We provide a library for the AudioAMP 11 Click as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.

Package can be downloaded/installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.

Library Description

This library contains API for AudioAMP 11 Click driver.

Standard key functions :

Example key functions :

Example Description

This library contains API for the AudioAMP 11 click driver. This demo application shows use of a AudioAMP 11 click board™.

The demo application is composed of two sections :

Application Init

Initialization of I2C module and log UART. After driver initialization the app set default settings, performs power-up sequence, sets the volume level to 0.

void application_init ( void )
{
log_cfg_t log_cfg;
audioamp11_cfg_t audioamp11_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
audioamp11_cfg_setup( &audioamp11_cfg );
AUDIOAMP11_MAP_MIKROBUS( audioamp11_cfg, MIKROBUS_1 );
if ( I2C_MASTER_ERROR == audioamp11_init( &audioamp11, &audioamp11_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
if ( AUDIOAMP11_ERROR == audioamp11_default_cfg ( &audioamp11 ) )
{
log_error( &logger, " Default configuration." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
log_printf( &logger, "----------------------\r\n" );
Delay_ms( 100 );
}

Application Task

This example demonstrates the use of the AudioAMP 11 click board™. If GAIN SEL switches are set to 12dB, the app performs circles switching the volume from -20.5 dB to 12 dB. If the GAIN SEL switches are different, the app sets the volume level to 31 (maximum). Results are being sent to the UART Terminal, where you can track their changes.

void application_task ( void )
{
uint8_t gain_level = 0;
uint8_t volume_level = 0;
audioamp11_check_gain( &audioamp11, &gain_level );
log_printf( &logger, " Gain set to %d dB\r\n", AUDIOAMP11_CALC_GAIN_CONFIG( gain_level ) );
if ( AUDIOAMP11_GAINDEC_12dB == gain_level )
{
float volume_table[ 32 ] = { OUTPUT_VOLUME_12dB };
Delay_ms( 100 );
{
}
else
{
}
audioamp11_get_output_volume_level( &audioamp11, &volume_level );
log_printf( &logger, " Volume set to %.1f dB\r\n", volume_table[ volume_level ] );
}
else
{
audioamp11_get_output_volume_level( &audioamp11, &volume_level );
}
log_printf( &logger, " Volume Level %d: ", ( uint16_t ) ( AUDIOAMP11_VOLUME_LEVEL_0 - volume_level ) );
for ( uint8_t n_cnt = 0; n_cnt < ( AUDIOAMP11_VOLUME_LEVEL_0 - volume_level ); n_cnt++ )
{
log_printf( &logger, "|" );
}
log_printf( &logger, "\r\n----------------------\r\n" );
Delay_ms( 1000 );
}

The full application code, and ready to use projects can be installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.

Other Mikroe Libraries used in the example:

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.AudioAMP11

Additional notes and informations

Depending on the development board you are using, you may need USB UART click, USB UART 2 Click or RS232 Click to connect to your PC, for development systems with no UART to USB interface available on the board. UART terminal is available in all MikroElektronika compilers.


audioamp11_get_output_volume_level
err_t audioamp11_get_output_volume_level(audioamp11_t *ctx, uint8_t *volume_data)
AudioAMP 11 get output volume level function.
AUDIOAMP11_GS_12dB_VOLCTRL_m20_5dB
#define AUDIOAMP11_GS_12dB_VOLCTRL_m20_5dB
Definition: audioamp11.h:163
vol_ctrl
uint8_t vol_ctrl
Definition: main.c:33
OUTPUT_VOLUME_12dB
#define OUTPUT_VOLUME_12dB
Definition: audioamp11.h:261
application_task
void application_task(void)
Definition: main.c:73
AUDIOAMP11_MAP_MIKROBUS
#define AUDIOAMP11_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition: audioamp11.h:287
audioamp11_set_output_volume_level
err_t audioamp11_set_output_volume_level(audioamp11_t *ctx, uint8_t volume_data)
AudioAMP 11 set output volume level function.
audioamp11_t
AudioAMP 11 Click context object.
Definition: audioamp11.h:300
AUDIOAMP11_ERROR
@ AUDIOAMP11_ERROR
Definition: audioamp11.h:335
audioamp11_init
err_t audioamp11_init(audioamp11_t *ctx, audioamp11_cfg_t *cfg)
AudioAMP 11 initialization function.
AUDIOAMP11_VOLUME_LEVEL_0
#define AUDIOAMP11_VOLUME_LEVEL_0
Definition: audioamp11.h:224
AUDIOAMP11_VOLUME_LEVEL_31
#define AUDIOAMP11_VOLUME_LEVEL_31
Definition: audioamp11.h:193
AUDIOAMP11_GS_12dB_VOLCTRL_12dB
#define AUDIOAMP11_GS_12dB_VOLCTRL_12dB
Definition: audioamp11.h:144
audioamp11_cfg_setup
void audioamp11_cfg_setup(audioamp11_cfg_t *cfg)
AudioAMP 11 configuration object setup function.
AUDIOAMP11_GAINDEC_12dB
#define AUDIOAMP11_GAINDEC_12dB
Definition: audioamp11.h:229
audioamp11_cfg_t
AudioAMP 11 Click configuration object.
Definition: audioamp11.h:317
audioamp11_check_gain
err_t audioamp11_check_gain(audioamp11_t *ctx, uint8_t *gain)
AudioAMP 11 check gain function.
application_init
void application_init(void)
Definition: main.c:35
audioamp11_default_cfg
err_t audioamp11_default_cfg(audioamp11_t *ctx)
AudioAMP 11 default configuration function.
audioamp11_enable_device
void audioamp11_enable_device(audioamp11_t *ctx)
AudioAMP 11 enable device function.
AUDIOAMP11_CALC_GAIN_CONFIG
#define AUDIOAMP11_CALC_GAIN_CONFIG(GAINDEC)
AudioAMP 11 description volume control.
Definition: audioamp11.h:251