本帖最后由 molun 于 2024-12-17 00:57 编辑
开发板介绍
安信可PB-03F-Kit是一款基于奉加科技PHY6252芯片打造的一款支持BLE5.2的开发板!
硬件性能
- 核心芯片:采用 PHY6252 高集成度的低功耗蓝牙系统级芯片(SoC),CPU 为最高频率 96MHZ 的 M0 内核,内置 64KB SRAM、256KB flash、96KB ROM 和 256bit efuse 57。
- 接口丰富:提供丰富的外设接口,包括 UART、PWM、ADC、I2C、SPI、PDM、DMA 和多达 19 个 IO 口,方便与其他设备连接和扩展功能。
- 天线设计:采用 PCB 板载天线,同时预留了半孔焊盘和天线孔,可根据实际需求选择不同的天线连接方式,灵活性较高。
功能特点
- 低功耗性能:支持多种低功耗工作状态,发射功耗(8dbm)为 11.5mA,接收功耗 9.4mA,休眠功耗 50.58uA,平时功耗 0.57mA,深度睡眠电流小于 1uA,能够满足各种应用场景的功耗需求。
- 蓝牙功能强大:支持蓝牙 BLE5.2 协议,速率支持 125Kbps、500Kbps、1Mbps、2Mbps,具有出色的通信性能和稳定性,同时支持广播扩展、多广播、信道选择等功能。
- 支持多种控制方式:支持 SigMesh 组网,设备之间通过对等星型网络通讯,采用蓝牙广播进行通讯,可保证多设备情况下响应及时。可对接天猫精灵等智能音箱,也支持 Android/IOS APP 和微信小程序控制。
- 开发便捷:通用 AT 指令,可快速上手,支持二次开发,集成了 Windows 开发环境,资料代码全部开源。
应用场景
- 智能家居:可用于智能灯、智能插座、智能空调等其他智能家电的控制,实现设备之间的互联互通和智能化控制。
- 可穿戴设备:如智能手表、智能手环等,可实现与手机等设备的蓝牙连接,传输运动数据、健康数据等信息。
- 移动设备配件:如耳机、音箱等音频设备,可通过蓝牙与手机等设备连接,实现无线音频传输。
资源下载
相关资料看这里:
奉加科技官方下载入口:http://www.phyplusinc.com/support/4.html
这里有个比较坑的点,就是直接点击技术支持后找不到对应的下载入口。
开发环境搭建
PB-03F 开发环境主要使用 Keil5 集成开发环境,想必常玩单片机的各位也都安装好了吧!
Keil5准备就绪,根据上面的链接下载好SDK和烧录工具备用。
准备点灯
解压缩SDK,修改例程,准备点灯!
使用Keil5打开以上项目例程
一个其他的软件包报错,无需理会!
根据上图指引修改下宏定义。
宏说明:
· CFG\_SLEEP\_MODE=PWR\_MODE\_SLEEP :使能低功耗模式,固件程序执行过程中,会在空闲过程进入睡眠,睡眠之后调试器无法进行调试跟踪,断点也失效
· CFG\_SLEEP\_MODE=PWR\_MOD\_NO\_SLEEP :关闭低功耗模式,固件程序执行过程中,处理器一直处于唤醒状态。
将CFG_SLEEP_MODE=PWR_MODE_SLEEP修改为CFG_SLEEP_MODE=PWR_MOD_NO_SLEEP
修改gpio_demo.c函数,简化示例代码,以点亮绿灯为例,即P11引脚输出高电平。
找到void Key_Demo_Init(uint8 task_id)将其全部注释掉。
注释掉该部分代码
取消代码注释
增加点灯代码
根据规格书可知,RGB灯引脚分别为:红灯(P7 脚)、绿灯 (P11 脚)、蓝灯 (P18 脚)、冷色灯(P34脚)、暖色灯(P0脚)
更加自己喜好,修改对应引脚即可!
<span>hal_gpio_write(P11,1);</span>
<span>hal_gpio_write(GPIO_P11,HAL_HIGH_IDLE);</span>
// GPIO11 输出高电平,点亮绿色LED
尝试以上两种写法!
修改完毕,保存并编译。
程序烧录
打开烧录软件PhyPluskit
出现 <span>UART TX ASCII: UXTDWU</span>
后,按一下开发板 <span>RST</span>
按钮,重启开发板
UART RX: cmd>>:
Current port: COM15
Current baudrate: 115200
Current stopBits: 1
Current parity: No
Serial opened!!
*******************************
出现以上内容,说明已经可以开始下载程序了
烧录之前必须先擦除程序。点击:Erase。擦除成功如下。
双击APP后面空白框,选取编译好的固件。
不得不吐槽一下,新时代的软件竟然没做屏幕自适应,在高分辨率屏幕下,界面错位,难用之极!!!
点击Write,进行程序烧录,烧录成功如上图。
烧录成功,重启开发板生效!
现象,绿灯一闪而过。。。。。。
重新检查发现,这个地方重新解压程序后,尽然没有修改,重新来过!
处处有惊喜,重启开发板不管用
Receive #OK or #ER timeout!
Serial port COM15 closed!!
*******************************
Current port: COM15
Current baudrate: 9600
Current stopBits: 1
Current parity: No
Serial opened!!
*******************************
check ChipVersion Fail !!!
Load AppHEx Done[-NO-ENC-]!
IV BLOCK GEN [-NO-ENC-]
[hexPack]: 11020000 e88
[XIP HexPack Size]: 1
[hexPack]: 1FFF0000 40c
[hexPack]: 1FFF1838 3e44
[App HexPack Size]: 2
>> BOOT========0x00002100------0x0000211c========
>> APP========0x00009000------0x0000d258========
>> XIP#0========0x00020000------0x00020e88========
The App Hex file Last modified: 2024-12-13 18:02:49
[HEXF Generation] Success: D:/MOLUN/Downloads/Documents/安信可/PB-03F/PHY62XX_SDK_3.1.1 (2)/release_bbb_sdk-PHY62XX_SDK_3.1.1/example/peripheral/gpio/bin/gpio_demo_phy6202.hexf !!!
Send cpnum successfully!
Receive feedback timeout!
Receive #OK or #ER failed!
Write images failed!
编译报错
<span>Unknown compiler</span>
报错
不出意外的情况下出意外了!
<span class="color_font"><span>*** Warning: The configured compiler version '5.06 update 6 (build 750)' does not support the selected User Based Licensing technology.</span></span>
<span class="color_font"><span>*** Using Compiler 'V5.06 update 6 (build 750)', folder: 'D:\Program Files\Keil_v5\ARM\ARMCC\Bin'</span></span>
<span class="color_font"><span>compiling gpio_demo.c...</span></span>
<span class="color_font"><span>D:\MOLUN\Arm\Packs\ARM\CMSIS\6.1.0\CMSIS\Core\Include\cmsis_compiler.h(287): error: #35: #error directive: Unknown compiler.</span></span>
<span class="color_font"><span> #error Unknown compiler.</span></span>
<span class="color_font"><span>Source\gpio_demo.c: 0 warnings, 1 error</span></span>
<span class="color_font"><span>"Source\gpio_demo.c" - 1 Error(s), 0 Warning(s).</span></span>
<span>5.06 update 6 (build 750)</span>
社区版本(免费版)不支持使用该版本,but 例程必须使用 <span>Use default compiler version 5</span>
版本
社区版本需要切换授权,需要方法,搜索一下!
<span>ARM::CMSIS 6.0.0</span>
以上版本报错
<span>Build started: Project: gpio</span>
<span>*** Warning: The configured compiler version '5.06 update 7 (build 960)' does not support the selected User Based Licensing technology.</span>
<span>*** Using Compiler 'V5.06 update 7 (build 960)', folder: 'D:\Program Files\Keil_v5\ARM\ARM_Compiler_5.06u7\Bin'</span>
<span>Build target 'gpio'</span>
<span>compiling main.c...</span>
<span>D:\MOLUN\Arm\Packs\ARM\CMSIS\6.1.0\CMSIS\Core\Include\cmsis_compiler.h(287): error: #35: #error directive: Unknown compiler.</span>
<span> #error Unknown compiler.</span>
<span>Source\main.c: 0 warnings, 1 error</span>
<span>compiling gpio_Main.c...</span>
<span>D:\MOLUN\Arm\Packs\ARM\CMSIS\6.1.0\CMSIS\Core\Include\cmsis_compiler.h(287): error: #35: #error directive: Unknown compiler.</span>
<span> #error Unknown compiler.</span>
<span>Source\gpio_Main.c: 0 warnings, 1 error</span>
<span>compiling my_printf.c...</span>
<span>D:\MOLUN\Arm\Packs\ARM\CMSIS\6.1.0\CMSIS\Core\Include\cmsis_compiler.h(287): error: #35: #error directive: Unknown compiler.</span>
<span> #error Unknown compiler.</span>
<span>..\..\..\components\driver\log\my_printf.c: 0 warnings, 1 error</span>
<span>compiling gpio.c...</span>
<span>D:\MOLUN\Arm\Packs\ARM\CMSIS\6.1.0\CMSIS\Core\Include\cmsis_compiler.h(287): error: #35: #error directive: Unknown compiler.</span>
<span> #error Unknown compiler.</span>
<span>..\..\..\components\driver\gpio\gpio.c: 0 warnings, 1 error</span>
<span>compiling gpio_demo.c...</span>
<span>D:\MOLUN\Arm\Packs\ARM\CMSIS\6.1.0\CMSIS\Core\Include\cmsis_compiler.h(287): error: #35: #error directive: Unknown compiler.</span>
<span> #error Unknown compiler.</span>
<span>Source\gpio_demo.c: 0 warnings, 1 error</span>
<span>compiling jump_table.c...</span>
<span>D:\MOLUN\Arm\Packs\ARM\CMSIS\6.1.0\CMSIS\Core\Include\cmsis_compiler.h(287): error: #35: #error directive: Unknown compiler.</span>
<span> #error Unknown compiler.</span>
<span>..\..\..\misc\jump_table.c: 0 warnings, 1 error</span>
<span>compiling OSAL_gpio.c...</span>
<span>D:\MOLUN\Arm\Packs\ARM\CMSIS\6.1.0\CMSIS\Core\Include\cmsis_compiler.h(287): error: #35: #error directive: Unknown compiler.</span>
<span> #error Unknown compiler.</span>
<span>Source\OSAL_gpio.c: 0 warnings, 1 error</span>
<span>compiling uart.c...</span>
<span>D:\MOLUN\Arm\Packs\ARM\CMSIS\6.1.0\CMSIS\Core\Include\cmsis_compiler.h(287): error: #35: #error directive: Unknown compiler.</span>
<span> #error Unknown compiler.</span>
<span>..\..\..\components\driver\uart\uart.c: 0 warnings, 1 error</span>
<span>compiling pwrmgr.c...</span>
<span>D:\MOLUN\Arm\Packs\ARM\CMSIS\6.1.0\CMSIS\Core\Include\cmsis_compiler.h(287): error: #35: #error directive: Unknown compiler.</span>
<span> #error Unknown compiler.</span>
<span>..\..\..\components\driver\pwrmgr\pwrmgr.c: 0 warnings, 1 error</span>
<span>compiling clock.c...</span>
<span>D:\MOLUN\Arm\Packs\ARM\CMSIS\6.1.0\CMSIS\Core\Include\cmsis_compiler.h(287): error: #35: #error directive: Unknown compiler.</span>
<span> #error Unknown compiler.</span>
<span>..\..\..\components\driver\clock\clock.c: 0 warnings, 1 error</span>
<span>compiling key.c...</span>
<span>D:\MOLUN\Arm\Packs\ARM\CMSIS\6.1.0\CMSIS\Core\Include\cmsis_compiler.h(287): error: #35: #error directive: Unknown compiler.</span>
<span> #error Unknown compiler.</span>
<span>..\..\..\components\driver\key\key.c: 0 warnings, 1 error</span>
<span>compiling adc.c...</span>
<span>D:\MOLUN\Arm\Packs\ARM\CMSIS\6.1.0\CMSIS\Core\Include\cmsis_compiler.h(287): error: #35: #error directive: Unknown compiler.</span>
<span> #error Unknown compiler.</span>
<span>..\..\..\components\driver\adc\adc.c: 0 warnings, 1 error</span>
<span>compiling startup_ARMCM0.c...</span>
<span>D:\MOLUN\Arm\Packs\ARM\CMSIS\6.1.0\CMSIS\Core\Include\cmsis_compiler.h(287): error: #35: #error directive: Unknown compiler.</span>
<span> #error Unknown compiler.</span>
<span>RTE/Device/ARMCM0/startup_ARMCM0.c: 0 warnings, 1 error</span>
<span>compiling flash.c...</span>
<span>D:\MOLUN\Arm\Packs\ARM\CMSIS\6.1.0\CMSIS\Core\Include\cmsis_compiler.h(287): error: #35: #error directive: Unknown compiler.</span>
<span> #error Unknown compiler.</span>
<span>..\..\..\components\driver\flash\flash.c: 0 warnings, 1 error</span>
<span>compiling system_ARMCM0.c...</span>
<span>D:\MOLUN\Arm\Packs\ARM\CMSIS\6.1.0\CMSIS\Core\Include\cmsis_compiler.h(287): error: #35: #error directive: Unknown compiler.</span>
<span> #error Unknown compiler.</span>
<span>RTE/Device/ARMCM0/system_ARMCM0.c: 0 warnings, 1 error</span>
<span>".\Objects\gpio_demo.axf" - 15 Error(s), 0 Warning(s).</span>
<span>Target not created.</span>
<span>Build Time Elapsed: 00:00:00</span>
<span>#error directive: Unknown compiler</span>
该报错需要卸载掉6.0.0及以上版本的 <span>ARM::CMSIS</span>
固件二次烧录失败
<span>Current port: COM16</span>
<span>Current baudrate: 9600</span>
<span>Current stopBits: 1</span>
<span>Current parity: No</span>
<span>Serial opened!! </span>
<span>*******************************</span>
<span>check ChipVersion Fail !!! </span>
<span>Load AppHEx Done[-NO-ENC-]!</span>
<span>IV BLOCK GEN [-NO-ENC-]</span>
<span>[hexPack]: 11020000 e64</span>
<span>[XIP HexPack Size]: 1</span>
<span>[hexPack]: 1FFF0000 40c</span>
<span>[hexPack]: 1FFF1838 3df4</span>
<span>[App HexPack Size]: 2</span>
<span>>> BOOT========0x00002100------0x0000211c========</span>
<span>>> APP========0x00009000------0x0000d208========</span>
<span>>> XIP#0========0x00020000------0x00020e64========</span>
<span>The App Hex file Last modified: 2024-12-13 19:15:37</span>
<span>[HEXF Generation] Success: D:/MOLUN/Downloads/Documents/安信可/PB-03F/PHY62XX_SDK_3.1.1 (2)/release_bbb_sdk-PHY62XX_SDK_3.1.1/example/peripheral/gpio/bin/gpio_demo_phy6202.hexf !!!</span>
<span>Send cpnum successfully!</span>
<span>Receive feedback timeout!</span>
<span>Receive #OK or #ER failed!</span>
<span>Write images failed!</span>
总结
仔仔细细,多多尝试!
祝诸君点灯成功!