通过我们的解决方案赋予您的应用程序一个独特的节点身份,提供一种无缝和标准化的方法来分配唯一的MAC地址,以优化网络通信和管理。
A
A
硬件概览
它是如何工作的?
MAC Address Click基于24AA025E64,这是一款来自Microchip的具有预编程IEEE EUI-64 MAC地址的2Kb串行EEPROM。该设备被组织为两个128 x 8位内存块,带有2线串行接口。低电压设计允许在最低1.7V的电压下工作,最大待机和工作电流分别只有1uA和1mA。24AA025E64还具有最多16字节数据的页写入
能力。MAC Address Click为您的应用程序提供一个独特的节点地址。它还具有1Kbit的可写EEPROM内存。MAC Address Click搭载了带有EUI-64™节点身份的24AA025E64 2K I2C串行EEPROM。点击板设计为可以在3.3V或5V电源上运行。MAC Address Click通过I2C接口与目标微控制器通信。这个Click board™可以
通过PWR SEL跳线选择使用3.3V或5V逻辑电压级别,这样,3.3V和5V能力的MCU都可以正确使用通信线。此外,这个Click board™还配备了一个包含易于使用的功能和示例代码的库,可用作进一步开发的参考。
功能概述
开发板
32L496GDISCOVERY Discovery 套件是一款功能全面的演示和开发平台,专为搭载 Arm® Cortex®-M4 内核的 STM32L496AG 微控制器设计。该套件适用于需要在高性能、先进图形处理和超低功耗之间取得平衡的应用,支持无缝原型开发,适用于各种嵌入式解决方案。STM32L496AG 采用创新的节能架构,集成
了扩展 RAM 和 Chrom-ART 图形加速器,在提升图形性能的同时保持低功耗,使其特别适用于音频处理、图形用户界面和实时数据采集等对能效要求较高的应用。为了简化开发流程,该开发板配备了板载 ST-LINK/V2-1 调试器/编程器,提供即插即用的调试和编程体验,使用户无需额外硬件即可轻松加载、调
试和测试应用程序。凭借低功耗特性、增强的内存能力以及内置调试工具,32L496GDISCOVERY 套件是开发先进嵌入式系统、实现高效能解决方案的理想选择。
微控制器概述
MCU卡片 / MCU

建筑
ARM Cortex-M4
MCU 内存 (KB)
1024
硅供应商
STMicroelectronics
引脚数
169
RAM (字节)
327680
使用的MCU引脚
mikroBUS™映射器
“仔细看看!”
Click board™ 原理图

一步一步来
项目组装
软件支持
库描述
这个库包含了MAC Address Click驱动的API。
关键功能:
macaddress_get_mac- 通用读取MAC地址功能macaddress_read_byte- 通用读取数据字节功能
开源
代码示例
完整的应用程序代码和一个现成的项目可以通过NECTO Studio包管理器直接安装到NECTO Studio。 应用程序代码也可以在MIKROE的GitHub账户中找到。
/*!
* \file
* \brief MacAddress Click example
*
* # Description
* Provides a unique node address for your application.
*
* The application is composed of two sections :
*
* ## Application Init
* Initialization driver enables - I2C, also write log.
*
* ## Application Task - (code snippet) This is an example which demonstrates the use of MAC Address Click board.
* MAC Address Click communicates with register via I2C protocol by the write to register and read from the register.
* This example shows write/read single byte and sequential write/read from EEPROM.
* Results are being sent to the Usart Terminal where you can track their changes.
* All data logs write on USB uart changes for every 1 sec.
*
*
* \author MikroE Team
*
*/
// ------------------------------------------------------------------- INCLUDES
#include "board.h"
#include "log.h"
#include "macaddress.h"
// ------------------------------------------------------------------ VARIABLES
static macaddress_t macaddress;
static log_t logger;
static uint8_t *write_data[ 3 ] = { "MikroE", "MAC Address", "MikroElektronika" };
static uint8_t data_len[ 3 ] = { 6 , 11, 16 };
static uint8_t mac_addr[ 8 ] = { 0 };
static uint8_t data_cnt;
static uint8_t read_buff[ 50 ] = { 0 };
static uint8_t address = 0x10;
// ------------------------------------------------------ APPLICATION FUNCTIONS
void application_init ( void )
{
log_cfg_t log_cfg;
macaddress_cfg_t cfg;
/**
* 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.
macaddress_cfg_setup( &cfg );
MACADDRESS_MAP_MIKROBUS( cfg, MIKROBUS_1 );
macaddress_init( &macaddress, &cfg );
macaddress_get_mac( &macaddress, mac_addr );
log_printf( &logger, " > MAC Address: 0x" );
for ( uint8_t cnt = 0; cnt < 8; cnt++ )
{
log_printf( &logger, "%.02X", (uint16_t)mac_addr[ cnt ] );
}
log_printf( &logger, "\r\n" );
Delay_ms ( 1000 );
log_info( &logger, "---- Application Task ----" );
data_cnt = 0;
}
void application_task ( void )
{
log_printf( &logger, " > Writing data to memory...\r\n" );
Delay_ms ( 100 );
macaddress_generic_write( &macaddress, address, write_data[ data_cnt ], data_len[ data_cnt ] );
log_printf( &logger, " > Writing done.\r\n" );
Delay_ms ( 1000 );
log_printf( &logger, " > Reading data from memory...\r\n" );
macaddress_generic_read( &macaddress, address, read_buff, data_len[ data_cnt ] );
Delay_ms ( 100 );
log_printf( &logger, " > Read data: " );
for( uint8_t cnt = 0; cnt < data_len[ data_cnt ]; cnt++ )
{
log_printf( &logger, "%c", read_buff[ cnt ] );
}
log_printf( &logger, "\r\n" );
Delay_ms ( 100 );
log_printf( &logger, " > Reading done.\r\n" );
log_printf( &logger, "---------------------------------\r\n" );
data_cnt++;
if ( data_cnt >= 3 )
data_cnt = 0;
Delay_ms ( 1000 );
Delay_ms ( 1000 );
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
额外支持
资源
类别:电可擦只读存储器































