跳转至

制作第一个Demo*

本 SDK 附带一个默认的模型,唤醒词是 天猫精灵,按如下步骤进行操作

1. 编译*

$ cd lvp_tws
$ cp configs/release/nationalchip/grus_gx8002b_dev_1v.config .config
$ make menuconfig
$ make clean;make

注意

make menuconfig有时会遇到这个错误 Linux Error: ncurses.h: No such file or directory ,这是因为缺少相应的依赖库,Ubuntu解决方法:sudo apt-get install libncurses5-dev.

  • 编译成功后,在 output 目录下会生成一个 mcu_nor.bin
    (py36) jindg@nc:~/bux/code/gitlab/lvp_tws/output$ ll
    ... # 省略一亿行
    -rw-rw-r--  1 jindg jindg  130060 Apr 25 15:07 mcu_nor.bin
    ... # 省略一亿行
    

2. 烧录*

3. 运行*

  • 打开你的串口终端,然后重启开发板,会出如下打印,关注下黄色高亮部分的注释
    SDK的log输出
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    [LVP]Low-Power Voice Preprocess
    [LVP]Copyright (C) 2001-2020 NationalChip Co., Ltd
    [LVP]ALL RIGHTS RESERVED!
    [LVP]Board Model: [grus_gx8002b_dev_1v]
    [LVP]MCU Version: [bcd1a41-dirty]
    [LVP]Release Ver: [0x42555858]
    [LVP]Build Date : [2022-04-25, 15:07:07]
    [LVP]Flash vendor:[PUYA]
    [LVP]Flash type:  [p25q40l]
    [LVP]Flash ID:    [0x856013]
    [LVP]Flash size:  [520192 Byte]
    [LVP]CPU   Freq:  [8192000 Hz][fix] # 配置的 CPU 频率
    [LVP]SRAM  Freq:  [8192000 Hz] # 配置的 SRAM 频率
    [LVP]NPU   Freq:  [8192000 Hz] # 配置的 NPU 频率
    [LVP]FLASH Freq:  [24576000 Hz] # 配置的 FLASH 频率
    [LVP]Ldo   Trim:  [924 mV]
    [LVP]Kws Version: [tmjl_kws_model_v0.1.1_2020_0427.h]
    [LVP]Ctc Version: error!!!
    [LVP_CTC]Demo Kws List [Total:1]:
    [LVP_CTC]KWS: tian mao jing ling | KV: 100 | TRH: 905 | Major: 0 | L: [6 42 3 37 12 40 8 40 ]
    [LVP_KWS ]Kws Use:147 ms
    [AB]amic          [1 Channel]
    [AB]amic pga_gain:[24 dB]
    [AB]amic Ain_gain:[0 dB]
    [LVP_AUD]vad param 3 [0]
    [LVP_TWS]Ctx:0, Vad:1, Ns:0, R:0
    [LVP_TWS]Ctx:15, Vad:1, Ns:0, R:0
    [LVP_TWS]Ctx:30, Vad:1, Ns:0, R:0
    [LVP_TWS]Ctx:45, Vad:1, Ns:0, R:0
    [LVP_TWS]Ctx:60, Vad:1, Ns:0, R:0
    [LVP_TWS]Ctx:75, Vad:1, Ns:0, R:0
    [LVP_TWS]Ctx:78, Vad:0, Ns:0, R:0
    [LVP_TWS]Ctx:90, Vad:0, Ns:0, R:0
    set mcu sleep # GX8002 进入待机,喊一声 “天猫精灵”
    [LVP_TWS]Ctx:3, Vad:1, Ns:0, R:0
    [LVP_TWS]Ctx:15, Vad:1, Ns:0, R:0
    [LVP_CTC] Activation ctx:27,Kws:tian mao jing ling[100],th:905,S:994,905 # 唤醒打印
    [LVP_TWS]Ctx:30, Vad:1, Ns:0, R:0
    [LVP_TWS]Ctx:45, Vad:1, Ns:0, R:0
    [LVP_TWS]Ctx:60, Vad:1, Ns:0, R:0
    [LVP_TWS]Ctx:64, Vad:0, Ns:0, R:0
    [LVP_TWS]Ctx:75, Vad:0, Ns:0, R:0 # 喊一声 “天猫精灵”
    v,0,1
    [LVP_TWS]Ctx:73, Vad:1, Ns:0, R:0
    [LVP_TWS]Ctx:75, Vad:1, Ns:0, R:0
    [LVP_TWS]Ctx:90, Vad:1, Ns:0, R:0
    [LVP_CTC] Activation ctx:91,Kws:tian mao jing ling[100],th:905,S:988,905 # 唤醒打印
    [LVP_TWS]Ctx:105, Vad:1, Ns:0, R:0
    [LVP_TWS]Ctx:120, Vad:1, Ns:0, R:0
    [LVP_TWS]Ctx:132, Vad:0, Ns:0, R:0
    [LVP_TWS]Ctx:135, Vad:0, Ns:0, R:0
    set mcu sleep # GX8002 进入待机