@xmphoenix 有效评论或发帖
Best posts made by fumoumou
Latest posts made by fumoumou
-
【XR806开发板试用】简单的家用环境监测传感器
XR806是一款支持WiFi和BLE的高集成度无线MCU芯片,
以其集成度高、硬件设计简单、BOM成本低、安全可靠等优点,
成为极客们进行小开发创作的首选.
恰好最近获得了XR806开发板的试用资格,因此决定基于此开发板制作一个简单的家用环境监测传感器.1.功能介绍
作为一个环境监测传感器,它能够获取当前的温度,湿度,气压,海拔这四个参数,
同时能够通过外部的屏幕实时显示刷新.
在2023年的当下,能够联网上报信息的功能不可或却.2.硬件选型
2.1硬件选型
本次小项目的核心是XR806开发板.显示部分使用2.8寸 ST7789显示屏.
环境状态获取使用的是BMP280和ATH20传感器.
显示屏使用SPI接口,传感器共用IIC总线.
为了方便我把它们全插在了面包板上,如图:
2.2硬件连接
LCD:
MOSI ==> PB4
MISO ==> PB5
CS ==> PB6
DC ==> PB3
CLK ==> PB7
RST ==> PA19传感器:
SCL ==> PA12
SDA ==> PA133.程序实现
本项目开始使用的是Freertos的SDK,
以默认的hello_demo为模板,
复制一份在同级目录下,
添加各个模块文件,
如图所示:在SDK顶层目录进行make menuconfig,配置项目名为demo/Sensor,使得项目能够编译(具体开发环境搭建不细说了)
在主程序中有两大部分,一个是环境数据的获取,另一个是数据的上报.
#include "common/framework/platform_init.h" #include <stdio.h> #include "kernel/os/os.h" #include "interface.h" #include "./modules/BMP280.h" #include "./modules/ATH20.h" #include "./modules/st7789.h" #include "./modules/mqtt.h" #define SENSORS_THREAD_STACK_SIZE (1024) static OS_Thread_t sensors_thread; #define MQTT_THREAD_STACK_SIZE (8 * 1024) OS_Thread_t mqtt_demo_thread; static void sensors_fun(void *arg) { dev_interface_init(); BMP280_Init(); ATH20_Init(); TFT_init(); float pressure = 0; float temperature = 0; float asl = 0; u32 CT = 0; TFT_full(0XFFFF); flush_words(); while (1) { BMP280GetData(&pressure, &temperature, &asl); printf("pressure = %f temperature = %f asl = %f\r\n", pressure, temperature, asl); ATH20_Read_CTdata(&CT); printf("ct = %f%%\r\n", (float)(CT / 1000)); flush_num(temperature, pressure, asl, CT / 1000); getMsg(pressure,temperature, asl, (float)(CT / 1000)); OS_MSleep(300); } OS_ThreadDelete(&sensors_thread); } int main(void) { platform_init(); if (!OS_ThreadIsValid(&sensors_thread)) { OS_ThreadCreate(&sensors_thread, "Sensors_thread", sensors_fun, (void *)NULL, OS_THREAD_PRIO_APP, SENSORS_THREAD_STACK_SIZE); } else { printf("Create Sensors_thread failed!\r\n"); } if (!OS_ThreadIsValid(&mqtt_demo_thread)) { OS_ThreadCreate(&mqtt_demo_thread, "mqtt_thread", mqtt_demo_fun, (void *)NULL, OS_THREAD_PRIO_APP, MQTT_THREAD_STACK_SIZE); } else { printf("Create mqtt_thread failed!\r\n"); } while (1) ; return 0; }
wlan部分写死,使用自己的热点
mqtt实现部分参考example/mqtt
配置使用公用mqtt服务器
Sensor任务实时更新数据到屏幕与Mqtt的发送fifo
Mqtt任务一秒为周期上报数据mqtt服务器接收到的上报数据
详细代码见https://github.com/fumoumou6/xr806/blob/main/Sensors.zip
Sensors.zip
实现效果:
4.总结
有幸能够获取到本开发板的试用资格,在此首先感谢极术社区和全志科技.
总体来说,xr806的freertos sdk功能覆盖全面,开发十分简洁,SDK中的例程覆盖全面,极大的方便产品的开发,大大好评.
本次的项目只是一个小玩具,难免代码中会有些小bug,欢迎各位道友指正.
最后的同时,也希望极术社区和全志科技能够发展越来越好,推出更多好用的开发板. -
Reply: MQ-Quad H616 主线内核编译调试记录(u-boot、kernel、buildroot)
@evler 在 MQ-Quad H616 主线内核编译调试记录(u-boot、kernel、buildroot) 中说:
266002
大佬求助,编译模块报错了
fumoumou@fumoumou-TM1801:~/Desktop/H616/stable/linux$ make INSTALL_MOD_PATH=/mnt/rootfs/ modules modules_install CALL scripts/checksyscalls.sh CALL scripts/atomic/check-atomics.sh CHK include/generated/compile.h CC [M] drivers/net/wireless/realtek/rtl8723ds/os_dep/linux/ioctl_cfg80211.o drivers/net/wireless/realtek/rtl8723ds/os_dep/linux/ioctl_cfg80211.c:6840:13: error: initialization of ‘int (*)(struct wiphy *, struct net_device *)’ from incompatible pointer type ‘int (*)(struct wiphy *, struct net_device *, unsigned int)’ [-Werror=incompatible-pointer-types] 6840 | .stop_ap = cfg80211_rtw_stop_ap, | ^~~~~~~~~~~~~~~~~~~~ drivers/net/wireless/realtek/rtl8723ds/os_dep/linux/ioctl_cfg80211.c:6840:13: note: (near initialization for ‘rtw_cfg80211_ops.stop_ap’) drivers/net/wireless/realtek/rtl8723ds/os_dep/linux/ioctl_cfg80211.c: In function ‘rtw_wdev_unregister’: drivers/net/wireless/realtek/rtl8723ds/os_dep/linux/ioctl_cfg80211.c:7071:12: error: ‘struct wireless_dev’ has no member named ‘connected’; did you mean ‘connect_keys’? 7071 | if (wdev->connected) { | ^~~~~~~~~ | connect_keys cc1: some warnings being treated as errors make[5]: *** [scripts/Makefile.build:249: drivers/net/wireless/realtek/rtl8723ds/os_dep/linux/ioctl_cfg80211.o] Error 1 make[4]: *** [scripts/Makefile.build:466: drivers/net/wireless/realtek/rtl8723ds] Error 2 make[3]: *** [scripts/Makefile.build:466: drivers/net/wireless/realtek] Error 2 make[2]: *** [scripts/Makefile.build:466: drivers/net/wireless] Error 2 make[1]: *** [scripts/Makefile.build:466: drivers/net] Error 2 make: *** [Makefile:1842: drivers] Error 2
-
Reply: MQ-Quad H616 主线内核编译调试记录(u-boot、kernel、buildroot)
@evler 在执行../sunxi-tools/sunxi-fel uboot u-boot-sunxi-with-spl.bin的时候串口就没有反应,fel也没有提示
这时候开发板上没有启动介质
-
Reply: MQ-Quad H616 主线内核编译调试记录(u-boot、kernel、buildroot)
上来就卡在第一步了,USB启动uboot串口没有反应