From f2450cdd1397d8a3fb07d21d40af23b825ed1073 Mon Sep 17 00:00:00 2001
From: yincheng.zhong <634916154@qq.com>
Date: 星期四, 09 十一月 2023 10:17:17 +0800
Subject: [PATCH] * V2.76 修改LDE 检测阈值,增加preamble length到1024.按照官方手册建议,抗遮挡和反射情况,配合对应基站程序使用

---
 Src/application/dw_app.c |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/Src/application/dw_app.c b/Src/application/dw_app.c
index 8bd6d61..f79fe87 100644
--- a/Src/application/dw_app.c
+++ b/Src/application/dw_app.c
@@ -92,14 +92,14 @@
 	5,
 #endif
 	DWT_PRF_64M,     /* Pulse repetition frequency. */
-	DWT_PLEN_128,    /* Preamble length. */
+	DWT_PLEN_1024,    /* Preamble length. */
 	DWT_PAC8,        /* Preamble acquisition chunk size. Used in RX only. */
 	9,               /* TX preamble code. Used in TX only. */
 	9,               /* RX preamble code. Used in RX only. */
 	1,               /* Use non-standard SFD (Boolean) */
 	DWT_BR_6M8,      /* Data rate. */
 	DWT_PHRMODE_STD, /* PHY header mode. */
-	(129 + 8 - 8)    /* SFD timeout (preamble length + 1 + SFD length - PAC size). Used in RX only. */
+	(1025 + 8 - 8)    /* SFD timeout (preamble length + 1 + SFD length - PAC size). Used in RX only. */
 };
 //static uint8_t tx_poll_msg[20] = {0};
 //static uint8_t tx_sync_msg[14] = {0};
@@ -175,7 +175,14 @@
 //        *ts += ts_field[i] << (i * 8);
 //    }
 //}
-
+void SetNLOSNTMSettings(void)
+{
+    uint8_t temp;
+    temp = 7;
+    dwt_writetodevice(LDE_IF_ID,LDE_CFG1_OFFSET,1,&temp);
+    dwt_write16bitoffsetreg(LDE_IF_ID,LDE_CFG2_OFFSET,3);
+    // NTM = dwt_read32bitoffsetreg(LDE_IF_ID,LDE_CFG1_OFFSET) & LDE_CFG1_NSTDEV_MASK;
+}
 void Dw1000_Init(void)
 {
 	/* Reset and initialise DW1000.
@@ -188,7 +195,7 @@
 
     /* Configure DW1000. See NOTE 6 below. */
     dwt_configure(&config);//配置DW1000
-	
+	SetNLOSNTMSettings();
 
 	
     /* Apply default antenna delay value. See NOTE 1 below. */

--
Gitblit v1.9.3