1.下载样例代码
①.gitee仓库地址
https://gitee.com/hihope_iot/hispark-pegasus-smart-car.git
②.克隆代码到本地
git clone https://gitee.com/hihope_iot/hispark-pegasus-smart-car.git
③.将样例代码拷贝到openharmony
目录:hispark-pegasus-smart-car智能循迹避障小车样例代码robot_demo
拷贝到:openharmonyapplicationssamplewifi-iotapp
2.使能编译IIC驱动
目录:openharmonydevicehisiliconhispark_pegasussdk_liteosbuildconfigusr_config.mk。
找到这里
# CONFIG_FACTORY_TEST_SUPPORT is not set
# end of Factory Test Settings
#
# BSP Settings
#
CONFIG_I2C_SUPPORT=y 《《《打开编译IIC驱动,改成这样
# CONFIG_I2S_SUPPORT is not set
# CONFIG_SPI_SUPPORT is not set
# CONFIG_DMA_SUPPORT is not set
# CONFIG_SDIO_SUPPORT is not set
# CONFIG_SPI_DMA_SUPPORT is not set
# CONFIG_UART_DMA_SUPPORT is not set
CONFIG_PWM_SUPPORT=y
CONFIG_PWM_HOLD_AFTER_REBOOT=y
CONFIG_AT_SUPPORT=y
CONFIG_FILE_SYSTEM_SUPPORT=y
CONFIG_UART0_SUPPORT=y
CONFIG_UART1_SUPPORT=y
# CONFIG_UART2_SUPPORT is not set
# end of BSP Settings
3.把样例加入编译
目录:openharmony3applicationssamplewifi-iotappBUILD.gn。
import("//build/lite/config/component/lite_component.gni")
lite_component("app") {
features = [
"robot_demo:robot_demo",
"robot_demo/ssd1306:oled_ssd1306",
]
}
注意:官方样例使用说明 https://gitee.com/hihope_iot/hispark-pegasus-smart-car 里面的 BUILD.gn 未将 oled_ssd1306 加入编译,不加入会报错。
4.编译样例
①.设置编译路径
hb set
.(英文字符)
复制②.选择wifiiot_hispark_pegasus
③.执行编译
hb build -f
5.烧录
①打开HiBurn烧录工具
②. 选择要烧录的文件
点击select fine
选择该路径:openharmonyouthispark_pegasuswifiiot_hispark_pegasus 下的Hi3861_loader_signed.bin和Hi3861_wifiiot_app_allinone.bin
复制
③.勾选上 Auto burn
④.烧录
点击Connect
⑤.开发板复位
开始烧录。
⑥.烧录完成,点击disconnect按钮
6.测试结果
测试成功!
7.报错解决
①.未使能驱动编译
报错提示:
[OHOS ERROR] riscv32-unknown-elf-ld: ohos/libs/libhal_iothardware.a(libhal_iothardware.hal_iot_i2c.o): in function `IoTI2cInit':
[OHOS ERROR] hal_iot_i2c.c:(.text.IoTI2cInit+0x10): undefined reference to `hi_i2c_init'
解决办法:
目录:openharmonydevicehisiliconhispark_pegasussdk_liteosbuildconfigusr_config.mk。
找到这里
# CONFIG_FACTORY_TEST_SUPPORT is not set
# end of Factory Test Settings
#
# BSP Settings
#
CONFIG_I2C_SUPPORT=y 《《《打开编译IIC驱动,改成这样
# CONFIG_I2S_SUPPORT is not set
# CONFIG_SPI_SUPPORT is not set
# CONFIG_DMA_SUPPORT is not set
# CONFIG_SDIO_SUPPORT is not set
# CONFIG_SPI_DMA_SUPPORT is not set
# CONFIG_UART_DMA_SUPPORT is not set
CONFIG_PWM_SUPPORT=y
CONFIG_PWM_HOLD_AFTER_REBOOT=y
CONFIG_AT_SUPPORT=y
CONFIG_FILE_SYSTEM_SUPPORT=y
CONFIG_UART0_SUPPORT=y
CONFIG_UART1_SUPPORT=y
# CONFIG_UART2_SUPPORT is not set
# end of BSP Settings
②.未加入编译
报错提示:
[OHOS ERROR] ssd1306_test.c:(.text.Ssd1306TestTask+0x3c): undefined reference to `ssd1306_Init'
[OHOS ERROR] riscv32-unknown-elf-ld: ssd1306_test.c:(.text.Ssd1306TestTask+0x46): undefined reference to `ssd1306_Fill'
[OHOS ERROR] riscv32-unknown-elf-ld: ssd1306_test.c:(.text.Ssd1306TestTask+0x52): undefined reference to `ssd1306_SetCursor'
解决办法:
目录:openharmony3applicationssamplewifi-iotappBUILD.gn。
import("//build/lite/config/component/lite_component.gni")
lite_component("app") {
features = [
"robot_demo:robot_demo",
"robot_demo/ssd1306:oled_ssd1306",
]
}
③.HiSpark Wi-Fi IoT开发板上电没反应
可能原因:使用了双头Type-C数据线供电,导致无法供电,因为开发板没有受电端诱骗芯片。
文章版权声明
1 原创文章作者:4310,如若转载,请注明出处: https://www.52hwl.com/97096.html
2 温馨提示:软件侵权请联系469472785#qq.com(三天内删除相关链接)资源失效请留言反馈
3 下载提示:如遇蓝奏云无法访问,请修改lanzous(把s修改成x)
4 免责声明:本站为个人博客,所有软件信息均来自网络 修改版软件,加群广告提示为修改者自留,非本站信息,注意鉴别