基于专有的多级开关技术的超高效音频功率放大器。
A
A
硬件概览
它是如何工作的?
AudioAmp 8 Click 基于来自英飞凌科技的 MA12070,这是一款基于专有的多级开关技术的超高效音频功率放大器,能够在运行过程中实现低功率损耗。MA12070 具有智能功率管理算法,在音频播放过程中应用自动功率模式选择。在此状态下,放大器将根据音频水平无缝地在三种不同的功率模式之间转换,以实现最佳的功率损耗、音频性能和电磁干扰。另外,也可以通过串行接口手动选择 MA12070 的所需功率模式。MA12070 使用标准的 I2C 2 线接口与 MCU 进行通信,支持标准 (100 kHz) 和快速 (400 kHz) 模式操作。它有一个 7 位的从设备地址,前五个 MSB 固定为 01000。用户通过编程地址引脚确定从设备地址的最后
两个 LSB 的值,可以通过将标记为 ADDR SEL 的板载 SMD 跳线放置到适当的位置标记为 0 或 1 来选择。这个 Click board™ 支持为电机提供外部电源,可以连接到标记为 VIN 的输入端子,并且应该在 6V 到 26V 的范围内,而输入音频可以通过标记为 AUDIO IN 的输入插孔带到所需声道 SPK OUT 的扬声器上进行特定处理后再现。MA12070 在四个功率放大器通道的配置方面具有高度的灵活性。通过设置配置引脚 MS0 和 MS1,路由到 mikroBUS™ 插座的 INT 和 PWM 引脚,可以将其设置为四种不同的输出配置。除了这些引脚外,这个 Click board™ 还使用了 mikroBUS™ 插座的几个其他引脚。使能引脚,标记为 EN 并
路由到 mikroBUS™ 插座的 CS 引脚,用于优化用于开机/关机目的的功耗,而路由到 RST 引脚的 MUT 引脚允许用户将连接的扬声器上的音频静音。此外,还可以检测操作异常,例如过流和短路检测。这种情况的指示使用标记为 ERROR 的红色 LED 指示灯进行,同时使用标记为 CLIP 的蓝色 LED 指示灯进行音频剪辑指示,指示音频输出接近剪辑时。这个 Click board™ 只能使用 5V 逻辑电压电平进行操作。在使用具有不同逻辑电平的 MCU 之前,板子必须执行适当的逻辑电压电平转换。然而,该 Click board™ 配备了一个包含函数和示例代码的库,可用作进一步开发的参考。
功能概述
开发板
EasyPIC v8 是一款专为快速开发嵌入式应用的需求而特别设计的开发板。它支持许多高引脚计数的8位PIC微控制器,来自Microchip,无论它们的引脚数量如何,并且具有一系列独特功能,例如首次集成的调试器/程序员。开发板布局合理,设计周到,使得最终用户可以在一个地方找到所有必要的元素,如开关、按钮、指示灯、连接器等。得益于创新的制造技术,EasyPIC v8 提供了流畅而沉浸式的工作体验,允许在任何情况下、任何地方、任何时候都能访问。
EasyPIC v8 开发板的每个部分都包含了使同一板块运行最高效的必要组件。除了先进的集成CODEGRIP程 序/调试模块,该模块提供许多有价值的编程/调试选项和与Mikroe软件环境的无缝集成外,该板还包括一个干净且调节过的开发板电源供应模块。它可以使用广泛的外部电源,包括电池、外部12V电源供应和通过USB Type-C(USB-C)连接器的电源。通信选项如USB-UART、USB DEVICE和CAN也包括在内,包括 广受好评的mikroBUS™标准、两种显示选项(图形和
基于字符的LCD)和几种不同的DIP插座。这些插座覆盖了从最小的只有八个至四十个引脚的8位PIC MCU的广泛范围。EasyPIC v8 是Mikroe快速开发生态系统的一个组成部分。它由Mikroe软件工具原生支持,得益于大量不同的Click板™(超过一千块板),其数量每天都在增长,它涵盖了原型制作和开发的许多方面。
微控制器概述
MCU卡片 / MCU

建筑
PIC
MCU 内存 (KB)
64
硅供应商
Microchip
引脚数
40
RAM (字节)
3968
使用的MCU引脚
mikroBUS™映射器
“仔细看看!”
Click board™ 原理图

一步一步来
项目组装
实时跟踪您的结果
应用程序输出
1. 应用程序输出 - 在调试模式下,“应用程序输出”窗口支持实时数据监控,直接提供执行结果的可视化。请按照提供的教程正确配置环境,以确保数据正确显示。

2. UART 终端 - 使用UART Terminal通过USB to UART converter监视数据传输,实现Click board™与开发系统之间的直接通信。请根据项目需求配置波特率和其他串行设置,以确保正常运行。有关分步设置说明,请参考提供的教程。

3. Plot 输出 - Plot功能提供了一种强大的方式来可视化实时传感器数据,使趋势分析、调试和多个数据点的对比变得更加直观。要正确设置,请按照提供的教程,其中包含使用Plot功能显示Click board™读数的分步示例。在代码中使用Plot功能时,请使用以下函数:plot(insert_graph_name, variable_name);。这是一个通用格式,用户需要将“insert_graph_name”替换为实际图表名称,并将“variable_name”替换为要显示的参数。

软件支持
库描述
该库包含 AudioAmp 8 Click 驱动程序的 API。
关键功能:
audioamp8_cfg_setup
- 配置对象初始化函数。audioamp8_init
- 初始化函数。audioamp8_default_cfg
- Click 默认配置函数。
开源
代码示例
完整的应用程序代码和一个现成的项目可以通过NECTO Studio包管理器直接安装到NECTO Studio。 应用程序代码也可以在MIKROE的GitHub账户中找到。
/*!
* @file main.c
* @brief AudioAmp8 Click example
*
* # Description
* This library contains API for AudioAmp 8 Click driver.
* The library initializes and defines the I2C bus drivers
* to write and read data from registers.
*
* The demo application is composed of two sections :
*
* ## Application Init
* The initialization of I2C module, log UART, and additional pins.
* After the driver init and executing a default configuration,
* the app performs a BTL signal configuration, configures power mode
* and configures power mode profile.
*
* ## Application Task
* This is an example that shows the use of a AudioAmp 8 Click board™.
* Displays status monitoring for channel 0 or channel 1.
* This task repeats once every 2 seconds.
*
* ## Additional Function
* - static void channel_status_monitoring ( uint8_t ch_sel ) - The function displays the status monitoring channel.
*
* @author Nenad Filipovic
*
*/
#include "board.h"
#include "log.h"
#include "audioamp8.h"
static audioamp8_t audioamp8;
static log_t logger;
static audioamp8_pwr_mon_cfg_t pwr_mode;
static audioamp8_pwr_mod_profile_cfg_t pm_profile;
static audioamp8_monitor_channel_t ch_mon;
static void channel_status_monitoring ( uint8_t ch_sel )
{
audioamp8_channel_monitoring( &audioamp8, ch_sel, &ch_mon );
Delay_ms ( 100 );
log_printf( &logger, " Frequency mode : %d\r\n", ( uint16_t ) ch_mon.freq_mode );
log_printf( &logger, " Power mode : %d\r\n", ( uint16_t ) ch_mon.pwr_mode );
log_printf( &logger, " Channel %d mute : ", ( uint16_t ) ch_sel );
if ( ch_mon.mute_mon == AUDIOAMP8_SET_ENABLE )
{
log_printf( &logger, "ON\r\n" );
}
else
{
log_printf( &logger, "OFF\r\n" );
}
log_printf( &logger, " Channel %d VDD : ", ( uint16_t ) ch_sel );
if ( ch_mon.vdd_mon == AUDIOAMP8_SET_ENABLE )
{
log_printf( &logger, "ON\r\n" );
}
else
{
log_printf( &logger, "OFF\r\n" );
}
log_printf( &logger, " Channel %d PVDD : ", ( uint16_t ) ch_sel );
if ( ch_mon.pvdd_mon == AUDIOAMP8_SET_ENABLE )
{
log_printf( &logger, "ON\r\n" );
}
else
{
log_printf( &logger, "OFF\r\n" );
}
log_printf( &logger, " Cfly1 protection : " );
if ( ch_mon.cfly1_mon == AUDIOAMP8_SET_ENABLE )
{
log_printf( &logger, "ON\r\n" );
}
else
{
log_printf( &logger, "OFF\r\n" );
}
log_printf( &logger, " Cfly2 protection : " );
if ( ch_mon.cfly2_mon == AUDIOAMP8_SET_ENABLE )
{
log_printf( &logger, "ON\r\n" );
}
else
{
log_printf( &logger, "OFF\r\n" );
}
log_printf( &logger, " Current protection: " );
if ( ch_mon.ovc_prot == AUDIOAMP8_SET_ENABLE )
{
log_printf( &logger, "ON\r\n" );
}
else
{
log_printf( &logger, "OFF\r\n" );
}
log_printf( &logger, " Modulation index : %d\r\n", ( uint16_t ) ch_mon.modul_index_mon );
log_printf( &logger, "-------------------------\r\n" );
}
void application_init ( void )
{
log_cfg_t log_cfg; /**< Logger config object. */
audioamp8_cfg_t audioamp8_cfg; /**< Click config object. */
/**
* Logger initialization.
* Default baud rate: 115200
* Default log level: LOG_LEVEL_DEBUG
* @note If USB_UART_RX and USB_UART_TX
* are defined as HAL_PIN_NC, you will
* need to define them manually for log to work.
* See @b LOG_MAP_USB_UART macro definition for detailed explanation.
*/
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
audioamp8_cfg_setup( &audioamp8_cfg );
AUDIOAMP8_MAP_MIKROBUS( audioamp8_cfg, MIKROBUS_1 );
err_t init_flag = audioamp8_init( &audioamp8, &audioamp8_cfg );
if ( I2C_MASTER_ERROR == init_flag )
{
log_error( &logger, " Application Init Error. " );
log_info( &logger, " Please, run program again... " );
for ( ; ; );
}
if ( AUDIOAMP8_ERROR == audioamp8_default_cfg ( &audioamp8 ) )
{
log_error( &logger, " Default configuration." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
log_printf( &logger, "-------------------------\r\n" );
Delay_ms ( 1000 );
}
void application_task ( void )
{
channel_status_monitoring( AUDIOAMP8_SET_MON_CH_0 );
Delay_ms ( 1000 );
}
int main ( void )
{
/* Do not remove this line or clock might not be set correctly. */
#ifdef PREINIT_SUPPORTED
preinit();
#endif
application_init( );
for ( ; ; )
{
application_task( );
}
return 0;
}
// ------------------------------------------------------------------------ END
/*!
* @file main.c
* @brief AudioAmp8 Click example
*
* # Description
* This library contains API for AudioAmp 8 Click driver.
* The library initializes and defines the I2C bus drivers
* to write and read data from registers.
*
* The demo application is composed of two sections :
*
* ## Application Init
* The initialization of I2C module, log UART, and additional pins.
* After the driver init and executing a default configuration,
* the app performs a BTL signal configuration, configures power mode
* and configures power mode profile.
*
* ## Application Task
* This is an example that shows the use of a AudioAmp 8 Click board™.
* Displays status monitoring for channel 0 or channel 1.
* This task repeats once every 2 seconds.
*
* ## Additional Function
* - static void channel_status_monitoring ( uint8_t ch_sel ) - The function displays the status monitoring channel.
*
* @author Nenad Filipovic
*
*/
#include "board.h"
#include "log.h"
#include "audioamp8.h"
static audioamp8_t audioamp8;
static log_t logger;
static audioamp8_pwr_mon_cfg_t pwr_mode;
static audioamp8_pwr_mod_profile_cfg_t pm_profile;
static audioamp8_monitor_channel_t ch_mon;
static void channel_status_monitoring ( uint8_t ch_sel )
{
audioamp8_channel_monitoring( &audioamp8, ch_sel, &ch_mon );
Delay_ms ( 100 );
log_printf( &logger, " Frequency mode : %d\r\n", ( uint16_t ) ch_mon.freq_mode );
log_printf( &logger, " Power mode : %d\r\n", ( uint16_t ) ch_mon.pwr_mode );
log_printf( &logger, " Channel %d mute : ", ( uint16_t ) ch_sel );
if ( ch_mon.mute_mon == AUDIOAMP8_SET_ENABLE )
{
log_printf( &logger, "ON\r\n" );
}
else
{
log_printf( &logger, "OFF\r\n" );
}
log_printf( &logger, " Channel %d VDD : ", ( uint16_t ) ch_sel );
if ( ch_mon.vdd_mon == AUDIOAMP8_SET_ENABLE )
{
log_printf( &logger, "ON\r\n" );
}
else
{
log_printf( &logger, "OFF\r\n" );
}
log_printf( &logger, " Channel %d PVDD : ", ( uint16_t ) ch_sel );
if ( ch_mon.pvdd_mon == AUDIOAMP8_SET_ENABLE )
{
log_printf( &logger, "ON\r\n" );
}
else
{
log_printf( &logger, "OFF\r\n" );
}
log_printf( &logger, " Cfly1 protection : " );
if ( ch_mon.cfly1_mon == AUDIOAMP8_SET_ENABLE )
{
log_printf( &logger, "ON\r\n" );
}
else
{
log_printf( &logger, "OFF\r\n" );
}
log_printf( &logger, " Cfly2 protection : " );
if ( ch_mon.cfly2_mon == AUDIOAMP8_SET_ENABLE )
{
log_printf( &logger, "ON\r\n" );
}
else
{
log_printf( &logger, "OFF\r\n" );
}
log_printf( &logger, " Current protection: " );
if ( ch_mon.ovc_prot == AUDIOAMP8_SET_ENABLE )
{
log_printf( &logger, "ON\r\n" );
}
else
{
log_printf( &logger, "OFF\r\n" );
}
log_printf( &logger, " Modulation index : %d\r\n", ( uint16_t ) ch_mon.modul_index_mon );
log_printf( &logger, "-------------------------\r\n" );
}
void application_init ( void )
{
log_cfg_t log_cfg; /**< Logger config object. */
audioamp8_cfg_t audioamp8_cfg; /**< Click config object. */
/**
* Logger initialization.
* Default baud rate: 115200
* Default log level: LOG_LEVEL_DEBUG
* @note If USB_UART_RX and USB_UART_TX
* are defined as HAL_PIN_NC, you will
* need to define them manually for log to work.
* See @b LOG_MAP_USB_UART macro definition for detailed explanation.
*/
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
audioamp8_cfg_setup( &audioamp8_cfg );
AUDIOAMP8_MAP_MIKROBUS( audioamp8_cfg, MIKROBUS_1 );
err_t init_flag = audioamp8_init( &audioamp8, &audioamp8_cfg );
if ( I2C_MASTER_ERROR == init_flag )
{
log_error( &logger, " Application Init Error. " );
log_info( &logger, " Please, run program again... " );
for ( ; ; );
}
if ( AUDIOAMP8_ERROR == audioamp8_default_cfg ( &audioamp8 ) )
{
log_error( &logger, " Default configuration." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
log_printf( &logger, "-------------------------\r\n" );
Delay_ms ( 1000 );
}
void application_task ( void )
{
channel_status_monitoring( AUDIOAMP8_SET_MON_CH_0 );
Delay_ms ( 1000 );
}
int main ( void )
{
/* Do not remove this line or clock might not be set correctly. */
#ifdef PREINIT_SUPPORTED
preinit();
#endif
application_init( );
for ( ; ; )
{
application_task( );
}
return 0;
}
// ------------------------------------------------------------------------ END