修改了串口读取的bug,现在是通过飞线控制的 PCA蓝牙IRQ拉低,修改灯的闪灯逻辑,
已修改13个文件
35369 ■■■■■ 文件已修改
keil/JLinkLog.txt 10409 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
keil/Listings/uwb_simple_example.map 7381 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
keil/Objects/uwb_simple_example.build_log.htm 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
keil/Objects/uwb_simple_example.hex 11554 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
keil/Objects/uwb_simple_example.htm 5766 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
keil/Objects/uwb_simple_example_MK8000 Release.dep 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
keil/include/drivers/Usart.c 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
keil/include/drivers/Usart.h 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
keil/include/drivers/serial_at_cmd_app.c 85 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
keil/include/drivers/serial_at_cmd_app.h 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
keil/include/main/main.c 58 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
keil/include/src/Radio/lora_1268.c 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
keil/uwb_simple_example.uvoptx 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
keil/JLinkLog.txt
ÎļþÌ«´ó
keil/Listings/uwb_simple_example.map
ÎļþÌ«´ó
keil/Objects/uwb_simple_example.build_log.htm
@@ -27,8 +27,14 @@
<h2>Output:</h2>
*** Using Compiler 'V6.14', folder: 'D:\keil\ARM\ARMCLANG\Bin'
Build Project 'uwb_simple_example' - Target 'MK8000 Release'
compiling main.c...
linking...
D:\zhangbo\2024\Code\ChinaUWB\3Shuanxing\ceshigujian\ChinaUWBProject-biaoqian-RX - BT-jinkoulora\keil\include\devices\MK800X\Source\ARM\MK800X_ac6_copy.sct(25): warning: L6314W: No section matches pattern *(.XIP_SECTION).
Program Size: Code=87800 RO-data=9012 RW-data=1784 ZI-data=28936
Finished: 0 information, 1 warning and 0 error messages.
FromELF: creating hex file...
After Build - User command #1: fromelf.exe --bincombined -o "Output\uwb_simple_example.bin" "D:\zhangbo\2024\Code\ChinaUWB\3Shuanxing\ceshigujian\ChinaUWBProject-biaoqian-RX - BT-jinkoulora\keil\Objects\uwb_simple_example.axf"
".\Objects\uwb_simple_example.axf" - 0 Error(s), 0 Warning(s).
".\Objects\uwb_simple_example.axf" - 0 Error(s), 1 Warning(s).
<h2>Software Packages used:</h2>
@@ -42,7 +48,7 @@
  D:\keil\pack\MKSEMI\MK800X_DFP\1.0.3\Device\Include
<h2>Collection of Component Files used:</h2>
Build Time Elapsed:  00:00:00
Build Time Elapsed:  00:00:01
</pre>
</body>
</html>
keil/Objects/uwb_simple_example.hex
ÎļþÌ«´ó
keil/Objects/uwb_simple_example.htm
ÎļþÌ«´ó
keil/Objects/uwb_simple_example_MK8000 Release.dep
@@ -558,7 +558,7 @@
I (..\keil\lora_3029.h)(0x67C6A898)
F (.\include\drivers\PCA9555.h)(0x68270C13)()
F (.\include\drivers\Usart1.c)(0x67C6A898)(-xc -std=c99 --target=arm-arm-none-eabi -mcpu=cortex-m0 -c -fno-rtti -funsigned-char -D__MICROLIB -gdwarf-3 -O0 -ffunction-sections -w -I ./include/board -I ../keil -I .. -I ./include/board -I ./include/CMSIS/Include -I ./include/components/algo/inc -I ./include/components/crc -I ./include/components/libc -I ./include/components/wsf/include -I ./include/components/wsf/include/platform -I ./include/devices/MK800X/Include -I ./include/drivers -I ./include/components/hido/Include -I ./include/components/internet/inc -I ./include/components/hal -I ../keil -I ./include/src -I ./include -I ./include/src/Radio -I ./include/src/SC7A22H_lib -Wno-declaration-after-statement -Wno-double-promotion -Wno-extra-semi-stmt -Wno-gnu-zero-variadic-macro-arguments -Wno-padded -Wno-unused-parameter -I./RTE/_MK8000_Release -ID:/keil/pack/MKSEMI/MK800X_DFP/1.0.3/Device/Include -ID:/keil/ARM/CMSIS/Include -D__UVISION_VERSION="530" -D_RTE_ -DUWB_EN -DSTD_LIBC -o ./objects/usart1.o -MD)
I (include\drivers\Usart.h)(0x67C6A898)
I (include\drivers\Usart.h)(0x682C4B3A)
I (D:\keil\ARM\ARMCLANG\include\stdint.h)(0x5DDFFD72)
I (include\drivers\Usart1.h)(0x67C6A898)
I (include\drivers\mk_dma.h)(0x67C6A898)
@@ -577,8 +577,8 @@
I (..\user_config.h)(0x68270C13)
I (include\drivers\mk_uart.h)(0x67C6A898)
I (D:\keil\ARM\ARMCLANG\include\stdio.h)(0x5DDFFD72)
F (.\include\drivers\Usart.c)(0x67C6A898)(-xc -std=c99 --target=arm-arm-none-eabi -mcpu=cortex-m0 -c -fno-rtti -funsigned-char -D__MICROLIB -gdwarf-3 -O0 -ffunction-sections -w -I ./include/board -I ../keil -I .. -I ./include/board -I ./include/CMSIS/Include -I ./include/components/algo/inc -I ./include/components/crc -I ./include/components/libc -I ./include/components/wsf/include -I ./include/components/wsf/include/platform -I ./include/devices/MK800X/Include -I ./include/drivers -I ./include/components/hido/Include -I ./include/components/internet/inc -I ./include/components/hal -I ../keil -I ./include/src -I ./include -I ./include/src/Radio -I ./include/src/SC7A22H_lib -Wno-declaration-after-statement -Wno-double-promotion -Wno-extra-semi-stmt -Wno-gnu-zero-variadic-macro-arguments -Wno-padded -Wno-unused-parameter -I./RTE/_MK8000_Release -ID:/keil/pack/MKSEMI/MK800X_DFP/1.0.3/Device/Include -ID:/keil/ARM/CMSIS/Include -D__UVISION_VERSION="530" -D_RTE_ -DUWB_EN -DSTD_LIBC -o ./objects/usart.o -MD)
I (include\drivers\Usart.h)(0x67C6A898)
F (.\include\drivers\Usart.c)(0x682D29DC)(-xc -std=c99 --target=arm-arm-none-eabi -mcpu=cortex-m0 -c -fno-rtti -funsigned-char -D__MICROLIB -gdwarf-3 -O0 -ffunction-sections -w -I ./include/board -I ../keil -I .. -I ./include/board -I ./include/CMSIS/Include -I ./include/components/algo/inc -I ./include/components/crc -I ./include/components/libc -I ./include/components/wsf/include -I ./include/components/wsf/include/platform -I ./include/devices/MK800X/Include -I ./include/drivers -I ./include/components/hido/Include -I ./include/components/internet/inc -I ./include/components/hal -I ../keil -I ./include/src -I ./include -I ./include/src/Radio -I ./include/src/SC7A22H_lib -Wno-declaration-after-statement -Wno-double-promotion -Wno-extra-semi-stmt -Wno-gnu-zero-variadic-macro-arguments -Wno-padded -Wno-unused-parameter -I./RTE/_MK8000_Release -ID:/keil/pack/MKSEMI/MK800X_DFP/1.0.3/Device/Include -ID:/keil/ARM/CMSIS/Include -D__UVISION_VERSION="530" -D_RTE_ -DUWB_EN -DSTD_LIBC -o ./objects/usart.o -MD)
I (include\drivers\Usart.h)(0x682C4B3A)
I (D:\keil\ARM\ARMCLANG\include\stdint.h)(0x5DDFFD72)
I (D:\keil\ARM\ARMCLANG\include\string.h)(0x5DDFFD6C)
I (D:\keil\ARM\ARMCLANG\include\stdio.h)(0x5DDFFD72)
@@ -672,13 +672,13 @@
I (include\drivers\mk_dma.h)(0x67C6A898)
I (include\drivers\mk_misc.h)(0x67C6A898)
I (include\drivers\mk_clock.h)(0x67C6A898)
F (.\include\drivers\serial_at_cmd_app.c)(0x68270C13)(-xc -std=c99 --target=arm-arm-none-eabi -mcpu=cortex-m0 -c -fno-rtti -funsigned-char -D__MICROLIB -gdwarf-3 -O0 -ffunction-sections -w -I ./include/drivers -I ./include/board -I ../keil -I .. -I ./include/board -I ./include/CMSIS/Include -I ./include/components/algo/inc -I ./include/components/crc -I ./include/components/libc -I ./include/components/wsf/include -I ./include/components/wsf/include/platform -I ./include/devices/MK800X/Include -I ./include/drivers -I ./include/components/hido/Include -I ./include/components/internet/inc -I ./include/components/hal -I ../keil -I ./include/src -I ./include -I ./include/src/Radio -I ./include/src/SC7A22H_lib -Wno-declaration-after-statement -Wno-double-promotion -Wno-extra-semi-stmt -Wno-gnu-zero-variadic-macro-arguments -Wno-padded -Wno-unused-parameter -I./RTE/_MK8000_Release -ID:/keil/pack/MKSEMI/MK800X_DFP/1.0.3/Device/Include -ID:/keil/ARM/CMSIS/Include -D__UVISION_VERSION="530" -D_RTE_ -DUWB_EN -DSTD_LIBC -o ./objects/serial_at_cmd_app.o -MD)
I (include\drivers\serial_at_cmd_app.h)(0x67C6A898)
F (.\include\drivers\serial_at_cmd_app.c)(0x682C54B5)(-xc -std=c99 --target=arm-arm-none-eabi -mcpu=cortex-m0 -c -fno-rtti -funsigned-char -D__MICROLIB -gdwarf-3 -O0 -ffunction-sections -w -I ./include/drivers -I ./include/board -I ../keil -I .. -I ./include/board -I ./include/CMSIS/Include -I ./include/components/algo/inc -I ./include/components/crc -I ./include/components/libc -I ./include/components/wsf/include -I ./include/components/wsf/include/platform -I ./include/devices/MK800X/Include -I ./include/drivers -I ./include/components/hido/Include -I ./include/components/internet/inc -I ./include/components/hal -I ../keil -I ./include/src -I ./include -I ./include/src/Radio -I ./include/src/SC7A22H_lib -Wno-declaration-after-statement -Wno-double-promotion -Wno-extra-semi-stmt -Wno-gnu-zero-variadic-macro-arguments -Wno-padded -Wno-unused-parameter -I./RTE/_MK8000_Release -ID:/keil/pack/MKSEMI/MK800X_DFP/1.0.3/Device/Include -ID:/keil/ARM/CMSIS/Include -D__UVISION_VERSION="530" -D_RTE_ -DUWB_EN -DSTD_LIBC -o ./objects/serial_at_cmd_app.o -MD)
I (include\drivers\serial_at_cmd_app.h)(0x682C48A4)
I (D:\keil\ARM\ARMCLANG\include\stdint.h)(0x5DDFFD72)
I (include\drivers\global_param.h)(0x67F742D0)
I (D:\keil\ARM\ARMCLANG\include\string.h)(0x5DDFFD6C)
I (D:\keil\ARM\ARMCLANG\include\stdio.h)(0x5DDFFD72)
I (include\drivers\Usart.h)(0x67C6A898)
I (include\drivers\Usart.h)(0x682C4B3A)
I (include\drivers\mk_flash.h)(0x67C6A898)
I (include\drivers\mk_common.h)(0x67C6A898)
I (D:\keil\ARM\ARMCLANG\include\stddef.h)(0x5DDFFD72)
@@ -755,9 +755,9 @@
I (include\drivers\mk_dma.h)(0x67C6A898)
I (D:\keil\ARM\ARMCLANG\include\stdarg.h)(0x5DDFFD72)
I (include\drivers\mk_gpio.h)(0x67C6A898)
I (include\drivers\Usart.h)(0x67C6A898)
I (include\drivers\Usart.h)(0x682C4B3A)
I (..\keil\lora_3029.h)(0x67C6A898)
F (.\include\main\main.c)(0x682C27F1)(-xc -std=c99 --target=arm-arm-none-eabi -mcpu=cortex-m0 -c -fno-rtti -funsigned-char -D__MICROLIB -gdwarf-3 -O0 -ffunction-sections -w -I ./include/board -I ../keil -I .. -I ./include/board -I ./include/CMSIS/Include -I ./include/components/algo/inc -I ./include/components/crc -I ./include/components/libc -I ./include/components/wsf/include -I ./include/components/wsf/include/platform -I ./include/devices/MK800X/Include -I ./include/drivers -I ./include/components/hido/Include -I ./include/components/internet/inc -I ./include/components/hal -I ../keil -I ./include/src -I ./include -I ./include/src/Radio -I ./include/src/SC7A22H_lib -Wno-declaration-after-statement -Wno-double-promotion -Wno-extra-semi-stmt -Wno-gnu-zero-variadic-macro-arguments -Wno-padded -Wno-unused-parameter -I./RTE/_MK8000_Release -ID:/keil/pack/MKSEMI/MK800X_DFP/1.0.3/Device/Include -ID:/keil/ARM/CMSIS/Include -D__UVISION_VERSION="530" -D_RTE_ -DUWB_EN -DSTD_LIBC -o ./objects/main.o -MD)
F (.\include\main\main.c)(0x682D7E23)(-xc -std=c99 --target=arm-arm-none-eabi -mcpu=cortex-m0 -c -fno-rtti -funsigned-char -D__MICROLIB -gdwarf-3 -O0 -ffunction-sections -w -I ./include/board -I ../keil -I .. -I ./include/board -I ./include/CMSIS/Include -I ./include/components/algo/inc -I ./include/components/crc -I ./include/components/libc -I ./include/components/wsf/include -I ./include/components/wsf/include/platform -I ./include/devices/MK800X/Include -I ./include/drivers -I ./include/components/hido/Include -I ./include/components/internet/inc -I ./include/components/hal -I ../keil -I ./include/src -I ./include -I ./include/src/Radio -I ./include/src/SC7A22H_lib -Wno-declaration-after-statement -Wno-double-promotion -Wno-extra-semi-stmt -Wno-gnu-zero-variadic-macro-arguments -Wno-padded -Wno-unused-parameter -I./RTE/_MK8000_Release -ID:/keil/pack/MKSEMI/MK800X_DFP/1.0.3/Device/Include -ID:/keil/ARM/CMSIS/Include -D__UVISION_VERSION="530" -D_RTE_ -DUWB_EN -DSTD_LIBC -o ./objects/main.o -MD)
I (include\drivers\mk_trace.h)(0x67C6A898)
I (include\drivers\mk_common.h)(0x67C6A898)
I (D:\keil\ARM\ARMCLANG\include\stddef.h)(0x5DDFFD72)
@@ -785,7 +785,7 @@
I (D:\keil\ARM\ARMCLANG\include\stdio.h)(0x5DDFFD72)
I (D:\keil\ARM\ARMCLANG\include\stdlib.h)(0x5DDFFD6A)
I (D:\keil\ARM\ARMCLANG\include\math.h)(0x5DDFFD6C)
I (include\drivers\serial_at_cmd_app.h)(0x67C6A898)
I (include\drivers\serial_at_cmd_app.h)(0x682C48A4)
I (include\drivers\global_param.h)(0x67F742D0)
I (include\board\board.h)(0x68270C13)
I (include\drivers\mk_gpio.h)(0x67C6A898)
@@ -793,7 +793,7 @@
I (include\components\wsf\include\wsf_nvm.h)(0x67C6A898)
I (include\components\wsf\include\wsf_types.h)(0x67C6A898)
I (include\drivers\mk_power.h)(0x67C6A898)
I (include\drivers\Usart.h)(0x67C6A898)
I (include\drivers\Usart.h)(0x682C4B3A)
I (include\drivers\mk_adc.h)(0x67C6A898)
I (include\drivers\mk_sleep_timer.h)(0x67C6A898)
I (include\drivers\lis3dh_driver.h)(0x68270C13)
@@ -1439,7 +1439,7 @@
I (include\devices\MK800X\Include\system_MK800X.h)(0x67C6A898)
I (..\user_config.h)(0x68270C13)
I (include\drivers\mk_dma.h)(0x67C6A898)
F (.\include\src\Radio\lora_1268.c)(0x682BEAF1)(-xc -std=c99 --target=arm-arm-none-eabi -mcpu=cortex-m0 -c -fno-rtti -funsigned-char -D__MICROLIB -gdwarf-3 -O0 -ffunction-sections -w -I .. -I ./include/board -I ./include/CMSIS/Include -I ./include/components/algo/inc -I ./include/components/crc -I ./include/components/libc -I ./include/components/wsf/include -I ./include/components/wsf/include/platform -I ./include/devices/MK800X/Include -I ./include/drivers -I ./include/components/hido/Include -I ./include/components/internet/inc -I ./include/components/hal -I ../keil -I ./include/src -I ./include -I ./include/src/Radio -I ./include/src/SC7A22H_lib -Wno-declaration-after-statement -Wno-double-promotion -Wno-extra-semi-stmt -Wno-gnu-zero-variadic-macro-arguments -Wno-padded -Wno-unused-parameter -I./RTE/_MK8000_Release -ID:/keil/pack/MKSEMI/MK800X_DFP/1.0.3/Device/Include -ID:/keil/ARM/CMSIS/Include -D__UVISION_VERSION="530" -D_RTE_ -DUWB_EN -DSTD_LIBC -o ./objects/lora_1268.o -MD)
F (.\include\src\Radio\lora_1268.c)(0x682D7B1B)(-xc -std=c99 --target=arm-arm-none-eabi -mcpu=cortex-m0 -c -fno-rtti -funsigned-char -D__MICROLIB -gdwarf-3 -O0 -ffunction-sections -w -I .. -I ./include/board -I ./include/CMSIS/Include -I ./include/components/algo/inc -I ./include/components/crc -I ./include/components/libc -I ./include/components/wsf/include -I ./include/components/wsf/include/platform -I ./include/devices/MK800X/Include -I ./include/drivers -I ./include/components/hido/Include -I ./include/components/internet/inc -I ./include/components/hal -I ../keil -I ./include/src -I ./include -I ./include/src/Radio -I ./include/src/SC7A22H_lib -Wno-declaration-after-statement -Wno-double-promotion -Wno-extra-semi-stmt -Wno-gnu-zero-variadic-macro-arguments -Wno-padded -Wno-unused-parameter -I./RTE/_MK8000_Release -ID:/keil/pack/MKSEMI/MK800X_DFP/1.0.3/Device/Include -ID:/keil/ARM/CMSIS/Include -D__UVISION_VERSION="530" -D_RTE_ -DUWB_EN -DSTD_LIBC -o ./objects/lora_1268.o -MD)
I (D:\keil\ARM\ARMCLANG\include\math.h)(0x5DDFFD6C)
I (D:\keil\ARM\ARMCLANG\include\string.h)(0x5DDFFD6C)
I (include\src\Radio\sx126x.h)(0x67C6A898)
keil/include/drivers/Usart.c
@@ -11,8 +11,10 @@
volatile int8_t m_EUART_TxFrm_Head = 0;                    //数据发送帧队列头指针
volatile int8_t m_EUART_TxFrm_FreeFrmLen = 0;            //数据发送帧队列剩余帧数
//DMA数据接收缓存
uint8_t m_EUART_DMA_RXBuf[EUART_RX_BUF_SIZE];            //DMA数据接收缓存
uint8_t m_EUART_DMA_RXBuf[EUART_RX_BUF_SIZE];            //DMA数据接收缓存   m_EUART_DMA_RXBuf_1
uint8_t m_EUART_DMA_RXBuf_1[USART_RX_BUF_SIZE];
volatile int32_t m_EUART_DMA_RXPtr = 0;                    //当前数据地址
volatile int32_t m_EUART_DMA_RXPtr_1 = 0;
//int16_t DMA_rxtemp = 0,DMA_rxtemp2 = 0;                                                            //当前数据地址缓存
//uint16_t datadelaycount = 0;                                                    //剩余1位数据延时等待处理
//标志变量
@@ -22,6 +24,7 @@
volatile uint8_t m_bEUARTTxEn = 0;                        //使能发送
void (*Usart1ParseDataCallback)(uint8_t);
void (*Usart0ParseDataCallback)(uint8_t);
void Usart1InitVariables(void)
{
    m_EUART_TxFrm_FreeFrmLen = EUART_TX_FRM_SIZE-1;
@@ -35,11 +38,12 @@
//uint16_t t1,t2,t3,t4;
uint16_t t3;
uint32_t cndtr=0;
void UART_CheckReceive(void)
{
      uint32_t cndtr=0;
    int32_t DMACnt = 0;
    int32_t MaxDataLen = EUART_RX_BUF_SIZE;
    int32_t MaxDataLen = USART_RX_BUF_SIZE;
    cndtr=get_uart1_dma_cndtr();
    //缺少check保护
    //如果正在往发送队列中添加数据,退出
@@ -54,17 +58,17 @@
        m_bEUARTCheckingRec = 0;
        return;
    }
    DMACnt = EUART_RX_BUF_SIZE - cndtr;
    while( m_EUART_DMA_RXPtr != DMACnt && MaxDataLen > 0)
    DMACnt = USART_RX_BUF_SIZE - cndtr;
    while( m_EUART_DMA_RXPtr_1 != DMACnt && MaxDataLen > 0)
    {
        Usart1ParseDataCallback(m_EUART_DMA_RXBuf[m_EUART_DMA_RXPtr]);
        Usart0ParseDataCallback(m_EUART_DMA_RXBuf_1[m_EUART_DMA_RXPtr_1]);
        //waitusart_timer = tag_frequency*USART_KEEPWAKE_TIME;
        m_EUART_DMA_RXPtr++;
        if( m_EUART_DMA_RXPtr >= EUART_RX_BUF_SIZE )
        m_EUART_DMA_RXPtr_1++;
        if( m_EUART_DMA_RXPtr_1 >= USART_RX_BUF_SIZE )
        {
            m_EUART_DMA_RXPtr = 0;
            m_EUART_DMA_RXPtr_1 = 0;
        }
        DMACnt = EUART_RX_BUF_SIZE - cndtr;
        DMACnt = USART_RX_BUF_SIZE - cndtr;
        MaxDataLen--;
    }
    m_bEUARTCheckingRec = 0;
@@ -73,9 +77,10 @@
void UART0_CheckReceive(void)
{
                int32_t DMACnt = 0;
                int32_t MaxDataLen = EUART_RX_BUF_SIZE;
                cndtr=get_uart0_dma_cndtr();
         uint32_t cndtr=0;
                 int32_t DMACnt = 0;
                 int32_t MaxDataLen = EUART_RX_BUF_SIZE;
                 cndtr=get_uart0_dma_cndtr();
                //缺少check保护
        //如果正在往发送队列中添加数据,退出
        if(m_bEUARTPushingFrms)
keil/include/drivers/Usart.h
@@ -56,12 +56,12 @@
void UART_PushFrame(uint8_t* pdata, int32_t data_len);
void UART_PopFrame(void);
extern void (*Usart1ParseDataCallback)(uint8_t);
extern void (*Usart0ParseDataCallback)(uint8_t);
#define USART_TX_BUF_SIZE    50                //发送缓存大小
#define USART_RX_BUF_SIZE    100                //接收缓存大小
#define USART_RX_BUF_SIZE    512                //接收缓存大小
extern uint8_t m_EUART_DMA_RXBuf[EUART_RX_BUF_SIZE];    
extern uint8_t USART_DMA_RXBuf[USART_RX_BUF_SIZE];            //USART2 DMA数据接收缓存
extern uint8_t m_EUART_DMA_RXBuf_1[USART_RX_BUF_SIZE];            //USART2 DMA数据接收缓存
//void Uart2_SendString(  uint8_t *str);
//extern  void Uart2_SendString(  uint8_t *str);
keil/include/drivers/serial_at_cmd_app.c
@@ -194,4 +194,89 @@
        }
        
}
void UsartParseDataHandler_1(uint8_t data)
{
     static UsartRecvPackState usart_receive_state = UsartReceiveWaitHead0;
   uint16_t checksum = 0;
   static uint8_t pack_datalen = 0,pack_length = 0,pack_index = 0,pack_msgtype = 0,pack_cmd = CMD_READ,pack_num=0;
   static uint8_t index = 0;
        if(usart_receive_state == UsartReceiveWaitChecksum)
        {   //若收到校验和包
            checksum = 0;
            for(int i = 0; i<pack_length-5; i++) {
                checksum += mUsart2ReceivePack[i];
            }
            checksum += pack_cmd;
            checksum += pack_length;
            checksum += pack_index;
            checksum += pack_datalen;
            checksum += pack_msgtype;
            if(((data + checksum)&0xff) == 0xFF)                //校验通过
            {
                switch(pack_cmd)
                {
                case CMD_WRITE:
                  if(pack_index==MODBUS_MODE*2)
                  {
//                      Uart1GpsRecDebugSend();
                      g_com_map[MODBUS_MODE] = 1;
                      return;
                  }
                    //从mUsartReceivePack中读取pack_length长度的字节,放到全局变量中,赋值保存的参数并且存入flash
                    memcpy((uint8_t*)&g_com_map + pack_index, mUsart2ReceivePack, pack_datalen);
                    if(mUsart2ReceivePack[0]==1)
                        UpdateProcess(pack_index);
                    //返回一个error状态
                    //SendComMap(pack_datalen,pack_index);
                    save_com_map_to_flash();
                    //delay_ms(100);
                    NVIC_SystemReset();
                    break;
                case CMD_READ:
                    //read包中data字节,即mUsartReceivePack[0]表示数据长度;
                    //从g_com_data结构体中的第index位置读取长度为mUsartReceivePack[0]的字节,发送出来
                    SendComMap(pack_datalen,pack_index>>1);
                    break;
                default:
                    break;
                }
            }
            usart_receive_state = UsartReceiveWaitHead0;
            pack_index = 0;
            pack_length = 0;
            index=0;
        } else if((usart_receive_state == UsartReceiveWaitData) ) {    //若果收到的是正常通讯包
            mUsart2ReceivePack[index] = data;
            index++;
            if(index == pack_length-5) {        //如果收到的index与长度相等
                usart_receive_state = UsartReceiveWaitChecksum;
            }
        } else if(usart_receive_state == UsartReceiveWaitDataLen) {                        //收到指令类型字节
            pack_datalen = data;
            usart_receive_state = UsartReceiveWaitData;
        } else if(usart_receive_state == UsartReceiveWaitIndex) {                        //收到指令类型字节
            pack_index = data;
            usart_receive_state = UsartReceiveWaitDataLen;
        } else if(usart_receive_state == UsartReceiveWaitCMD) {                            //收到指令类型字节
            pack_cmd = data;
            usart_receive_state = UsartReceiveWaitIndex;
        } else if(usart_receive_state == UsartReceiveWaitLength) {                        //收到长度字节
            pack_length = data;
            pack_index = 0;
            usart_receive_state = UsartReceiveWaitCMD;
        } else if((usart_receive_state == UsartReceiveWaitHead0) && (data == 0x55)) {    //收到第一个包头
            usart_receive_state = UsartReceiveWaitHead1;
        } else if((usart_receive_state == UsartReceiveWaitHead1) && (data == 0xAA)) {    //收到第二个包头
            usart_receive_state = UsartReceiveWaitMsgType;
        } else if ((usart_receive_state == UsartReceiveWaitMsgType) && (data == 0x3)) {
            usart_receive_state = UsartReceiveWaitLength;
            pack_msgtype = data;
        }
        else {
            usart_receive_state = UsartReceiveWaitHead0;
            pack_index = 0;
            pack_length = 0;
        }
 }
keil/include/drivers/serial_at_cmd_app.h
@@ -26,8 +26,7 @@
extern uint8_t mUsart2ReceivePack[150];
void UsartParseDataHandler(uint8_t data);
void Usart2ParseDataHandler(uint8_t data);
void UsartParseDataHandler_1(uint8_t data);
void UpdateProcess(uint8_t index);
#endif
keil/include/main/main.c
@@ -171,10 +171,10 @@
    .int_tx = false,
#endif
};
void uart_receive_callback(void *dev, uint32_t err_code)
{
    uart_receive(UART_ID1,m_EUART_DMA_RXBuf,EUART_RX_BUF_SIZE,uart_receive_callback);
}
//void uart_receive_callback(void *dev, uint32_t err_code)
//{
//    uart_receive(UART_ID1,m_EUART_DMA_RXBuf,EUART_RX_BUF_SIZE,uart_receive_callback);
//}
static void adc_callback(void *data, uint32_t number)
{
@@ -351,26 +351,19 @@
      {
       sleep_time++;
        }
        if(!read_5v_input_pca())
    {
       if(bat_percent>15)
        {
                    uint8_t state=0;
                    state=!state;
                    if(state==1)
                        GREEN_LED_ON;
                    else
            GREEN_LED_OFF;
              powerled=1;
        }
            else
                {
            powerled=0;
        }
        }
        }
        input5v_time=1;
    //马达震动逻辑
    if(g_com_map[MOTOR_ENABLE])
@@ -448,7 +441,11 @@
{
    uart_receive(UART_ID0,m_EUART_DMA_RXBuf,EUART_RX_BUF_SIZE,uart0_receive_callback);
}
void uart1_receive_callback()
{
    uart_receive(UART_ID1,m_EUART_DMA_RXBuf_1,USART_RX_BUF_SIZE,uart1_receive_callback);
}
static void voltage_input_handler(enum IO_PIN_T pin)
{
@@ -467,13 +464,14 @@
void Program_Init(void)
{
    Usart1ParseDataCallback = UsartParseDataHandler;//需改为默认为gps处理,UsartParseDataHandler为升级处理当调试时候改为
      Usart0ParseDataCallback = UsartParseDataHandler_1;
    parameter_init_anchor();//g_com_map表初始化角色默认为基站
    g_com_map[DEV_ID]=0x1234;
//    g_com_map[DEV_ID]=0x0721;
      g_com_map[STATIONARY_TIME] = 10;
//    g_com_map[GROUP_ID]=1;
    dev_id=g_com_map[DEV_ID];//这里不太对
    group_id=g_com_map[GROUP_ID];//组ID
      group_id=0x04;
//      group_id=0x04;
    tag_frequency = 1000/g_com_map[COM_INTERVAL];//测距频率这个存的是测距时间
    memcpy(&disoffset,&g_com_map[DIST_OFFSET],2);
//    g_com_map[ALARM_DISTANCE1] = 40;
@@ -499,7 +497,7 @@
    ip2 = (g_com_map[TCP_IP_2]>>12&0xf)*1000+(g_com_map[TCP_IP_2]>>8&0xf)*100+(g_com_map[TCP_IP_2]>>4&0xf)*10+(g_com_map[TCP_IP_2]&0xf);
    ip3 = (g_com_map[TCP_IP_3]>>12&0xf)*1000+(g_com_map[TCP_IP_3]>>8&0xf)*100+(g_com_map[TCP_IP_3]>>4&0xf)*10+(g_com_map[TCP_IP_3]&0xf);
    port = g_com_map[TCP_PORT];
    g_com_map[VERSION] = (1<<8)|12;
    g_com_map[VERSION] = (1<<8)|13;
    LOG_INFO(TRACE_MODULE_APP,"设备ID: %x .\r\n",dev_id);
    LOG_INFO(TRACE_MODULE_APP,"固件版本:BGK-mk+蓝牙薄工卡V%d.%d. \r\n",g_com_map[VERSION]>>8,g_com_map[VERSION]&0xff);
    LOG_INFO(TRACE_MODULE_APP,"服务器地址: %d.%d.%d.%d:%d.\r\n",ip0,ip1,ip2,ip3,port);
@@ -510,6 +508,7 @@
void IdleTask(void)
{    
 UART0_CheckReceive();
 UART_CheckReceive();
if(read_5v_input_pca())
    {
            chongman_time=0;
@@ -628,7 +627,7 @@
}
void IMUTask(void)
{
    if(nomove_count>g_com_map[NOMOVESLEEP_TIME]&&g_com_map[IMU_ENABLE]==2)
    if(nomove_count>g_com_map[NOMOVESLEEP_TIME]&&g_com_map[IMU_ENABLE]==1)
    {
        power_wakeup_enable((enum POWER_WAKEUP_SOURCE_T)PCA_INPUT_DETECT, POWER_WAKEUP_LEVEL_LOW);
        mcu_deep_sleep();
@@ -674,6 +673,7 @@
    io_pin_mux_set(UART1_TX, IO_FUNC4);
        
        board_debug_console_open(TRACE_PORT_UART1,BAUD_115200);
        uart_receive(UART_ID1,m_EUART_DMA_RXBuf_1,USART_RX_BUF_SIZE,uart1_receive_callback);//开启dma
}
void spi_init()
{
@@ -767,12 +767,11 @@
                            case UWB_OPEN_COUNT:
                                 CloseUWB();                         
                                   LoraReportPoll();
                   LEDTask(0,0,0,2);
                            break;
                            
                            case UWB_MEASUREMENT_INTERVAL:
                                  LEDTask(uwbled,btled,loraled,powerled);
                                  LEDTask(0,0,0,2);
                                      PCA9555_Set_One_Value_Output(IO_KONG,0);
                                  delay_us(10000);
                                  PCA9555_Set_One_Value_Output(IO_KONG,1);    
@@ -791,12 +790,13 @@
                            case UWB_OPEN_COUNT:
                                    CloseUWB();                                                   
                                  LoraReportPoll();
                                  LEDTask(0,0,0,2);
                            break;
                            
                            case UWB_MEASUREMENT_INTERVAL_SLEEP:
                                  LEDTask(uwbled,btled,loraled,powerled);
                                  LEDTask(0,0,0,2);
                                      PCA9555_Set_One_Value_Output(IO_KONG,0);
                                  delay_us(10000);
                                  PCA9555_Set_One_Value_Output(IO_KONG,1);    
@@ -840,19 +840,15 @@
    if(powerled==1)
    {
     GREEN_LED_ON;
     RED_LED_OFF;
    }
    else if(powerled==2)
    {
     RED_LED_OFF;
     GREEN_LED_OFF;
     GREEN_LED_OFF;;
    }
    else if(powerled==0)
    {
     RED_LED_ON;
     GREEN_LED_OFF;
     RED_LED_OFF;
    }
//    PCA9555_Set_One_Value_Output(BT_IRQ ,0); 
keil/include/src/Radio/lora_1268.c
@@ -158,7 +158,7 @@
    lora_sendbuffer[HB_LORAPOWER_IDX] = g_com_map[LORA_POWER];
    checksum = Checksum_u16(lora_sendbuffer,14);
    memcpy(&lora_sendbuffer[14],&checksum,2);    
//    Radio.Send(lora_sendbuffer,16);
    Radio.Send(lora_sendbuffer,16);
        
/*****************************心跳包上传内容*************************************/    
        
keil/uwb_simple_example.uvoptx
@@ -230,6 +230,21 @@
          <WinNumber>1</WinNumber>
          <ItemText>temp_count</ItemText>
        </Ww>
        <Ww>
          <count>16</count>
          <WinNumber>1</WinNumber>
          <ItemText>m_EUART_DMA_RXBuf_1</ItemText>
        </Ww>
        <Ww>
          <count>17</count>
          <WinNumber>1</WinNumber>
          <ItemText>mUsartReceivePack</ItemText>
        </Ww>
        <Ww>
          <count>18</count>
          <WinNumber>1</WinNumber>
          <ItemText>mUsart2ReceivePack</ItemText>
        </Ww>
      </WatchWindow1>
      <WatchWindow2>
        <Ww>
@@ -387,6 +402,31 @@
          <WinNumber>2</WinNumber>
          <ItemText>last_step_count</ItemText>
        </Ww>
        <Ww>
          <count>31</count>
          <WinNumber>2</WinNumber>
          <ItemText>mUsart2ReceivePack</ItemText>
        </Ww>
        <Ww>
          <count>32</count>
          <WinNumber>2</WinNumber>
          <ItemText>bat_percent,0x0A</ItemText>
        </Ww>
        <Ww>
          <count>33</count>
          <WinNumber>2</WinNumber>
          <ItemText>powerled</ItemText>
        </Ww>
        <Ww>
          <count>34</count>
          <WinNumber>2</WinNumber>
          <ItemText>chongman_time</ItemText>
        </Ww>
        <Ww>
          <count>35</count>
          <WinNumber>2</WinNumber>
          <ItemText>send_frame</ItemText>
        </Ww>
      </WatchWindow2>
      <MemoryWindow1>
        <Mm>
@@ -527,7 +567,7 @@
  <Group>
    <GroupName>Driver</GroupName>
    <tvExp>1</tvExp>
    <tvExp>0</tvExp>
    <tvExpOptDlg>0</tvExpOptDlg>
    <cbSel>0</cbSel>
    <RteFlg>0</RteFlg>