在不同电源域的设备之间创建通信桥梁。
A
A
硬件概览
它是如何工作的?
SPI Isolator 6 Click 基于 MAX22345,这是一款四通道数字隔离器,来自 Analog Devices,最大数据传输速率为 200Mbps。MAX22345 为在两个接地域之间传输的数字信号提供了电气隔离,能够承受高达 784Vpeak 的连续隔离和高达 3.75kVRMS 的 60 秒隔离。除此之外,Analog 的专有工
艺技术提供了低功耗操作、高电磁干扰(EMI)抗性和稳定的温度性能。两个电源引脚的宽电压范围允许 MAX22345 用于电平转换和隔离。由于这款 Click board™ 代表了用于 SPI 通信的隔离器,因此它通过 SPI 通信与 MCU 进行逻辑通信。如前所述,MAX22345 具有 A 和 具有另外两个端
子,用于连接隔离的 SPI 数据通信线路。此 Click board™ 可以在 3.3V 或 5V 逻辑电压水平下工作,通过 VCC SEL 跳线选择。这种方式使得 3.3V 和 5V 的 MCU 都可以正确使用通信线路。此外,这款 Click board™ 配备了一个包含易于使用的函数库和示例代码的库,可用于进一步开发。
功能概述
开发板
PIC32MZ Clicker 是一款紧凑型入门开发板,它将 Click 板™的灵活性带给您喜爱的微控制器,使其成为实现您想法的完美入门套件。它配备了一款板载 32 位带有浮点单元的 Microchip PIC32MZ 微控制器,一个 USB 连接器,LED 指示灯,按钮,一个 mikroProg 连接器,以及一个用于与外部电子设备接口的头部。得益于其紧凑的设计和清晰易识别的丝网标记,它提供了流畅且沉浸式的工作体验,允许在任
何情况下、任何地方都能访问。PIC32MZ Clicker 开 发套件的每个部分都包含了使同一板块运行最高效的必要组件。除了可以选择 PIC32MZ Clicker 的编程方式,使用 USB HID mikroBootloader 或通过外部 mikroProg 连接器为 PIC,dsPIC 或 PIC32 编程外,Clicker 板还包括一个干净且调节过的开发套件电源供应模块。USB Micro-B 连接可以提供多达 500mA 的电流,这足以操作所有板载和附加模块。所有
mikroBUS™ 本身支持的通信方法都在这块板上,包 括已经建立良好的 mikroBUS™ 插槽、重置按钮以及若干按钮和 LED 指示灯。PIC32MZ Clicker 是 Mikroe 生态系统的一个组成部分,允许您在几分钟内创建新的应用程序。它由 Mikroe 软件工具原生支持,得益于大量不同的 Click 板™(超过一千块板),其数量每天都在增长,它涵盖了原型制作的许多方面。
微控制器概述
MCU卡片 / MCU

建筑
PIC32
MCU 内存 (KB)
1024
硅供应商
Microchip
引脚数
64
RAM (字节)
524288
使用的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”替换为要显示的参数。

软件支持
库描述
该库包含 SPI Isolator 6 Click 驱动程序的 API。
关键功能:
spiisolator6_generic_write
- 此函数通过使用SPI串行接口写入所需数量的数据字节。spiisolator6_generic_read
- 此函数通过使用SPI串行接口先写入然后读取所需数量的数据字节。
开源
代码示例
完整的应用程序代码和一个现成的项目可以通过NECTO Studio包管理器直接安装到NECTO Studio。 应用程序代码也可以在MIKROE的GitHub账户中找到。
/*!
* @file main.c
* @brief SPIIsolator6 Click example
*
* # Description
* This example demonstrates the use of SPI Isolator 6 click board by reading the
* device ID of the connected Accel 22 click board.
*
* The demo application is composed of two sections :
*
* ## Application Init
* Initializes the driver and logger.
*
* ## Application Task
* Reads and checks the device ID of the connected Accel 22 click board, and displays the
* results on the USB UART approximately once per second.
*
* @note
* Make sure to provide VCC power supply on VCC-EXT pin.
*
* @author Stefan Filipovic
*
*/
#include "board.h"
#include "log.h"
#include "spiisolator6.h"
static spiisolator6_t spiisolator6;
static log_t logger;
/**
* @brief SPI Isolator 6 get accel 22 device id function.
* @details This function reads and checks the device ID of the connected Accel 22 click board.
* @param[in] ctx : Click context object.
* See #spiisolator6_t object definition for detailed explanation.
* @return None.
* @note None.
*/
void spiisolator6_get_accel22_device_id ( spiisolator6_t *ctx );
void application_init ( void )
{
log_cfg_t log_cfg; /**< Logger config object. */
spiisolator6_cfg_t spiisolator6_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.
spiisolator6_cfg_setup( &spiisolator6_cfg );
SPIISOLATOR6_MAP_MIKROBUS( spiisolator6_cfg, MIKROBUS_1 );
if ( SPI_MASTER_ERROR == spiisolator6_init( &spiisolator6, &spiisolator6_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
}
void application_task ( void )
{
spiisolator6_get_accel22_device_id ( &spiisolator6 );
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;
}
void spiisolator6_get_accel22_device_id ( spiisolator6_t *ctx )
{
#define DEVICE_NAME "Accel 22 click"
#define DEVICE_SPI_READ_REG 0x0B
#define DEVICE_REG_ID 0x00
#define DEVICE_ID 0xAD
uint8_t data_in[ 2 ] = { DEVICE_SPI_READ_REG, DEVICE_REG_ID };
uint8_t device_id;
if ( SPIISOLATOR6_OK == spiisolator6_generic_read ( ctx, data_in, 2, &device_id, 1 ) )
{
log_printf( &logger, "\r\n %s\r\n", ( char * ) DEVICE_NAME );
if ( DEVICE_ID == device_id )
{
log_printf ( &logger, " Device ID: 0x%.2X\r\n", ( uint16_t ) device_id );
}
else
{
log_error( &logger, " Wrong Device ID: 0x%.2X", ( uint16_t ) device_id );
}
}
}
// ------------------------------------------------------------------------ END
/*!
* @file main.c
* @brief SPIIsolator6 Click example
*
* # Description
* This example demonstrates the use of SPI Isolator 6 click board by reading the
* device ID of the connected Accel 22 click board.
*
* The demo application is composed of two sections :
*
* ## Application Init
* Initializes the driver and logger.
*
* ## Application Task
* Reads and checks the device ID of the connected Accel 22 click board, and displays the
* results on the USB UART approximately once per second.
*
* @note
* Make sure to provide VCC power supply on VCC-EXT pin.
*
* @author Stefan Filipovic
*
*/
#include "board.h"
#include "log.h"
#include "spiisolator6.h"
static spiisolator6_t spiisolator6;
static log_t logger;
/**
* @brief SPI Isolator 6 get accel 22 device id function.
* @details This function reads and checks the device ID of the connected Accel 22 click board.
* @param[in] ctx : Click context object.
* See #spiisolator6_t object definition for detailed explanation.
* @return None.
* @note None.
*/
void spiisolator6_get_accel22_device_id ( spiisolator6_t *ctx );
void application_init ( void )
{
log_cfg_t log_cfg; /**< Logger config object. */
spiisolator6_cfg_t spiisolator6_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.
spiisolator6_cfg_setup( &spiisolator6_cfg );
SPIISOLATOR6_MAP_MIKROBUS( spiisolator6_cfg, MIKROBUS_1 );
if ( SPI_MASTER_ERROR == spiisolator6_init( &spiisolator6, &spiisolator6_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
}
void application_task ( void )
{
spiisolator6_get_accel22_device_id ( &spiisolator6 );
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;
}
void spiisolator6_get_accel22_device_id ( spiisolator6_t *ctx )
{
#define DEVICE_NAME "Accel 22 click"
#define DEVICE_SPI_READ_REG 0x0B
#define DEVICE_REG_ID 0x00
#define DEVICE_ID 0xAD
uint8_t data_in[ 2 ] = { DEVICE_SPI_READ_REG, DEVICE_REG_ID };
uint8_t device_id;
if ( SPIISOLATOR6_OK == spiisolator6_generic_read ( ctx, data_in, 2, &device_id, 1 ) )
{
log_printf( &logger, "\r\n %s\r\n", ( char * ) DEVICE_NAME );
if ( DEVICE_ID == device_id )
{
log_printf ( &logger, " Device ID: 0x%.2X\r\n", ( uint16_t ) device_id );
}
else
{
log_error( &logger, " Wrong Device ID: 0x%.2X", ( uint16_t ) device_id );
}
}
}
// ------------------------------------------------------------------------ END