初学者
10 分钟

使用IF-D91和MK64FN1M0VDC12体验闪电般的数据传输速度和无与伦比的可靠性

通过光纤电缆使用光束发送和接收数据

Fiber Opt Click 3.3V with Clicker 2 for Kinetis

已发布 6月 24, 2024

点击板

Fiber Opt Click 3.3V

开发板

Clicker 2 for Kinetis

编译器

NECTO Studio

微控制器单元

MK64FN1M0VDC12

通过引入光纤连接技术升级您的项目,确保信息流动迅速且不间断。

A

A

硬件概览

它是如何工作的?

Fiber Opt Click 3.3V 基于 Industrial Fiber Optics 的两种光纤组件:IF-D91 光纤光电二极管和 IF-E97 光纤 LED。IF-D91 是一种高速光电二极管检测器,封装在无连接器的塑料光纤封装中,光响应范围从 400 到 1100nm,兼容广泛的可见光和近红外 LED 以及激光二极管源。检测器封装具有内部微透镜和精密成型的 PBT 外壳,确保与标准 1000μm 核心 2.2mm 外套塑料光纤电缆有效的光耦合,该电缆支持高达  100Mbps 的数据速率。IF-D91 还可用于带宽高达 

70MHz 的模拟视频链接。另一种精密成型的 PBT 外 壳和内部微透镜的 IF-E97,是一种高光输出的可见红色 LED。外壳确保与相同标准的外套塑料光纤电缆有效的光耦合。输出光谱由峰值为 650nm 的 GaAlAs 芯片产生,这代表了 PMMA 塑料光纤的最佳传输窗口。可见红光在 PMMA 塑料光纤中的衰减低,有助于故障排除安装,这也是 IF-E97 实现 1Mbps 数据速率的主要原因。此 Click board™ 通过 mikroBUS™ 插座的可选引脚与宿主 MCU 通信,可以是 UART 或一

些通用引脚。通过 GPIO UART 选择跳线可以选择通信方式,UART 默认被选择。否则,可以直接通过 GPIO 引脚进行通信,其中 PWM 和 INT 引脚在 mikroBUS™ 插座中扮演该角色。此外,使用 AN 引脚,可以检测光纤光电二极管的模拟电压。此 Click board™ 只能在 3.3V 逻辑电压水平下操作。在使用具有不同逻辑电平的 MCU 之前,必须执行适当的逻辑电压水平转换。此外,它还配备了一个包含功能和示例代码的库,可用作进一步开发的参考。

Fiber Opt Click 3.3V hardware overview image

功能概述

开发板

Clicker 2 for Kinetis 是一款紧凑型入门开发板,它将 Click 板™的灵活性带给您喜爱的微控制器,使其成为实现您想法的完美入门套件。它配备了一款板载 32 位 ARM Cortex-M4F 微控制器,NXP 半导体公司的 MK64FN1M0VDC12,两个 mikroBUS™ 插槽用于 Click 板™连接,一个 USB 连接器,LED 指示灯,按钮,一个 JTAG 程序员连接器以及两个 26 针头用于与外部电子设备的接口。其紧凑的设计和清晰、易识别的丝网标记让您能够迅速构建具有独特功能和特性

的小工具。Clicker 2 for Kinetis 开发套件的每个部分 都包含了使同一板块运行最高效的必要组件。除了可以选择 Clicker 2 for Kinetis 的编程方式,使用 USB HID mikroBootloader 或外部 mikroProg 连接器进行 Kinetis 编程外,Clicker 2 板还包括一个干净且调节过的开发套件电源供应模块。它提供了两种供电方式;通过 USB Micro-B 电缆,其中板载电压调节器为板上每个组件提供适当的电压水平,或使用锂聚合物 电池通过板载电池连接器供电。所有 mikroBUS™ 本

身支持的通信方法都在这块板上,包括已经建立良好的 mikroBUS™ 插槽、重置按钮和几个用户可配置的按钮及 LED 指示灯。Clicker 2 for Kinetis 是 Mikroe 生态系统的一个组成部分,允许您在几分钟内创建新的应用程序。它由 Mikroe 软件工具原生支持,得益于大量不同的 Click 板™(超过一千块板),其数量每天都在增长,它涵盖了原型制作的许多方面。

Clicker 2 for Kinetis dimensions image

微控制器概述 

MCU卡片 / MCU

default

建筑

ARM Cortex-M4

MCU 内存 (KB)

1024

硅供应商

NXP

引脚数

121

RAM (字节)

262144

使用的MCU引脚

mikroBUS™映射器

Analog Output
PB2
AN
NC
NC
RST
NC
NC
CS
NC
NC
SCK
NC
NC
MISO
NC
NC
MOSI
Power Supply
3.3V
3.3V
Ground
GND
GND
GPIO RX
PA10
PWM
GPIO TX
PB13
INT
GPIO TX
PD3
TX
GPIO RX
PD2
RX
NC
NC
SCL
NC
NC
SDA
NC
NC
5V
Ground
GND
GND
1

“仔细看看!”

Click board™ 原理图

Fiber Opt Click 3.3V Schematic schematic

一步一步来

项目组装

Clicker 2 for PIC32MZ front image hardware assembly

从选择您的开发板和Click板™开始。以Clicker 2 for Kinetis作为您的开发板开始。

Clicker 2 for PIC32MZ front image hardware assembly
GNSS2 Click front image hardware assembly
Prog-cut hardware assembly
GNSS2 Click complete accessories setup image hardware assembly
Board mapper by product7 hardware assembly
Necto image step 2 hardware assembly
Necto image step 3 hardware assembly
Necto image step 4 hardware assembly
Necto image step 5 hardware assembly
Necto image step 6 hardware assembly
Flip&Click PIC32MZ MCU step hardware assembly
Necto No Display image step 8 hardware assembly
Necto image step 9 hardware assembly
Necto image step 10 hardware assembly
Debug Image Necto Step hardware assembly

软件支持

库描述

这个库包含 Fiber Opt Click 3.3V 驱动程序的 API。

关键功能:

  • fiberopt_generic_write - 通用单写函数。

  • fiberopt_generic_read - 通用单读函数。

开源

代码示例

完整的应用程序代码和一个现成的项目可以通过NECTO Studio包管理器直接安装到NECTO Studio 应用程序代码也可以在MIKROE的GitHub账户中找到。

/*!
 * \file 
 * \brief Fiber Opt Click example
 * 
 * # Description
 * This example demonstrates the use of an Fiber Opt click board by showing
 * the communication between the two click boards.
 *
 * The demo application is composed of two sections :
 * 
 * ## Application Init 
 * Initalizes device and makes an initial log.
 * 
 * ## Application Task
 * Depending on the selected application mode, it reads all the received data or 
 * sends the desired text message with the message counter once per second.
 * 
 * \author MikroE Team
 *
 */

#include "board.h"
#include "log.h"
#include "fiberopt.h"

// Comment out the line below in order to switch the application mode to receiver
#define DEMO_APP_TRANSMITTER

// Text message to send in the transmitter application mode
#define DEMO_TEXT_MESSAGE           "MIKROE - Fiber Opt click board\r\n\0"

static fiberopt_t fiberopt;
static log_t logger;

void application_init ( void )
{
    log_cfg_t log_cfg;
    fiberopt_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.
    fiberopt_cfg_setup( &cfg );
    FIBEROPT_MAP_MIKROBUS( cfg, MIKROBUS_1 );
    fiberopt_init( &fiberopt, &cfg );

#ifdef DEMO_APP_TRANSMITTER
    log_printf( &logger, " Application Mode: Transmitter\r\n" );
#else
    log_printf( &logger, " Application Mode: Receiver\r\n" );
#endif
    log_info( &logger, " Application Task " );
    Delay_ms ( 100 );
}

void application_task ( void )
{
#ifdef DEMO_APP_TRANSMITTER
    fiberopt_generic_write( &fiberopt, DEMO_TEXT_MESSAGE, strlen( DEMO_TEXT_MESSAGE ) );
    log_printf( &logger, "%s", ( char * ) DEMO_TEXT_MESSAGE );
    Delay_ms( 1000 ); 
#else
    uint8_t rx_byte = 0;
    if ( 1 == fiberopt_generic_read( &fiberopt, &rx_byte, 1 ) )
    {
       log_printf( &logger, "%c", rx_byte );
    }
#endif
}

int main ( void ) 
{
    application_init( );
    
    for ( ; ; ) 
    {
        application_task( );
    }

    return 0;
}


// ------------------------------------------------------------------------ END

额外支持

资源

喜欢这个项目吗?

'购买此套件' 按钮会直接带您进入购物车,您可以在购物车中轻松添加或移除产品。