小麦克

  • 2025-04-07
  • 发表了主题帖: 【Bit-Brick K1】性能测试

    # 性能测试 本篇文章简单测试一下X60的性能,并和iMX93 ARM Cortex-A55内核进行对比。测试不严谨,仅供参考。 **X60 CPU概述** ```bash ➜ ~ lscpu Architecture: riscv64 Byte Order: Little Endian CPU(s): 8 On-line CPU(s) list: 0-7 Model name: Spacemit(R) X60 Thread(s) per core: 1 Core(s) per socket: 8 Socket(s): 1 CPU(s) scaling MHz: 100% CPU max MHz: 1600.0000 CPU min MHz: 614.4000 Caches (sum of all): L1d: 256 KiB (8 instances) L1i: 256 KiB (8 instances) L2: 1 MiB (2 instances) ``` **iMX93 Cortex-A55** ```bash root@imx93-11x11-lpddr4x-evk:~# lscpu Architecture: aarch64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian CPU(s): 2 On-line CPU(s) list: 0,1 Vendor ID: ARM Model name: Cortex-A55 Model: 0 Thread(s) per core: 1 Core(s) per cluster: 2 Socket(s): - Cluster(s): 1 Stepping: r2p0 BogoMIPS: 48.00 Flags: fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp NUMA: NUMA node(s): 1 NUMA node0 CPU(s): 0,1 Vulnerabilities: Gather data sampling: Not affected Itlb multihit: Not affected L1tf: Not affected Mds: Not affected Meltdown: Not affected Mmio stale data: Not affected Reg file data sampling: Not affected Retbleed: Not affected Spec rstack overflow: Not affected Spec store bypass: Not affected Spectre v1: Mitigation; __user pointer sanitization Spectre v2: Not affected Srbds: Not affected Tsx async abort: Not affected ``` ## Coremark 源代码:https://github.com/eembc/coremark ### 单线程性能 默认make即测试单线程性能 **X60** ```bash $ git clone https://github.com/eembc/coremark $ cd coremake $ make ... ``` 测试结果在`run1.log`中: ```bash ➜ coremark git:(main) ✗ cat run1.log 2K performance run parameters for coremark. CoreMark Size : 666 Total ticks : 18393 Total time (secs): 18.393000 Iterations/Sec : 5980.536074 Iterations : 110000 Compiler version : GCC13.2.0 Compiler flags : -O2 -DPERFORMANCE_RUN=1 -lrt Memory location : Please put data memory location here (e.g. code in flash, data on heap etc) seedcrc : 0xe9f5 [0]crclist : 0xe714 [0]crcmatrix : 0x1fd7 [0]crcstate : 0x8e3a [0]crcfinal : 0x33ff Correct operation validated. See README.md for run and reporting rules. CoreMark 1.0 : 5980.536074 / GCC13.2.0 -O2 -DPERFORMANCE_RUN=1 -lrt / Heap ``` **Cortex-A55** ```bash $ cat run1.log 2K performance run parameters for coremark. CoreMark Size : 666 Total ticks : 17445 Total time (secs): 17.445000 Iterations/Sec : 6305.531671 Iterations : 110000 Compiler version : GCC13.3.0 Compiler flags : -O2 -DPERFORMANCE_RUN=1 -lrt Memory location : Please put data memory location here (e.g. code in flash, data on heap etc) seedcrc : 0xe9f5 [0]crclist : 0xe714 [0]crcmatrix : 0x1fd7 [0]crcstate : 0x8e3a [0]crcfinal : 0x33ff Correct operation validated. See README.md for run and reporting rules. CoreMark 1.0 : 6305.531671 / GCC13.3.0 -O2 -DPERFORMANCE_RUN=1 -lrt / Heap ``` **结论:**Cortex-A55性能高5%左右,但是因为iMX93 Cortex-A55主频1.7GHz,比X60高100MHz(5%)。所以折算成相同频率,单线程性能几乎一致。 ### 多线程性能 iMX93只有2个ARM Cortex-A55内核,编译时需指定`-DMULTITHREAD=2`。X60有8个RISC-V内核,编译时指定`-DMULTITHREAD=8` **X60** ```bash $ make clean $ make XCFLAGS="-DMULTITHREAD=8 -DUSE_PTHREAD -pthread" ``` 测试结果保存在`run1.log`中,`48203`单线程性能的8倍 ```bash ➜ coremark git:(main) ✗ cat run1.log 2K performance run parameters for coremark. CoreMark Size : 666 Total ticks : 18256 Total time (secs): 18.256000 Iterations/Sec : 48203.330412 Iterations : 880000 Compiler version : GCC13.2.0 Compiler flags : -O2 -DMULTITHREAD=8 -DUSE_PTHREAD -pthread -DPERFORMANCE_RUN=1 -lrt Parallel PThreads : 8 Memory location : Please put data memory location here (e.g. code in flash, data on heap etc) seedcrc : 0xe9f5 [0]crclist : 0xe714 [1]crclist : 0xe714 [2]crclist : 0xe714 [3]crclist : 0xe714 [4]crclist : 0xe714 [5]crclist : 0xe714 [6]crclist : 0xe714 [7]crclist : 0xe714 [0]crcmatrix : 0x1fd7 [1]crcmatrix : 0x1fd7 [2]crcmatrix : 0x1fd7 [3]crcmatrix : 0x1fd7 [4]crcmatrix : 0x1fd7 [5]crcmatrix : 0x1fd7 [6]crcmatrix : 0x1fd7 [7]crcmatrix : 0x1fd7 [0]crcstate : 0x8e3a [1]crcstate : 0x8e3a [2]crcstate : 0x8e3a [3]crcstate : 0x8e3a [4]crcstate : 0x8e3a [5]crcstate : 0x8e3a [6]crcstate : 0x8e3a [7]crcstate : 0x8e3a [0]crcfinal : 0x33ff [1]crcfinal : 0x33ff [2]crcfinal : 0x33ff [3]crcfinal : 0x33ff [4]crcfinal : 0x33ff [5]crcfinal : 0x33ff [6]crcfinal : 0x33ff [7]crcfinal : 0x33ff Correct operation validated. See README.md for run and reporting rules. CoreMark 1.0 : 48203.330412 / GCC13.2.0 -O2 -DMULTITHREAD=8 -DUSE_PTHREAD -pthread -DPERFORMANCE_RUN=1 -lrt / Heap / 8:PThreads ``` **Cortex-A55** ```bash $ make clean $ make XCFLAGS="-DMULTITHREAD=2 -DUSE_PTHREAD -pthread" ``` 测试结果如下 ```bash $ cat run1.log 2K performance run parameters for coremark. CoreMark Size : 666 Total ticks : 17633 Total time (secs): 17.633000 Iterations/Sec : 12476.606363 Iterations : 220000 Compiler version : GCC13.3.0 Compiler flags : -O2 -DTOTAL_DATA_SIZE=12000 -DPROFILE_RUN=1 -DMULTITHREAD=2 -DUSE_PTHREAD -pthread -DPERFORMANCE_RUN=1 -lrt Parallel PThreads : 2 Memory location : Please put data memory location here (e.g. code in flash, data on heap etc) seedcrc : 0xe9f5 [0]crclist : 0xe714 [1]crclist : 0xe714 [0]crcmatrix : 0x1fd7 [1]crcmatrix : 0x1fd7 [0]crcstate : 0x8e3a [1]crcstate : 0x8e3a [0]crcfinal : 0x33ff [1]crcfinal : 0x33ff Correct operation validated. See README.md for run and reporting rules. CoreMark 1.0 : 12476.606363 / GCC13.3.0 -O2 -DTOTAL_DATA_SIZE=12000 -DPROFILE_RUN=1 -DMULTITHREAD=2 -DUSE_PTHREAD -pthread -DPERFORMANCE_RUN=1 -lrt / Heap / 2:PThreads ``` 结论:多线程性能几乎等于单线程*内核数,X60因为有8个CPU内核,无疑比iMX93强很多。 ## 内存性能 测试工具:https://github.com/raas/mbw 下载编译 ```bash $ git clone https://github.com/raas/mbw $ cd mbw $ mkdir build && cd build $ cmake .. $ make ``` **X60** 测试了多次,发现测试`DUMB`时速度明显下降,原因未知 ```bash ➜ build git:(master) ./mbw -q -n 10 256 0 Method: MEMCPY Elapsed: 0.09440 MiB: 256.00000 Copy: 2711.778 MiB/s 1 Method: MEMCPY Elapsed: 0.09446 MiB: 256.00000 Copy: 2710.027 MiB/s 2 Method: MEMCPY Elapsed: 0.09451 MiB: 256.00000 Copy: 2708.794 MiB/s 3 Method: MEMCPY Elapsed: 0.09445 MiB: 256.00000 Copy: 2710.400 MiB/s 4 Method: MEMCPY Elapsed: 0.09451 MiB: 256.00000 Copy: 2708.851 MiB/s 5 Method: MEMCPY Elapsed: 0.09465 MiB: 256.00000 Copy: 2704.673 MiB/s 6 Method: MEMCPY Elapsed: 0.09448 MiB: 256.00000 Copy: 2709.453 MiB/s 7 Method: MEMCPY Elapsed: 0.09454 MiB: 256.00000 Copy: 2707.963 MiB/s 8 Method: MEMCPY Elapsed: 0.09523 MiB: 256.00000 Copy: 2688.257 MiB/s 9 Method: MEMCPY Elapsed: 0.09428 MiB: 256.00000 Copy: 2715.374 MiB/s AVG Method: MEMCPY Elapsed: 0.09455 MiB: 256.00000 Copy: 2707.539 MiB/s 0 Method: DUMB Elapsed: 0.53327 MiB: 256.00000 Copy: 480.059 MiB/s 1 Method: DUMB Elapsed: 0.53381 MiB: 256.00000 Copy: 479.575 MiB/s 2 Method: DUMB Elapsed: 0.53376 MiB: 256.00000 Copy: 479.620 MiB/s 3 Method: DUMB Elapsed: 0.53478 MiB: 256.00000 Copy: 478.698 MiB/s 4 Method: DUMB Elapsed: 0.53553 MiB: 256.00000 Copy: 478.027 MiB/s 5 Method: DUMB Elapsed: 0.53377 MiB: 256.00000 Copy: 479.605 MiB/s 6 Method: DUMB Elapsed: 0.53321 MiB: 256.00000 Copy: 480.108 MiB/s 7 Method: DUMB Elapsed: 0.53278 MiB: 256.00000 Copy: 480.499 MiB/s 8 Method: DUMB Elapsed: 0.53380 MiB: 256.00000 Copy: 479.585 MiB/s 9 Method: DUMB Elapsed: 0.53516 MiB: 256.00000 Copy: 478.361 MiB/s AVG Method: DUMB Elapsed: 0.53399 MiB: 256.00000 Copy: 479.412 MiB/s 0 Method: MCBLOCK Elapsed: 0.09687 MiB: 256.00000 Copy: 2642.635 MiB/s 1 Method: MCBLOCK Elapsed: 0.09480 MiB: 256.00000 Copy: 2700.365 MiB/s 2 Method: MCBLOCK Elapsed: 0.09469 MiB: 256.00000 Copy: 2703.588 MiB/s 3 Method: MCBLOCK Elapsed: 0.09487 MiB: 256.00000 Copy: 2698.429 MiB/s 4 Method: MCBLOCK Elapsed: 0.09485 MiB: 256.00000 Copy: 2698.942 MiB/s 5 Method: MCBLOCK Elapsed: 0.09460 MiB: 256.00000 Copy: 2706.188 MiB/s 6 Method: MCBLOCK Elapsed: 0.09471 MiB: 256.00000 Copy: 2702.902 MiB/s 7 Method: MCBLOCK Elapsed: 0.09532 MiB: 256.00000 Copy: 2685.606 MiB/s 8 Method: MCBLOCK Elapsed: 0.09483 MiB: 256.00000 Copy: 2699.682 MiB/s 9 Method: MCBLOCK Elapsed: 0.09461 MiB: 256.00000 Copy: 2705.759 MiB/s AVG Method: MCBLOCK Elapsed: 0.09502 MiB: 256.00000 Copy: 2694.286 MiB/s ``` **Cortex-A55** `DUMB`测试正常,和其他项差不多 ```bash $ ./mbw -q -n 10 256 0 Method: MEMCPY Elapsed: 0.08938 MiB: 256.00000 Copy: 2864.111 MiB/s 1 Method: MEMCPY Elapsed: 0.08921 MiB: 256.00000 Copy: 2869.794 MiB/s 2 Method: MEMCPY Elapsed: 0.08924 MiB: 256.00000 Copy: 2868.797 MiB/s 3 Method: MEMCPY Elapsed: 0.08921 MiB: 256.00000 Copy: 2869.794 MiB/s 4 Method: MEMCPY Elapsed: 0.08921 MiB: 256.00000 Copy: 2869.537 MiB/s 5 Method: MEMCPY Elapsed: 0.08910 MiB: 256.00000 Copy: 2873.047 MiB/s 6 Method: MEMCPY Elapsed: 0.08882 MiB: 256.00000 Copy: 2882.396 MiB/s 7 Method: MEMCPY Elapsed: 0.08919 MiB: 256.00000 Copy: 2870.341 MiB/s 8 Method: MEMCPY Elapsed: 0.08940 MiB: 256.00000 Copy: 2863.439 MiB/s 9 Method: MEMCPY Elapsed: 0.08919 MiB: 256.00000 Copy: 2870.438 MiB/s AVG Method: MEMCPY Elapsed: 0.08919 MiB: 256.00000 Copy: 2870.161 MiB/s 0 Method: DUMB Elapsed: 0.08951 MiB: 256.00000 Copy: 2859.952 MiB/s 1 Method: DUMB Elapsed: 0.08884 MiB: 256.00000 Copy: 2881.617 MiB/s 2 Method: DUMB Elapsed: 0.08926 MiB: 256.00000 Copy: 2867.962 MiB/s 3 Method: DUMB Elapsed: 0.08918 MiB: 256.00000 Copy: 2870.470 MiB/s 4 Method: DUMB Elapsed: 0.08863 MiB: 256.00000 Copy: 2888.315 MiB/s 5 Method: DUMB Elapsed: 0.08919 MiB: 256.00000 Copy: 2870.438 MiB/s 6 Method: DUMB Elapsed: 0.08916 MiB: 256.00000 Copy: 2871.307 MiB/s 7 Method: DUMB Elapsed: 0.08896 MiB: 256.00000 Copy: 2877.698 MiB/s 8 Method: DUMB Elapsed: 0.08933 MiB: 256.00000 Copy: 2865.939 MiB/s 9 Method: DUMB Elapsed: 0.08921 MiB: 256.00000 Copy: 2869.794 MiB/s AVG Method: DUMB Elapsed: 0.08913 MiB: 256.00000 Copy: 2872.328 MiB/s 0 Method: MCBLOCK Elapsed: 0.08953 MiB: 256.00000 Copy: 2859.281 MiB/s 1 Method: MCBLOCK Elapsed: 0.08980 MiB: 256.00000 Copy: 2850.621 MiB/s 2 Method: MCBLOCK Elapsed: 0.08885 MiB: 256.00000 Copy: 2881.390 MiB/s 3 Method: MCBLOCK Elapsed: 0.08901 MiB: 256.00000 Copy: 2876.081 MiB/s 4 Method: MCBLOCK Elapsed: 0.08936 MiB: 256.00000 Copy: 2864.688 MiB/s 5 Method: MCBLOCK Elapsed: 0.08913 MiB: 256.00000 Copy: 2872.209 MiB/s 6 Method: MCBLOCK Elapsed: 0.08914 MiB: 256.00000 Copy: 2872.048 MiB/s 7 Method: MCBLOCK Elapsed: 0.08932 MiB: 256.00000 Copy: 2865.971 MiB/s 8 Method: MCBLOCK Elapsed: 0.08907 MiB: 256.00000 Copy: 2874.305 MiB/s 9 Method: MCBLOCK Elapsed: 0.08922 MiB: 256.00000 Copy: 2869.376 MiB/s AVG Method: MCBLOCK Elapsed: 0.08924 MiB: 256.00000 Copy: 2868.572 MiB/s ``` 结论:X60内存性能弱一点。 ## 结论 - 在单线程性能方面,X60与主频稍高的Cortex-A55相比,性能几乎一致。 - 在多线程性能方面,X60利用其8个核心的优势,展现出显著的性能提升。 - 内存性能方面,X60在特定测试条件下性能有所下降。 请注意,本次测试不严谨,仅供参考。实际性能可能因测试环境、编译器优化等因素而有所不同。

  • 2025-04-06
  • 发表了主题帖: 【Bit-Brick K1】系统安装与体验

    # 系统安装与体验 ## 烧写系统 下载好系统烧写到SD卡。 ## 上电体验 直接上电启动。 第一次启动时间有点久,可能和SD卡速度有关系,SD的速度和固态硬盘比起来还是差很多。 等待一段时间进入系统后,初步体验了一下系统,和Ubuntu几乎一样。 打开浏览器看看百度新闻。浏览器还是相当费资源的,总体而言刚打开页面有点卡顿,页面加载完后就比较流畅了。 ## 本地编译测试 基于`CMake`工程的`baresip`测试一下本地编译速度。 **编译依赖`re`库** ```bash # 安装依赖libssl-dev sudo apt-get install libssl-dev git clone https://github.com/baresip/re cd re cmake -B build -DCMAKE_BUILD_TYPE=Release # 启用多线程编译 cmake --build build -j sudo cmake --install build # 更新系统链接缓存 sudo ldconfig ``` 由于启用了多线程编译,编译速度还是非常快的。但是最近链接阶段比较慢,估计和使用的SD卡有关系。 **编译`baresip`** ```bash # 安装依赖libpipewire libopus $ sudo apt install libpipewire-0.3-dev libopus-dev libasound2-dev $ cmake -B build -DCMAKE_BUILD_TYPE=Release $ cmake --build build -j ``` 编译时,可以看到CPU满载 ## 声卡 查看了一下声卡好像有点问题 ```bash ➜ ~ wpctl status PipeWire 'pipewire-0' [1.0.5, bruce@bruce-desktop, cookie:2092829671] └─ Clients: 32. pipewire [1.0.5, bruce@bruce-desktop, pid:1516] 34. WirePlumber [1.0.5, bruce@bruce-desktop, pid:1514] 35. WirePlumber [export] [1.0.5, bruce@bruce-desktop, pid:1514] 64. wpctl [1.0.5, bruce@bruce-desktop, pid:1775] Audio ├─ Devices: │ ├─ Sinks: │ * 33. Dummy Output [vol: 1.00] │ ├─ Sink endpoints: │ ├─ Sources: │ ├─ Source endpoints: │ └─ Streams: Video ├─ Devices: │ 39. Linlon Video device [v4l2] │ 40. Unknown device [v4l2] │ 41. Unknown device [v4l2] │ 42. Unknown device [v4l2] │ 43. Unknown device [v4l2] │ 44. Unknown device [v4l2] │ 45. Unknown device [v4l2] │ 46. Unknown device [v4l2] │ 47. Unknown device [v4l2] │ 48. Unknown device [v4l2] │ 49. Unknown device [v4l2] │ 50. Unknown device [v4l2] │ 51. Unknown device [v4l2] │ 52. Unknown device [v4l2] │ 53. Unknown device [v4l2] │ 54. Unknown device [v4l2] │ 55. Unknown device [v4l2] │ 56. Unknown device [v4l2] │ 57. Unknown device [v4l2] │ 58. Unknown device [v4l2] │ 59. spacemit vivi [v4l2] │ ├─ Sinks: │ ├─ Sink endpoints: │ ├─ Sources: │ ├─ Source endpoints: │ └─ Streams: Settings └─ Default Configured Node Names: 0. Audio/Sink alsa_output.platform-snd-card_1.stereo-fallback ➜ ~ pw-cli list-objects | grep "node.name" node.name = "Dummy-Driver" node.name = "Freewheel-Driver" node.name = "auto_null" ``` `pw-cli`也找不到声卡节点。但是内核启动时看到`es8326`已经成功加载,但是`aplay`和`arecord`都识别不到声卡,有点奇怪。 ```bash [ 5.826030] ALSA device list: [ 5.829040] #0: snd-es8326 ➜ ~ aplay -L null Discard all samples (playback) or generate zero samples (capture) pipewire PipeWire Sound Server default Default ALSA Output (currently PipeWire Media Server) ➜ ~ aplay -l aplay: device_list:277: no soundcards found... ➜ ~ arecord -l arecord: device_list:277: no soundcards found... ``` 这样的话暂时没法用命令测试音频播放了,后面有空再看这个问题。

  • 2025-04-04
  • 发表了主题帖: Bit-Brick K1开发准备

    本帖最后由 小麦克 于 2025-4-4 08:35 编辑 # Bit-Brick K1开发准备 官网资料写的很详细:https://docs.bit-brick.com/zh/docs/k1/getting-started/preparation 准备先整体过一遍,然后仔细阅读每一篇,跟着一起学习练习。 去GitHub下载资料:https://github.com/bit-brick/datasheets 我们拿到的开发板型号是`K1_SBC`,这个文件夹包括原理图设计源文件和PCB设计源文件。不过没有转换好的pdf文件,需要安装好Cadence Allegro工具查看。 原理图工程 PCB采用8层设计 转换好的原理图pdf文件

  • 2025-04-03
  • 发表了主题帖: Bit-Brick K1开源开发板开箱

    # Bit-Brick K1开源开发板开箱 上班最后一天,收到了期待已久的Bit-Brick K1开源开发板。作为一款备受瞩目的开源硬件,Bit-Brick K1以其强大的性能和灵活的扩展性成功吸引了我的注意^_^。以下是我的开箱体验。 ## 外包装与第一印象 Bit-Brick K1的包装设计非常小巧。 打开包装盒,首先映入眼帘的是开发板本身。 ## 硬件规格与设计 基于进迭时空RISC-V AI CPU SpacemiT K1的高性能单板电脑,集成丰富的IO接口,提供2T通用AI算力。 - 主控芯片:SpacemiT K1,八核64位RISC-V AI CPU,遵循RISC-V 64GCVB架构,支持RVA22 profile和256bit RVV 1.0标准;核内融合2TOPS通用AI算力,可实现与所有主流AI生态的快速对接 - 支持4K H.265/H.264/VP9/VP8等编解码格式;支持3D图形引擎OpenCL3.0/OpenGL ES 3.2/Vulkan1.3 - 4GB LPDDR4X SDRAM 接口也非常丰富,MIIPI CSI,MIPI DSI,千兆网络,USB3.0,支持NVMe SSD,还有扩展的GPIO接口。该有的都有了。 开发板的尺寸为80mm x 90mm,设计紧凑,便于集成到各种项目中。PCB板采用了黑色哑光工艺,质感十足。 正面 背面 主芯片比iMX93大多了。 ## 总结 Bit-Brick K1开源开发板凭借其强大的性能、丰富的接口和灵活的扩展性,成为了开发者和创客的理想选择。无论是嵌入式开发、物联网项目还是人工智能应用,K1都能提供强大的支持。 开箱体验到此结束,接下来我将深入探索Bit-Brick K1的更多可能性,期待在未来的项目中发挥其强大的潜力。

  • 2025-03-31
  • 回复了主题帖: 测评入围名单: 基于RISC-V AI CPU的Bit-Brick K1开源开发板

    个人信息无误,确认可以完成测评分享计划

  • 2025-02-14
  • 发表了主题帖: 【Luckfox Pico Ultra BW评测】RV1106G3 解决录音问题

    本帖最后由 小麦克 于 2025-2-15 11:37 编辑 ## RV1106G 解决录音问题 **Luckfox Pico Ultra BW** 自带的MIC录音听不到声音 https://bbs.eeworld.com.cn/thread-1305930-1-1.html 再次分析原理图,实际开发板`C58`那里焊接的是`0R`电阻,所以这里接的是单端输入信号,不是差分! 我们再来看看野火开发板(LubanCat_RV06) 的麦克风接法 野火开发板使用了左右两个声道,都是差分输入。 查看当前设置 `amixer controls` ```bash # amixer controls numid=4,iface=MIXER,name='ADC ALC Left Volume' numid=5,iface=MIXER,name='ADC ALC Right Volume' numid=6,iface=MIXER,name='ADC Digital Left Volume' numid=7,iface=MIXER,name='ADC Digital Right Volume' numid=8,iface=MIXER,name='ADC HPF Cut-off' numid=2,iface=MIXER,name='ADC MIC Left Gain' numid=22,iface=MIXER,name='ADC MIC Left Switch' numid=3,iface=MIXER,name='ADC MIC Right Gain' numid=23,iface=MIXER,name='ADC MIC Right Switch' numid=20,iface=MIXER,name='ADC MICBIAS Voltage' numid=21,iface=MIXER,name='ADC Main MICBIAS' numid=19,iface=MIXER,name='ADC Mode' numid=1,iface=MIXER,name='I2STDM Digital Loopback Mode' numid=17,iface=MIXER,name='AGC Left Approximate Sample Rate' numid=18,iface=MIXER,name='AGC Right Approximate Sample Rate' numid=11,iface=MIXER,name='ALC AGC Left Max Volume' numid=13,iface=MIXER,name='ALC AGC Left Min Volume' numid=15,iface=MIXER,name='ALC AGC Left Switch' numid=9,iface=MIXER,name='ALC AGC Left Volume' numid=12,iface=MIXER,name='ALC AGC Right Max Volume' numid=14,iface=MIXER,name='ALC AGC Right Min Volume' numid=16,iface=MIXER,name='ALC AGC Right Switch' numid=10,iface=MIXER,name='ALC AGC Right Volume' numid=26,iface=MIXER,name='DAC Control Manually' numid=25,iface=MIXER,name='DAC HPMIX Volume' numid=24,iface=MIXER,name='DAC LINEOUT Volume' ``` 注意`ADC Mode`:numid=19,iface=MIXER,name='ADC Mode',查看当前`ADC Mode`设置 ```bash # amixer cget numid=19 numid=19,iface=MIXER,name='ADC Mode' ; type=ENUMERATED,access=rw------,values=1,items=6 ; Item #0 'DiffadcL' ; Item #1 'SingadcL' ; Item #2 'DiffadcR' ; Item #3 'SingadcR' ; Item #4 'SingadcLR' ; Item #5 'DiffadcLR' : values=0 ``` `values=0`:设置的左声道差分输入!这个和我们的硬件不匹配,修改成`SingadcL` ```bash # amixer cset numid=19 1 numid=19,iface=MIXER,name='ADC Mode' ; type=ENUMERATED,access=rw------,values=1,items=6 ; Item #0 'DiffadcL' ; Item #1 'SingadcL' ; Item #2 'DiffadcR' ; Item #3 'SingadcR' ; Item #4 'SingadcLR' ; Item #5 'DiffadcLR' : values=1 ``` 再次测试录音和播放 ```bash # arecord -D plughw:0,0 -f cd -t wav -d 10 test.wav Recording WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo # aplay test.wav Playing WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo ``` 终于正常了,拷贝到电脑上,只有左耳机有声音。声音清晰!纠结了几天的问题终于解决了。 最后非常感谢野火提供资料。看了这么多资料,感觉野火的资料最实在,干货最多。

  • 2025-02-10
  • 回复了主题帖: 【Luckfox Pico Max评测】音频测试

    Vincent2012 发表于 2025-2-9 22:24 可以算MAX的评测吗?这不是MAX啊 芯片都一样,只是为了测试音频,原理都一样。 买现成的,不需要自己焊接。

  • 2025-02-09
  • 发表了主题帖: 【Luckfox Pico Max评测】音频测试

    本帖最后由 小麦克 于 2025-2-9 14:07 编辑 # RV1106音频测试 最近想测试一下RV1106的音频功能,由于**Luckfox Pico Max**不带mic和扬声器,就淘宝下单买了一个**Luckfox Pico Ultra W**,刚到货,今天就来测试一下。 这款自带`MIC`和`SPEAK`接口,焊接上从正点原子开发板拆下来的1W小喇叭。 最新的SDK已经成功识别到声卡 ```bash # arecord -l **** List of CAPTURE Hardware Devices **** card 0: rvacodec [rv-acodec], device 0: ffae0000.i2s-rv1106-hifi ff480000.acodec-0 [ffae0000.i2s-rv1106-hifi ff480000.acodec-0] Subdevices: 0/1 Subdevice #0: subdevice #0 # aplay -l **** List of PLAYBACK Hardware Devices **** card 0: rvacodec [rv-acodec], device 0: ffae0000.i2s-rv1106-hifi ff480000.acodec-0 [ffae0000.i2s-rv1106-hifi ff480000.acodec-0] Subdevices: 1/1 Subdevice #0: subdevice #0 ``` ## 播放MP3 默认镜像自带了一个工具`madplay`,上传一个mp3文件到开发板。 ```bash madplay 11.mp3 ``` 测试下来正常,声音清晰洪亮。 ## 录音 录音就不顺利了,通过以下指令录取一段10秒的音频,指令执行正常 ```bash arecord -D plughw:0,0 -f cd -t wav -d 10 test.wav ``` 但是将音频拷贝到电脑,或者通过开发板播放会发现只能录一些对着mic吹气的吱吱声,正常的说话声音根本听不到。 ```bash aplay test.wav ``` 看下面的视频: [localvideo]b53f35e37b8acb536edea053c9af08c8[/localvideo] 咨询了技术支持,说不是MIC问题,应该是普遍现象~建议使用USB声卡代替。这个解释有点牵强,等有时间回头再过来看。 ## USB声卡 我手头有一个H340的USB耳机,拿过来测试一下。直接插入USB HOST端口,不出意外,啥反应都没有~ ### 系统设置 分析原理图,可以看到接入USB-TypeC供电的情况下,USB Host是无法选择的。因为RV1106只有一路USB,这路USB既可以用来做Device,也可以用来做Host,但同时只能选择一个。 解决方法: 拔掉USB Type-C,使用 `PoE IN` POUT1 5V接口。 ### 内核模块 默认内核不支持USB声卡,需要打开USB声卡,这里我们直接将USB编译到内核中,也就是在配置时选择`Y` ```bash ./build.sh kernelconfig SND_USB_AUDIO = Y ``` 查找USB声卡配置,搜索`USB_AUDIO`关键词可以找到设置的位置。 配置截图 ### 测试 完成了以上步骤,就可以测试了。 插入USB声卡,系统提示有USB设备接入,查看声卡列表 ```bash [root@luckfox root]# [ 39.966030] usb 1-1: new full-speed USB device number 2 using xhci-hcd [root@luckfox root]# [root@luckfox root]# lsusb Bus 001 Device 001: ID 1d6b:0002 Bus 001 Device 002: ID 046d:0a38 Bus 002 Device 001: ID 1d6b:0003 [root@luckfox root]# aplay -l **** List of PLAYBACK Hardware Devices **** card 0: rv1106acodec [rv1106-acodec], device 0: ffae0000.i2s-rv1106-hifi ff480000.acodec-0 [ffae0000.i2s-rv1106-hifi ff480000.acodec-0] Subdevices: 1/1 Subdevice #0: subdevice #0 card 1: H340 [Logi USB Headset H340], device 0: USB Audio [USB Audio] Subdevices: 1/1 Subdevice #0: subdevice #0 [root@luckfox root]# arecord -l **** List of CAPTURE Hardware Devices **** card 0: rv1106acodec [rv1106-acodec], device 0: ffae0000.i2s-rv1106-hifi ff480000.acodec-0 [ffae0000.i2s-rv1106-hifi ff480000.acodec-0] Subdevices: 1/1 Subdevice #0: subdevice #0 card 1: H340 [Logi USB Headset H340], device 0: USB Audio [USB Audio] Subdevices: 1/1 Subdevice #0: subdevice #0 [root@luckfox root]# ``` 录音测试,一切正常。 ```bash [root@luckfox root]# arecord -D plughw:1,0 -f cd -t wav -d 10 test.wav Recording WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo [root@luckfox root]# aplay test.wav Playing WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo ```

  • 2025-02-06
  • 发表了主题帖: 【Luckfox Pico Max评测】摄像头测试

    # 摄像头测试 从今天开始,我们开始玩点高级的功能:音视频相关 拿到的开发板自带了一个摄像头:SC3336,这个摄像头清晰度不错。 ## 安装 首先将摄像头排线和开发板连接好,然后上电启动。 通过USB NDIS虚拟网口进入开发板 ```bash ssh root@172.32.0.93 # password: luckfox [root@luckfox root]# cd /userdata/ [root@luckfox userdata]# ls ethaddr.txt image.bmp rkipc.ini video0 video1 video2 ``` 进入目录`/userdata`,如果有`rkipc.ini`则说明摄像头识别成功。 ## VLC拉流测试 打开VLC,打开 媒体 -> 打开网络串流 设置网络URL:`rtsp://172.32.0.93/live/0`,缓存设置为`300ms` 成功读取到视频流,图像清晰,画面颜色正常,效果不错。

  • 2025-02-04
  • 加入了学习《RISC-V 5th workshop》,观看 RISC V @ UC San Diego Michael B Taylor, UC San Diego 1

  • 加入了学习《RISC-V 5th workshop》,观看 5th RISC V Workshop Introduction Rick O’Connor, RISC V; Dom Rizzo, Google

  • 2025-01-31
  • 回复了主题帖: 【Luckfox Pico Max评测】TMF8821驱动移植与测试

  • 发表了主题帖: 【Luckfox Pico Max评测】TMF8821驱动移植与测试

    # dtof驱动移植 最近在玩一款dToF传感器[TMF8821](https://ams-osram.com/products/sensor-solutions/direct-time-of-flight-sensors-dtof/ams-tmf8821-configurable-4x4-multi-zone-time-of-flight-sensor),接口是I2C,现在将这款传感器的驱动移植到RV1106G3下面。 ### 内核模块 rv1106使用的是`5.10.160`内核版本。TMF8821提供linux官方驱动[TMF882x_Driver_Linux_v3.56.zip](https://ams-osram.com/o/download-server/document-download/download/29942077) 内核模块。 > GitHub上面有其他公司修改后的版本:https://github.com/brainlab-vied/tmf8820_21_28_driver_linux 修改`Makefile`,设置好`ARCH`和交叉编译器路径 ```makefile KDIR:=/home/bruce/Documents/luckfox-pico/sysdrv/source/kernel PWD?=$(shell pwd) MAKE := make ARCH := arm CROSS_COMPILE := /home/bruce/Documents/luckfox-pico/tools/linux/toolchain/arm-rockchip830-linux-uclibcgnueabihf/bin/arm-rockchip830-linux-uclibcgnueabihf- KBUILD_OUTPUT := $(abspath $(dir $(lastword $(KDIR))))/objs_kernel ifneq ($(KERNELRELEASE),) #kbuild part of Makefile include Kbuild else #normal Makefile all: $(MAKE) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C $(KDIR) M=$(PWD) modules modules: $(MAKE) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C $(KDIR) M=$(PWD) $@ sign: $(SIGN_SCRIPT) sha512 $(LINUX_SRC)/signing_key.priv $(LINUX_SRC)/signing_key.x509 $(DEVICE_NAME).ko clean: $(MAKE) -C $(LINUX_SRC) M=$$PWD clean endif ``` 直接编译有错误 ```sh make CONFIG_SENSORS_TMF882X=m make ARCH=arm CROSS_COMPILE=/home/bruce/Documents/luckfox-pico/tools/linux/toolchain/arm-rockchip830-linux-uclibcgnueabihf/bin/arm-rockchip830-linux-uclibcgnueabihf- -C /home/bruce/Documents/luckfox-pico/sysdrv/source/kernel M=/home/bruce/Documents/ams_tmf8820_linux_driver_src_v3.56 modules make[1]: Entering directory '/home/bruce/Documents/luckfox-pico/sysdrv/source/kernel' CC [M] /home/bruce/Documents/ams_tmf8820_linux_driver_src_v3.56/tmf882x_driver.o In file included from /home/bruce/Documents/ams_tmf8820_linux_driver_src_v3.56/tmf882x_host_interface.h:36, from /home/bruce/Documents/ams_tmf8820_linux_driver_src_v3.56/tmf882x_mode_app.h:39, from /home/bruce/Documents/ams_tmf8820_linux_driver_src_v3.56/tmf882x_interface.h:38, from /home/bruce/Documents/ams_tmf8820_linux_driver_src_v3.56/tmf882x_driver.c:57: /home/bruce/Documents/ams_tmf8820_linux_driver_src_v3.56/tmf882x_shim_linux_kernel.h: In function 'tof_get_timespec': /home/bruce/Documents/ams_tmf8820_linux_driver_src_v3.56/tmf882x_shim_linux_kernel.h:89:5: error: implicit declaration of function 'getnstimeofday'; did you mean 'getname_flags'? [-Werror=implicit-function-declaration] getnstimeofday(ts); ^~~~~~~~~~~~~~ getname_flags In file included from /home/bruce/Documents/ams_tmf8820_linux_driver_src_v3.56/tmf882x_interface.h:38, from /home/bruce/Documents/ams_tmf8820_linux_driver_src_v3.56/tmf882x_driver.c:57: /home/bruce/Documents/ams_tmf8820_linux_driver_src_v3.56/tmf882x_mode_app.h: At top level: /home/bruce/Documents/ams_tmf8820_linux_driver_src_v3.56/tmf882x_mode_app.h:228:25: error: field 'timestamp' has incomplete type struct timespec timestamp; ^~~~~~~~~ /home/bruce/Documents/ams_tmf8820_linux_driver_src_v3.56/tmf882x_driver.c: In function 'tof_ram_patch_callback': /home/bruce/Documents/ams_tmf8820_linux_driver_src_v3.56/tmf882x_driver.c:2250:12: error: variable 'start_ts' has initializer but incomplete type struct timespec start_ts = {0}, end_ts = {0}; ^~~~~~~~ /home/bruce/Documents/ams_tmf8820_linux_driver_src_v3.56/tmf882x_driver.c:2250:33: error: excess elements in struct initializer [-Werror] struct timespec start_ts = {0}, end_ts = {0}; ^ /home/bruce/Documents/ams_tmf8820_linux_driver_src_v3.56/tmf882x_driver.c:2250:33: note: (near initialization for 'start_ts') /home/bruce/Documents/ams_tmf8820_linux_driver_src_v3.56/tmf882x_driver.c:2250:21: error: storage size of 'start_ts' isn't known struct timespec start_ts = {0}, end_ts = {0}; ^~~~~~~~ /home/bruce/Documents/ams_tmf8820_linux_driver_src_v3.56/tmf882x_driver.c:2250:12: error: variable 'end_ts' has initializer but incomplete type struct timespec start_ts = {0}, end_ts = {0}; ^~~~~~~~ /home/bruce/Documents/ams_tmf8820_linux_driver_src_v3.56/tmf882x_driver.c:2250:47: error: excess elements in struct initializer [-Werror] struct timespec start_ts = {0}, end_ts = {0}; ^ /home/bruce/Documents/ams_tmf8820_linux_driver_src_v3.56/tmf882x_driver.c:2250:47: note: (near initialization for 'end_ts') /home/bruce/Documents/ams_tmf8820_linux_driver_src_v3.56/tmf882x_driver.c:2250:37: error: storage size of 'end_ts' isn't known struct timespec start_ts = {0}, end_ts = {0}; ^~~~~~ /home/bruce/Documents/ams_tmf8820_linux_driver_src_v3.56/tmf882x_driver.c:2276:17: error: implicit declaration of function 'timespec_sub'; did you mean 'timespec64_sub'? [-Werror=implicit-function-declaration] fwdl_time = timespec_sub(end_ts, start_ts).tv_nsec / 1000000; ^~~~~~~~~~~~ timespec64_sub /home/bruce/Documents/ams_tmf8820_linux_driver_src_v3.56/tmf882x_driver.c:2250:37: error: unused variable 'end_ts' [-Werror=unused-variable] struct timespec start_ts = {0}, end_ts = {0}; ^~~~~~ /home/bruce/Documents/ams_tmf8820_linux_driver_src_v3.56/tmf882x_driver.c:2250:21: error: unused variable 'start_ts' [-Werror=unused-variable] struct timespec start_ts = {0}, end_ts = {0}; ^~~~~~~~ cc1: all warnings being treated as errors make[2]: *** [scripts/Makefile.build:273: /home/bruce/Documents/ams_tmf8820_linux_driver_src_v3.56/tmf882x_driver.o] Error 1 make[1]: *** [Makefile:1935: /home/bruce/Documents/ams_tmf8820_linux_driver_src_v3.56] Error 2 make[1]: Leaving directory '/home/bruce/Documents/luckfox-pico/sysdrv/source/kernel' make: *** [Makefile:16: all] Error 2 ``` 编译失败的主要原因是 Linux 内核 API 的兼容性问题。具体来说,驱动代码中使用了较旧的内核 API(如 `getnstimeofday` 和 `timespec`),而这些 API 在新版本的内核中已经被弃用或修改。 需要修改源代码 ```c struct timespec ts; getnstimeofday(&ts); // 旧代码 ``` 替换成 ```c struct timespec64 ts; ktime_get_real_ts64(&ts); // 新代码 ``` 代码中使用了 `struct timespec`,需要将其替换为 `struct timespec64` 修改 `tmf882x_shim_linux_kernel.h`: ```c #include // 添加头文件 static inline void tof_get_timespec(struct timespec64 *ts) { ktime_get_real_ts64(ts); // 替换 getnstimeofday } ``` 相关变量都修改好,再次编译成功。可以看到在当前目录下成功生成了`tmf882x.ko`内核模块。 ### 修改设备树 根据开发板接线图,准备使用`i2c3`。 修改`sysdrv/source/kernel/arch/arm/boot/dts/rv1106g-luckfox-pico-max.dts`,使能`i2c3`,添加节点`tmf8821`,添加gpio控制引脚。GPIO1_C6接ENABLE引脚,高电平有效。GPIO1_C7接irq引脚,下降沿有效。 ``` /* I2C3_M1 */ &i2c3 { status = "okay"; pinctrl-names = "default"; pinctrl-0 = ; clock-frequency = ; tmf8821: tmf8821@41 { compatible = "ams,tmf882x"; status = "okay"; reg = ; enable-gpios = ; // GPIO1_C6 enable irq-gpios = ; // GPIO1_C7 irq interrupt-parent = ; interrupts = ; }; }; ``` 编译重新烧录开发板。 ### 加载firmware tmf8821传感器上电后需要加载固件才能进入app运行模式,将官方提供的hex文件放到开发板`/lib/firmware/tmf882x_firmware.bin`。注意:这里必须将官方提供的`.hex`文件重命名为`tmf882x_firmware.bin`,不要转换hex文件。我刚开始用工具将hex文件转换成`bin`文件加载一直无法启动。 ### 加载运行 将上面编译好的`tmf882x.ko`,官方提供的设备固件`tmf882x_firmware.bin`下载到设备中 运行 ```bash insmod tmf882x.ko ``` 成功启动设备 ### 总结 通过在RV1106上集成tmf8821,了解了linux下i2c和gpio中断驱动开发的一些基本知识,并且对RV1106软件构架有了一些认识。

  • 2025-01-24
  • 回复了主题帖: 【luckfox】RV1106 Linux驱动测试

  • 发表了主题帖: 【luckfox】RV1106 Linux驱动测试

    # Linux驱动测试 测试一把最简单helloworld驱动程序,了解一下驱动编程的基本概念。源文件包含两个文件:helloworld.c和Makefile ```bash ➜ helloworld tree . ├── helloworld.c ├── Makefile 1 directory, 2 files ``` helloworld.c ```c #include #include static int helloworld_init(void) { printk("helloworld!\n"); return 0; } static void helloworld_exit(void) { printk("helloworld bye\n"); } module_init(helloworld_init); module_exit(helloworld_exit); MODULE_LICENSE("GPL"); MODULE_AUTHOR("Luckfox"); MODULE_VERSION("V1.0"); ``` Makefile ```makefile obj-m += helloworld.o KDIR:=/home/bruce/Documents/luckfox-pico/sysdrv/source/kernel PWD?=$(shell pwd) MAKE := make ARCH := arm CROSS_COMPILE := /home/bruce/Documents/luckfox-pico/tools/linux/toolchain/arm-rockchip830-linux-uclibcgnueabihf/bin/arm-rockchip830-linux-uclibcgnueabihf- KBUILD_OUTPUT := $(abspath $(dir $(lastword $(KDIR))))/objs_kernel all: echo KBUILD_OUTPUT = $(KBUILD_OUTPUT) $(MAKE) O=$(KBUILD_OUTPUT) -C $(KDIR) M=$(PWD) modules ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) echo $(PWD) clean: rm -f *.ko *.o *.mod *.mod.o *.mod.c *.symvers *.order ``` 编译,查看生成的文件 上传到板子测试

  • 2025-01-23
  • 回复了主题帖: 【luckfox fox】RV1106 GPIO测试

    markdown源码格式被系统处理了,代码前面的空格都被去掉了。希望论坛管理人员把这个老BUG修复一下。

  • 发表了主题帖: 【luckfox fox】RV1106 GPIO测试

    # GPIO测试 ## 引言 官方文档使用的是传统的GPIO操作方法: https://wiki.luckfox.com/zh/Luckfox-Pico/Luckfox-Pico-RV1106/Luckfox-Pico-Pro-Max/Luckfox-pinout/Luckfox-Pico-GPIO 通用输入输出(GPIO)接口对于嵌入式系统至关重要,它允许各种硬件组件之间以及与主CPU之间进行通信。过去,在Linux平台上处理GPIO的主要方式是通过`/sys/class/gpio`接口。然而,随着libgpiod库的引入,一种更高效、用户友好的GPIO操作方法出现了。本文将介绍使用libgpiod进行的测试,比较其与传统GPIO使用方法的优缺点。 ## 配置 选择 `Target packages -> Libraries -> Hardware handling`,选择`libgpiod` ## 编译 ```bash ./build.sh ``` 从下面的截图可以看出,下载的是`libgpiod 1.6.3`版本。 ## 下载 重新打包下载到设备 ```bash [root@luckfox root]# gpiodetect gpiochip0 [gpio0] (32 lines) gpiochip1 [gpio1] (32 lines) gpiochip2 [gpio2] (32 lines) gpiochip3 [gpio3] (32 lines) gpiochip4 [gpio4] (24 lines) [root@luckfox root]# gpioinfo gpiochip0 - 32 lines: line 0: unnamed unused input active-high line 1: unnamed unused input active-high line 2: unnamed unused input active-high line 3: unnamed unused input active-high line 4: unnamed unused input active-high line 5: unnamed unused input active-high line 6: unnamed unused input active-high line 7: unnamed unused input active-high line 8: unnamed unused input active-high ``` ## 升级libgpiod `libgpiod`最新的已经是v2了,v2和v1的API不兼容,这里用的Buildroot是`2023.02.6`版本,这个版本没有v2 libgpiod。我们来尝试集成一下最新的v2版本。 从最新的Buildroot源码中拷贝`package/libgpiod2`文件夹,修改`package/Config.in`文件,添加 ```makefile source "package/libgpiod2/Config.in" ``` 再次执行`./build.sh buildrootconfig`,搜索`libgpiod`,出现了v2版本。和之前一样,选择`libgpiod2`。注意`libgpiod`和`libgpiod2`只能二选一,不能同时选择两个。 编译`./build.sh`,可以看到开始配置`libpgiod2 2.1.3`版本。 重新升级程序 验证版本信息,搞定! ```bash [root@luckfox root]# gpiodetect -v gpiodetect (libgpiod) v2.1.3 Copyright (C) 2017-2023 Bartosz Golaszewski License: GPL-2.0-or-later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. ``` > 注意:如果执行了`./build.sh clean`,上面的配置会丢失,需要重新配置。 ## 编程测试 LUCKFOX rv1106 GPIO定义如下 通过编程测试这个引脚`GPIO1_C7_d `,组内number=2*8+7=23,这个23后面编程要用。 ### C++测试 使用cmake写一个简单的demo 封装一个`GPIOCTRL`类,可以基于这个做扩展。 gpio-ctrl.hpp ```c++ #include #include #include class GPIOCTRL { public: GPIOCTRL(); ~GPIOCTRL(); void gpioCtrl(bool on); private: std::vector request_list; }; ``` gpio-ctrl.cpp ```c++ #include "gpio-ctrl.hpp" GPIOCTRL::GPIOCTRL() { ::std::filesystem::path chip_path("/dev/gpiochip0"); ::gpiod::line::offset line_offset = 23; auto request = ::gpiod::chip(chip_path) .prepare_request() .set_consumer("toggle-line-value") .add_line_settings( line_offset, ::gpiod::line_settings().set_direction( ::gpiod::line::direction::OUTPUT)) .do_request(); request_list.push_back(std::make_shared(std::move(request))); } GPIOCTRL::~GPIOCTRL() {} void GPIOCTRL::gpioCtrl(bool on) { ::gpiod::line::value value = ::gpiod::line::value::ACTIVE; if (!on) value = ::gpiod::line::value::INACTIVE; int line_offset = 23; auto& request = request_list[0]; request->set_value(line_offset, value); } ``` 测试程序 main.cpp ```c++ #include #include #include #include #include #include #include "gpio-ctrl.hpp" int main() { bool ctrl = true; GPIOCTRL gpio; gpio.gpioCtrl(ctrl); for (;;) { std::this_thread::sleep_for(std::chrono::seconds(1)); ::std::cout

  • 2025-01-22
  • 发表了主题帖: 【luckfox fox】RV1106 交叉编译

    # RV1106 交叉编译 为了方便交叉编译,Buildroot提供了一个脚本。 ## 配置 首先打开Buildroot的SDK配置脚本,有了这个脚本,我们可以基于Buildroot的环境编译应用程序。 进入Buildroot目录:`luckfox-pico/sysdrv/source/buildroot/buildroot-2023.02.6` ```bash cd sysdrv/source/buildroot/buildroot-2023.02.6 make menuconfig ``` 选择:`Host utilities -> host environment-setup`,保存编译 进入目录`output/host`查看,发现`environment-setup`已经成功生成。测试一下 ```bash $ source environment-setup $ echo $CC arm-rockchip830-linux-uclibcgnueabihf-gcc ``` 交叉编译 ```bash ➜ test cat hello.c #include int main() { printf("hello world!\n"); return 0; } ➜ test $CC hello.c ➜ test ls a.out hello.c # 查看文件类型 ➜ test file a.out a.out: ELF 32-bit LSB pie executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-uClibc.so.0, not stripped ``` ## 测试验证 将a.out上传到开发板,运行成功

  • 发表了主题帖: 【RV1106】libPJSIP编译测试

    # libPJSIP编译测试 在物联网时代,音视频通讯技术变得愈发重要。RV1106是一款专为边缘设备设计的多媒体处理器,而PJSIP是一个高度模块化的开源音视频通讯框架。本文将探讨RV1106平台上PJSIP库的性能、功能和适用场景。 PJSIP是一个开源的协议栈,支持SIP、SDP、RTP/RTCP等通信协议,广泛应用于VoIP(语音通信)和视频通信领域。其优雅的API设计和跨平台兼容性使其成为开发实时通讯应用的理想选择。PJSIP还提供了多种音视频编解码器,可以灵活地与不同的设备和网络条件适配。 ## 配置 默认rootfs中没有集成`libpjsip`库,需要我们手动配置打开。 打开`buildroot`配置菜单: ```bash ./build.sh buildrootconfig ``` 配置路径为:`> Target packages > Libraries > Networking` 选择`y`,保存到`.config`中。 编译 ```bash ./build.sh ``` 由于配置已经变动,默认会自动下载`libpjsip`并进行编译,从log中可以看出这里使用的版本是`2.13.1` 等待一会儿,编译成功,查看buildroot目录`luckfox-pico/sysdrv/source/buildroot/buildroot-2023.02.6/output/staging/usr/lib`。相关库文件已成功生成。 接下来基于这个库编写应用,敬请期待~

  • 2025-01-19
  • 发表了主题帖: 【Luckfox Pico】功能初体验

    # 功能初体验 上一篇我们已经编译好了镜像,这一篇开始使用编译好的镜像下载到开发板体验一下。 ## 准备工作 准备一条USB转串口数据线,按照下图连接好。上电后就会有log输出。 在`work`目录下是测试例程。运行了一下会报错,具体原因暂时未知。等后面再看。 ```bash # cd work/ # ls -alh total 2M drwxr-xr-x 6 root root 696 Jun 7 2024 . drwx------ 3 1002 1002 224 Jan 1 12:17 .. -rw------- 1 root root 82.4K Jun 6 2024 lenet.rknn drwx------ 2 root root 304 Jun 6 2024 lib -rwx--x--x 1 root root 1.8M Jun 6 2024 luckfox_rtsp_opencv drwx------ 3 root root 304 Jun 7 2024 luckfox_rtsp_opencv_knva drwx------ 4 root root 368 Jun 6 2024 luckfox_rtsp_retinaface_demo drwx------ 2 root root 232 Jun 6 2024 model -rwx------ 1 root root 288.7K May 21 2024 simple_vi_venc_rtsp # pwd /root/work # ./luckfox_rtsp_opencv rkaiq log level ff0 ID: 0, sensor_name is , iqfiles is /etc/iqfiles Segmentation fault (core dumped) # ./simple_vi_venc_rtsp #CodecName:H264 #Resolution: 1920x1080 #CameraIdx: 0 #Frame Count to save: -1 ISP IQ file path: /etc/iqfiles rkaiq log level ff0 ID: 0, sensor_name is , iqfiles is /etc/iqfiles Segmentation fault (core dumped) ``` ## 烧录SPI NAND Flash 现在使用`SocToolKit_v1.98_20240705_01_win`下载之前编译好的镜像。 将编译生成的`luckfox-pico/output/image`文件夹拷贝到`Windows`目录下,在软件上面点击按钮`搜索路径`选择`image`文件夹。选中所有文件。 按住BOOT键重新上电,松开BOOT后应该会显示 `MaskRom` 设备 下载中。。。 等待下载完成自动重启。。。 新镜像启动成功

最近访客

< 1/5 >

统计信息

已有106人来访过

  • 芯积分:186
  • 好友:1
  • 主题:52
  • 回复:138

留言

你需要登录后才可以留言 登录 | 注册


450803313 2014-8-9
小麦克: 没有,我已经工作了
O ,是IT行业?
450803313 2014-8-8
hi,你最近在学zigbee?
查看全部