1、概述
感谢官方举办【Vision Board 创客营】活动,使得我有机会试用Vision Board开发板,体验嵌入式AI的快乐。在此,再次感谢官方以及导师们的热情帮助。在本次活动中,本人选择的是DAC功能的测试。
2、环境配置
配置
系统:Win11
开发板:RA8-M85-vision-board
开发IDE:RTThread Studio 版本: 2.2.6
环境配置
3、新建工程以及编写测试例程
- 使能DAC驱动框架,可参考下图:
- 打开RA Smart Configurator (记得选择sc_v2023-10_fsp_v5.1.0 文件夹),进行DAC硬件功能配置,具体可参考下图:
- 测试程序
- 在工程src目录中,右键新建 test_dac.c 文件,文件内容如下:
/** 功能说明:通过DAC生成一个正弦波,其中每一个dac的输出值,是通过py程序自动生成,可在附录中自取 */ /* * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes * 2024-04-20 MagicKingC the first version */ #include < rtthread.h > #include < rtdevice.h > #define DAC_DEV_NAME "dac0" #define DAC_DEV_CHANNEL 0 static rt_uint32_t sin_wave_vaule[]={ 2048,2073,2098,2123,2149,2174,2199,2224,2249,2274, 2299,2324,2349,2374,2399,2423,2448,2473,2497,2522, 2546,2571,2595,2619,2643,2667,2691,2715,2739,2763, 2786,2810,2833,2856,2879,2902,2925,2947,2970,2992, 3015,3037,3059,3081,3102,3124,3145,3166,3187,3208, 3229,3249,3269,3290,3309,3329,3349,3368,3387,3406, 3425,3443,3462,3480,3498,3515,3533,3550,3567,3584, 3600,3617,3633,3648,3664,3679,3694,3709,3724,3738, 3752,3766,3780,3793,3806,3819,3831,3843,3855,3867, 3878,3890,3900,3911,3921,3931,3941,3950,3960,3968, 3977,3985,3993,4001,4008,4015,4022,4029,4035,4041, 4046,4052,4057,4061,4066,4070,4074,4077,4080,4083, 4086,4088,4090,4092,4093,4094,4095,4095,4095,4095, 4094,4093,4092,4091,4089,4087,4084,4082,4079,4075, 4072,4068,4064,4059,4054,4049,4044,4038,4032,4026, 4019,4012,4005,3997,3989,3981,3973,3964,3955,3946, 3936,3926,3916,3906,3895,3884,3873,3861,3849,3837, 3825,3812,3799,3786,3773,3759,3745,3731,3717,3702, 3687,3672,3656,3641,3625,3608,3592,3575,3559,3541, 3524,3507,3489,3471,3453,3434,3416,3397,3378,3358, 3339,3319,3300,3280,3259,3239,3218,3198,3177,3156, 3134,3113,3091,3070,3048,3026,3004,2981,2959,2936, 2913,2891,2868,2844,2821,2798,2774,2751,2727,2703, 2679,2655,2631,2607,2583,2559,2534,2510,2485,2460, 2436,2411,2386,2361,2336,2312,2287,2262,2237,2211, 2186,2161,2136,2111,2086,2061,2035,2010,1985,1960, 1935,1910,1885,1859,1834,1809,1784,1760,1735,1710, 1685,1660,1636,1611,1586,1562,1537,1513,1489,1465, 1441,1417,1393,1369,1345,1322,1298,1275,1252,1228, 1205,1183,1160,1137,1115,1092,1070,1048,1026,1005, 983,962,940,919,898,878,857,837,816,796, 777,757,738,718,699,680,662,643,625,607, 589,572,555,537,521,504,488,471,455,440, 424,409,394,379,365,351,337,323,310,297, 284,271,259,247,235,223,212,201,190,180, 170,160,150,141,132,123,115,107,99,91, 84,77,70,64,58,52,47,42,37,32, 28,24,21,17,14,12,9,7,5,4, 3,2,1,1,1,1,2,3,4,6, 8,10,13,16,19,22,26,30,35,39, 44,50,55,61,67,74,81,88,95,103, 111,119,128,136,146,155,165,175,185,196, 206,218,229,241,253,265,277,290,303,316, 330,344,358,372,387,402,417,432,448,463, 479,496,512,529,546,563,581,598,616,634, 653,671,690,709,728,747,767,787,806,827, 847,867,888,909,930,951,972,994,1015,1037, 1059,1081,1104,1126,1149,1171,1194,1217,1240,1263, 1286,1310,1333,1357,1381,1405,1429,1453,1477,1501, 1525,1550,1574,1599,1623,1648,1673,1697,1722,1747, 1772,1797,1822,1847,1872,1897,1922,1947,1973,1998, 2023,2048 }; /** * 通过dac生成sin波形 * @param agrc * @param agrv * @return */ static int sin_dac_sample(int agrc, char **agrv){ rt_dac_device_t dac_dev; //打开硬件外设 dac_dev = (rt_dac_device_t)rt_device_find(DAC_DEV_NAME); if (dac_dev == RT_NULL) { rt_kprintf("can't find %s devicern",DAC_DEV_NAME); return -RT_ERROR; } rt_dac_enable(dac_dev, DAC_DEV_CHANNEL); rt_kprintf("begin echo sin wavern"); for (int i = 0; i < 300; ++i) { for (int j = 0; j < sizeof(sin_wave_vaule)/sizeof(rt_uint32_t); ++j) { rt_dac_write(dac_dev, DAC_DEV_CHANNEL, sin_wave_vaule[j]); rt_thread_mdelay(1); } } rt_kprintf("end echo sin wavern"); return 0; } MSH_CMD_EXPORT(sin_dac_sample,dac out sin wave sample)
- 进行程序编译,然后烧录到开发板
- 在工程src目录中,右键新建 test_dac.c 文件,文件内容如下:
4、测试
- 打开串口工具输入 ,在finsh 命令行中输入 sin_dac_sample ,然后回车,现象可看下图:
到此测试完毕
5、总结
到此 DAC 测试已经完毕,感觉在本次测试下来的很顺利,开发速度非常块,需要简单的几个配置,就可以将DAC使用起来。
附录
sin.py
import numpy as np
import matplotlib.pyplot as plt
t = np.linspace(0,1,512)
y = (np.sin(2*np.pi*t) * 2047) + 2048
count = 0
for num in np.round(y):
print("%d" % num, end=',')
count = count +1
if count % 10 == 0:
print()
plt.scatter(t,y)
plt.show()
审核编辑 黄宇
声明:本文内容及配图由入驻作者撰写或者入驻合作网站授权转载。文章观点仅代表作者本人,不代表电子发烧友网立场。文章及其配图仅供工程师学习之用,如有内容侵权或者其他违规问题,请联系本站处理。
举报投诉
-
dac
+关注
关注
43文章
2287浏览量
190960 -
开发板
+关注
关注
25文章
5024浏览量
97349 -
RTThread
+关注
关注
8文章
132浏览量
40853
发布评论请先 登录
相关推荐
【创客营】新品体验!机器视觉VisionBoard开发板免费试用
,由RT-Thread社区导师带领社区小伙伴参与!
Vision Board创客营计划将分为四个阶段: 软硬件评测、应用作品设计、视频教程
发表于 03-20 14:03
【Vision Board创客营连载体验】RA8D1 Vision Board上的SPI实践
感谢发烧友&RT-Thread,很高兴能加入Vision Board创客营,体验Vision
发表于 04-22 23:56
【Vision Board创客营连载体验】RA8D1 Vision Board初体验
1 RA8D1 Vision Board简介
Vision-Board 开发板是 RT-Thread 推出基于瑞萨 Cortex-M85 架构 RA8D1 芯片,拥有Helium和TrustZone
发表于 04-23 21:53
【Vision Board创客营连载体验】RA8D1 Vision Board 实现 FAL 同时调用片上以及外挂 Flash
手册
【Vision Board创客营连载体验】RA8D1 Vision
发表于 04-24 17:31
【Vision Board创客营连载体验】RA8D1 Vision Board Camera 初体验
开发环境:
RT-Thread Studio:v2.2.7
开发板:RA8D1 Vision Board开发板
MCU:R7FA8D1BHEC337AS02
1 硬件连接
Camera
发表于 04-27 08:50
【Vision Board创客营连载体验】RA8D1-Vision Board开箱使用
Vision Board搭载全球首颗 480 MHz Arm Cortex-M85芯片RA8D1 :6.39 CoreMark/MHz,可以快速而高效地运行机器视觉算法,实现图像处理、等功能。包括
发表于 04-27 21:34
【Vision Board创客营连载体验】利用 OpenMV 实现 AprilTag 跟踪以及通过串口通讯控制 Arduino 驱动 LED 灯带
项目介绍
此项目为本人在参与Vision Board 创客营活动第二阶段(应用作品设计)过程中所产出的内容。主要内容是实现 LED 矩阵实时
发表于 05-31 00:01
【Vision Board创客营连载体验】基于Vision Board的垃圾分类
目标
通过在Vision Board部署openMV实现垃圾分类。
一、基础设置
(一)配置摄像头
Vision Board自带摄像头,按照电路图使用瑞萨的FSP可以很方便的配置好。首
发表于 06-16 17:41
【Vision Board创客营连载体验】基于RA8D1-Vision Board的自动路径规划小车
电机和编码器实现,大脑使用RA8D1-Vision Board开发板的openmv固件完成障碍识别和底盘移动控制,两个部分使用串口进行通讯。
二、底盘:(1)底盘使用普通车轮以菱形布局,可实现类
发表于 06-18 15:33
机器视觉RT-Thread Vision Board主要特点
RT-Thread 与 瑞萨电子 携手推出全新的硬件产品—— Vision Board ! RT-Thread Vision Board 为工程师们提供了一个灵活、全面的开发平台,助力
Vision-Board 使用TinyUSB驱动Xbox游戏手柄
Vision-Board社区有大佬搞新活了! 如果手上有XBOX手柄的话赶快掏出你的Vision-Board 体验下: 接下来看看KunYi大佬如何进行添加的Xbox支持的: 准备工作
Vision-Board 使用TinyUSB驱动Xbox游戏手柄
Vision-Board社区有大佬搞新活了!如果手上有XBOX手柄的话赶快掏出你的Vision-Board体验下:接下来看看KunYi大佬如何进行添加的Xbox支持的:准备工作:Vision-Bo
评论