Warning: Class Joomla\Session\Handler\DatabaseHandler implementing SessionHandlerInterface is missing the create_sid() method which will be required in PHP 9.0 in /www/wwwroot/en.skytracksoft.com/libraries/vendor/joomla/session/src/Handler/DatabaseHandler.php on line 25

Warning: Class Joomla\Session\Handler\DatabaseHandler implementing SessionHandlerInterface is missing the validateId() method which will be required in PHP 9.0 in /www/wwwroot/en.skytracksoft.com/libraries/vendor/joomla/session/src/Handler/DatabaseHandler.php on line 25

Deprecated: session_set_save_handler(): Providing an object to argument #1 ($sessionhandler) which does not have the create_sid() method defined is deprecated in /www/wwwroot/en.skytracksoft.com/libraries/vendor/joomla/session/src/Storage/NativeStorage.php on line 342

Deprecated: session_set_save_handler(): Providing an object to argument #1 ($sessionhandler) which does not have the validateId() method defined is deprecated in /www/wwwroot/en.skytracksoft.com/libraries/vendor/joomla/session/src/Storage/NativeStorage.php on line 342

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 177

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 177

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 177

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 177

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 177

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 177

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224

Deprecated: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead in /www/wwwroot/en.skytracksoft.com/libraries/src/Plugin/PluginHelper.php on line 224
UWB RealTime Location System - Technology Share UWB Precise Location System Technology, and Selling Source Code & Schematic/PCB Diagram https://entest.autoop.net/technology.feed 2026-11-25T10:57:04+08:00 UWB HOME(en) Joomla! - Open Source Content Management How to implement UWB precise location system with TDOA technology(1) 2024-01-08T08:07:27+08:00 2024-01-08T08:07:27+08:00 https://entest.autoop.net/technology/howto-implement-tdoa-uwb-rtls-1.html zhang <div id="cnblogs_post_body" class="blogpost-body cnblogs-markdown"> <h2 id="前言">Preface</h2> <p>This is a series of articles that will introduce you to how to implement a UWB precise location system using TDOA technology.</p> <p>IMPORTANT NOTE:</p> <ul> <li>Q: Do I need basic knowledge to create this location system?</li> <li style="color: rgb(45, 194, 107);"><span style="color: rgb(45, 194, 107);">A: This article is not for beginners. It requires a basic knowledge of electronic technology and software programming.</span></li> <li>Q: Are your hardware/software open source?</li> <li style="color: rgb(45, 194, 107);"><span style="color: rgb(45, 194, 107);">A: It is not open source. <br>In the article, I will introduce how to implement the UWB location system and tell you how to overcome the difficulties, but I will not directly give you the Gerber file of the PCB to make a board, nor will I give you the source code of the software, nor will I give you the compiled firmware. <br>I'm not going to give you any direct results, I'm just telling you how.</span></li> <li>Q: I am personally very interested in UWB location. Can I make a location system?</li> <li style="color: rgb(45, 194, 107);"><span style="color: rgb(45, 194, 107);">A: If you have a strong hardware/software background and a lot of time, you can certainly do it. This article is just for you to read!</span></li> <li>Q: I am a commercial company and I want to develop the UWB location system into a commercial product.</li> <li style="color: rgb(45, 194, 107);"><span style="color: rgb(45, 194, 107);">A: Of course. This article is also written for you. If you want to build the entire system from zero, after reading my article, you only need to draw the circuit and make the board; conceive the software structure and then coding. <br>In this way, I will mention all the difficulties in the article and introduce the solutions. <span style="color: rgb(224, 62, 45);">You don't need to hire people to do algorithm research</span>. If you want to save trouble and time, you can directly purchase our circuit diagram (AD engineering files), purchase our software source code, and then quickly enter the production process. (Website: <a href="https://en.uwbhome.top/">https://uwbhome.top</a> )</span></li> </ul> <p>Starting in 2016, we started the UWB location project and officially stopped this project by the end of 2021. Now with the permission of the boss, it is decrypted. So I wrote out the entire project process.</p> <p>If you are interested in UWB location, after reading this series of articles, you should be able to implement a UWB location system by yourself.</p> <p>If you are using it commercially, it is recommended to purchase our technology (by the way, advertising, it is definitely cheaper than doing it yourself from scratch, mainly because it saves trouble and gets quick results, so we have been through the pitfalls you may fall into. <br>Website: <a href="https://en.uwbhome.top/">https: //uwbhome.top</a> ).</p> <p>In recent years, UWB has become very popular. It has been speculated for a long time, but it seems that it has not been widely used in daily life. <br>However, in some specific fields, applications are becoming more and more widespread, such as underground coal mine location/chemical production industry location, etc. These high-risk industries have seen the benefits of UWB, so they are being used more and more.</p> <p>I won't write much about the wireless features of UWB, as there are already too many introductions on the Internet.</p> <p> </p> <h2 id="uwb芯片">UWB Chip</h2> <p>Currently, the UWB chip of DecaWave Company in Ireland is widely used. I haven't paid attention to this field for a long time. I visited DecaWave's website some time ago and found that it has changed and become a department of Qorvo. <br>It is said that it was renamed Qorvo after being acquired by Apple.</p> <p>We use the DW1000 chip, which is really powerful. Let's not talk about its UWB related technologies. In terms of low power consumption, it is really amazing. We once had a development board. When I was testing low-power consumption, I accidentally set the chip to deep sleep. <br>No matter what I did, I found that the chip didn't respond. I thought the chip was broken, so I left it aside. But a few weeks later, I picked up the "bad" board and tested it, and suddenly found that the chip was good again. <br>It turns out that because there are several small capacitors on the template, although the power is cut off, the small capacitors are still supplying power to the chip, so the chip has been sleeping. <br>After a few weeks, the small capacitors ran out of power, and the chip was completely out of power. Power on and reset, the chip is normal again.</p> <p>The following are the technical data of DW1000:</p> <ul> <li>Supports 110 kbit/s, 850 kbit/s &amp; 6.8 Mbit/s data rates</li> <li>6 frequency bands supported with center frequencies from 3.5 GHz to 6.5 GHz<br>Transmit Power ?14 dBm or ?10 dBm<br>Transmit Power Density &lt; ?41.3dBm / MHz<br>Preamble Length 64 μs to 4 ms<br>Supports Packet Sizes up to 1023 bytes<br>Modulation: BPM with BPSK<br>Integrated FEC and CRC insertion and checking<br>SPI interface to host controller (20 MHz max)<br>Allows easy integration with wide range of μControllers<br>Single Supply Voltage 2.8 V to 3.6 V<br>Low Power Consumption<br>Transmit mode from 31 mA*<br>Receive mode from 64 mA*<br>2 μA watchdog timer mode<br>100 nA deep sleep mode<br>Media Access Techniques<br>FDMA: 6 channels<br>CDMA: 12 different channel codes<br>Supports both two way ranging and one way ranging, using Time of Flight (TOF) and time difference of arrival (TDOA) methods<br>Fabricated in 90 nm CMOS<br>Industrial temperature range -40°C to +85°C<br>6 mm x 6 mm 48 pin QFN package<br>Hardware &amp; software applications support material available from DecaWave</li> </ul> <p>DecaWave provides a lot of routines for DW1000, how to send UWB data packets, how to receive UWB data packets, and several TOF ranging codes. The development board trek1000 kit provided by DecaWave also provides the source code of a TOF location sample system. <br>Many stores selling DW1000 development boards on Taobao claim to provide source code, and they should provide these codes.</p> <p><img src="https://entest.autoop.net/images/technology/howto-Implement-tdoa-uwb-rtls-1/TREK1000.png" width="1065" height="502" loading="lazy" data-path="local-images:/technology/howto-Implement-tdoa-uwb-rtls-1/TREK1000.png"></p> <p><em>Official development board TREK1000 kit, with 4 boards</em></p> <p> </p> </div> <h2>Technical difficulty one: TDOA technology</h2> <p>What is TDOA? The full English name of TDOA is Time Difference of Arrival. In fact, the GPS/Beidou navigation we often use, and the location technology used by mobile phones (receiving terminals) is TDOA. <br>The GPS chip on the mobile phone calculates the location of the mobile phone based on the time difference of the received satellite signals. GPS/Beidou uses downlink TDOA location , which means that the terminal being positioned calculates its own coordinates.</p> <p>We use <strong>uplink TDOA location</strong>.</p> <p>What we have to do is different. The person or object being located carries a tag, and this tag continuously sends UWB signals. We will deploy some anchors (Anchors) in the location area, and these anchors will receive UWB signals sent by Tags. <br>We will have a computer running a software called a location engine (RTLE). The Anchor converts the received UWB signal into some network data and sends it to the location engine. The location engine calculates the coordinates of the tag based on these data packets.</p> <p>There are also companies in the industry that are doing UWB downlink TDOA location. If downlink TDOA is performed, the terminal is required to have relatively strong computing capabilities, which is also a test for the terminal's power consumption. <br>GPS systems have been released for so many years. They used to be very large. However, these systems have been used in more and more applications and have gradually become smaller. If you do UWB downlink TDOA location, there will be many difficulties.</p> <p>Regarding the mathematical principles of TDOA technology, there is already a lot of information on the Internet, so I will briefly mention it here.</p> <p>Assume that the UWB signal sent by a Tag is received by two Anchors. The two Anchors receive it at different times, and there is a time difference. UWB signals are radio waves, and the time they fly in the air is about the same as the speed of light. <br>This time difference can be converted into a distance difference, which is the difference between the distance between the Tag and the two Anchors. Based on this distance difference, we can draw a curve around the two Anchors. <br>The distance difference between all points on this curve and the two Anchors is equal to the aforementioned distance difference. This is half of the hyperbola.</p> <p>If there are 3 Anchors, the signal sent by Tag can get 3 time differences. Draw three curves. The intersection of these three curves is the coordinates of Tag. What the location engine has to do is to list a few equations, then solve the equations and get the coordinates.</p> <p>It's really simple in principle. The trouble lies in solving the equations. Because there will be factors such as interference/error during implementation, the intersection points of the three curves do not coincide. <br>What we need is to quickly calculate an approximation, as close as possible to the numerical intersection of the curves.</p> <p>When we first started working, we searched online and found many papers. The author of almost every paper will say how awesome my algorithm is, cite a lot of data to prove it, and write a bunch of mathematical formulas that people can't understand. <br>I will discuss TDOA technology in detail later when I introduce how to write a location engine.</p> <h2>Technical difficulty two: clock synchronization</h2> <p>Since time difference is used for location, each anchor must have the same time. If you have watched war movies, you should still have images. After the commander arranges the tasks of each unit, he will say, "We will launch the battle on time at 12 o'clock. <br>Let's check the watch." Yes, if everyone's watches are inconsistent, some watches have already passed 12 o'clock, and some watches have not yet reached 12 o'clock, it will be a mess.</p> <p>The time of each anchor is unified. <br>When receiving the UWB signal from the tag, the anchor will record the time it was received, and then each anchor will send this time to the location engine, and the location engine will calculate the coordinates based on the difference in these times.</p> <p>When we were doing technical research, we contacted Decawave. They had a wireless clock synchronization solution that cost more than 100,000 US dollars. It was not code, just a solution.</p> <p>Later, we came up with a solution and found that the wireless clock synchronization solution is actually very simple, it just depends on whether you can think of it.</p> <p>These two technical difficulties: TDOA algorithm and clock synchronization scheme were indeed difficult in 2016/2017. I guess there are many companies that want to do UWB location, but after research, they are blocked by these two obstacles. <br>As long as you are willing to study hard, these problems will always be solved. So now there are more and more companies doing UWB location.</p> <p>After you read this series of articles of mine, you will find that these two "difficulties" are actually not that difficult.</p> <h2>What is Our Goal</h2> <p>What do you get after all the fuss? In other words, what are we going to do?</p> <p>To put it simply, we are <strong>building a UWB precise location system using TDOA technology</strong>.</p> <p>The person or object being located carries a tag, which continuously sends UWB signals. We will deploy some anchors (Anchors) in the location area, and these anchors will receive UWB signals sent by Tags.</p> <p>We will have a computer running a software called a location engine (RTLE). The Anchor converts the received UWB signal into some network data and sends it to the location engine. The location engine calculates the coordinates of the tag based on these data packets.</p> <p>This process is the standard TDOA location process, which is very simple.</p> <p>In this process, there are two types of hardware involved: tags and anchors; the software involved are: tag firmware, anchor firmware, and location engines.</p> <p>Of course, the above is a simplified version. Commercial products should also have some other software:</p> <ul> <li>Tag configurator</li> <li>Anchor configuration program</li> <li>Location engine manager</li> </ul> <p>For example, if we need to change the channel for UWB communication, do we need to recompile the tag firmware and anchor hardware and then flash them to the board? Wouldn't it be more convenient if you use a configuration program to set the channel parameters?</p> <p>Also, we want to add a new function to the firmware. Do we need to remove the board, connect the JTag and re-flash the firmware? Wouldn't it be more convenient to upgrade the firmware directly over the Internet?</p> <p>The location process is also more complicated in real environments. Usually, the maximum communication range of UWB chip DW1000 is 200 meters to 300 meters. What if the area we want to target is large? Generally, multiple small areas are divided into one large area. <br>Therefore, the location engine must support multi-region location.</p> <h2>Hardware Design and Selection</h2> <p>In terms of hardware, what we need to do is two things: tags and anchors.</p> <p>The most important components in hardware selection are the two components: UWB chip and MCU.</p> <p>We use DW1000 for UWB chip. Anyone who plays electronics knows that the design of radio frequency circuits has always been difficult. Therefore, analog electrical engineers are more valuable than digital electrical engineers, and the older they are, the more valuable they are. <br>Therefore, we do not use the DW1000 chip directly, but use the module <strong>DWM1000</strong>. The original factory packages the DW1000 into a module, so we don't have to worry about the radio frequency part. The module has a set of SPI interfaces, and we can happily connect it to the GPIO of the MCU.</p> <figure class="image align-center" data-immersive-translate-walked="e542162e-6dae-4162-a691-c1379cb461fe"><img src="https://entest.autoop.net/images/technology/howto-Implement-tdoa-uwb-rtls-1/DWM1000-1.png" alt="DWM1000" width="787" height="400" loading="lazy" data-path="local-images:/technology/howto-Implement-tdoa-uwb-rtls-1/DWM1000-1.png" data-immersive-translate-walked="e542162e-6dae-4162-a691-c1379cb461fe"> <figcaption>DWM1000 looks like this</figcaption> </figure> <p><img style="display: block; margin-left: auto; margin-right: auto;" src="https://entest.autoop.net/images/technology/howto-Implement-tdoa-uwb-rtls-1/DWM1000-Pin-Diagram.png" width="559" height="654" loading="lazy" data-path="local-images:/technology/howto-Implement-tdoa-uwb-rtls-1/DWM1000-Pin-Diagram.png"><br> </p> <figure class="image align-center" data-immersive-translate-walked="e542162e-6dae-4162-a691-c1379cb461fe"><img src="https://entest.autoop.net/images/technology/howto-Implement-tdoa-uwb-rtls-1/DWM1000.png" alt="DWM1000" width="664" height="803" loading="lazy" data-path="local-images:/technology/howto-Implement-tdoa-uwb-rtls-1/DWM1000.png" data-immersive-translate-walked="e542162e-6dae-4162-a691-c1379cb461fe"> <figcaption>Our actual shot of DWM1000</figcaption> </figure> <p> </p> <p>MCU selection. The main control MCU we use is  the <strong>STM32F103 </strong>series. This series of chips was very popular a few years ago. If I were to choose now, I would definitely choose ESP32. ESP32 is cheap, has good performance, and is highly scalable. Around 2020, we suffered from the price increase of ST's chips. <br>The normal price of the STM32F103RET6 we use for location anchors is only about 14 yuan, and the highest price rises to about 500 yuan, which is higher than the shipping price of our anchors. It's crazy.</p> <p>Because STM32F103 was used before, the introduction of this article also uses it as an example. If you use ESP32, there is still a lot of detailed work to be done. For example, ESP32 has WIFI and Bluetooth, which involves how to configure the network. <br>ESP32 can also add an additional chip to create a wired Ethernet connection, which involves wired and wireless dual connections. There will be two IP addresses in the network, and there are many details to consider. <br>So let's not consider the ESP32 for now, and let's just use the STM32F103.</p> <p>Whether it is a anchor or a tag, because the DWM1000 module is used, the hardware design is mainly the digital circuit part, which is a typical circuit, and there is basically no difficulty.</p> <h2>Anchor Hardware Design</h2> <p>The anchor will have more functions and has higher requirements for RAM and Flash, so the MCU chooses STM32F103RET6.</p> <p>In addition, you need to connect to the network. The network interface chip uses W5500. This chip also uses the SPI interface to connect to the MCU. I have used the W5500 in several projects before and am familiar with it, so I chose it. <br>Of course, if you choose other familiar network interface chips, that's no problem.</p> <p>For the power supply part, if you are doing experiments by yourself, you can directly use DC12V or DC5V. We use POE power supply in our products. The POE power receiving chip uses TI's TPS23753A, and uses an isolated design to protect the anchor circuit.</p> <p>In fact, our initial version used DC 12V power supply, and I have always wanted to use POE power supply. I drew several versions of the circuit and made several samples, but I still couldn't get the POE right. <br>Later, our team expanded and added a guy who specialized in hardware, and he finally solved POE.</p> <figure class="image align-center" data-immersive-translate-walked="e542162e-6dae-4162-a691-c1379cb461fe"><img src="https://entest.autoop.net/images/technology/howto-Implement-tdoa-uwb-rtls-1/Anchor-no-poe.png" width="600" height="631" loading="lazy" data-path="local-images:/technology/howto-Implement-tdoa-uwb-rtls-1/Anchor-no-poe.png" data-immersive-translate-walked="e542162e-6dae-4162-a691-c1379cb461fe"> <figcaption>The first mass-produced anchor, using 12V power supply</figcaption> </figure> <figure class="image align-center" data-immersive-translate-walked="e542162e-6dae-4162-a691-c1379cb461fe"><img src="https://entest.autoop.net/images/technology/howto-Implement-tdoa-uwb-rtls-1/Anchor-no-poe-sch.png" alt="Anchor circuit diagram" width="2386" height="1709" loading="lazy" data-path="local-images:/technology/howto-Implement-tdoa-uwb-rtls-1/Anchor-no-poe-sch.png" data-immersive-translate-walked="e542162e-6dae-4162-a691-c1379cb461fe"> <figcaption>Anchor circuit diagram</figcaption> </figure> <p>Below are photos of the finished anchor</p> <figure class="image" data-immersive-translate-walked="e542162e-6dae-4162-a691-c1379cb461fe"><img src="https://entest.autoop.net/images/technology/howto-Implement-tdoa-uwb-rtls-1/Anchor-no-poe-1.png" alt="RTLS Anchor PCBA" width="1389" height="1196" loading="lazy" data-path="local-images:/technology/howto-Implement-tdoa-uwb-rtls-1/Anchor-no-poe-1.png" data-immersive-translate-walked="e542162e-6dae-4162-a691-c1379cb461fe"> <figcaption>This is the PCBA corresponding to the circuit diagram above</figcaption> </figure> <figure class="image align-center" data-immersive-translate-walked="e542162e-6dae-4162-a691-c1379cb461fe"><img src="https://entest.autoop.net/images/technology/howto-Implement-tdoa-uwb-rtls-1/Anchor-no-poe-2.png" alt="RTLS Anchor PCBA" width="1559" height="1161" loading="lazy" data-path="local-images:/technology/howto-Implement-tdoa-uwb-rtls-1/Anchor-no-poe-2.png" data-immersive-translate-walked="e542162e-6dae-4162-a691-c1379cb461fe"> <figcaption>RTLS Anchor PCBA</figcaption> </figure> <p> </p> <figure class="image align-center" data-immersive-translate-walked="e542162e-6dae-4162-a691-c1379cb461fe"><img src="https://entest.autoop.net/images/technology/howto-Implement-tdoa-uwb-rtls-1/Anchor-no-poe-3.png" alt="RTLS Anchor PCBA" width="1380" height="1214" loading="lazy" data-path="local-images:/technology/howto-Implement-tdoa-uwb-rtls-1/Anchor-no-poe-3.png" data-immersive-translate-walked="e542162e-6dae-4162-a691-c1379cb461fe"> <figcaption>RTLS Anchor PCBA</figcaption> </figure> <p> </p> <figure class="image align-center" data-immersive-translate-walked="e542162e-6dae-4162-a691-c1379cb461fe"><img src="https://entest.autoop.net/images/technology/howto-Implement-tdoa-uwb-rtls-1/Anchor-no-poe-4.png" alt="This anchor is trying to connect to WIFI and adds a WIFI module." width="2084" height="1573" loading="lazy" data-path="local-images:/technology/howto-Implement-tdoa-uwb-rtls-1/Anchor-no-poe-4.png" data-immersive-translate-walked="e542162e-6dae-4162-a691-c1379cb461fe"> <figcaption>This anchor is trying to connect to WIFI and adds a WIFI module.</figcaption> </figure> <p> </p> <figure class="image" data-immersive-translate-walked="e542162e-6dae-4162-a691-c1379cb461fe"><img src="https://entest.autoop.net/images/technology/howto-Implement-tdoa-uwb-rtls-1/Anchor-no-poe-5.png" alt="This photo shows how to open the anchor casing. It is just right to compare the size of the human hand and the casing." width="1298" height="1182" loading="lazy" data-path="local-images:/technology/howto-Implement-tdoa-uwb-rtls-1/Anchor-no-poe-5.png" data-immersive-translate-walked="e542162e-6dae-4162-a691-c1379cb461fe"> <figcaption>This photo shows how to open the anchor casing. It is just right to compare the size of the human hand and the casing.</figcaption> </figure> <p><br>Please forgive me, I can't upload the AD project file of the anchor circuit, so I have to keep it for selling it. But I have included a high-definition picture of the anchor circuit, and you can draw a copy yourself.</p> <p>A 24C64 is used in the circuit in order to preserve the anchor configuration. Later, the firmware used Flash to simulate EEPROM, and the 24C64 was cancelled.</p> <p>If you are doing DIY, you don't need to make the board very small. <strong>The casing is a must! DW1000 and crystal oscillator are very sensitive to temperature. We have tested that if someone passes by the bare board without a casing, it will cause the DW1000 clock to change greatly.</strong></p> <p>Here is another photo of our latest version of the mass-produced anchor for everyone to appreciate. It is powered by POE, has dual network ports, and integrates a network switch chip. Multiple anchors can be cascaded hand in hand.</p> <figure class="image align-center" data-immersive-translate-walked="e542162e-6dae-4162-a691-c1379cb461fe"><img src="https://entest.autoop.net/images/technology/howto-Implement-tdoa-uwb-rtls-1/Anchor-poe-d2.png" alt="Dual network port anchor, POE power supply and reception, integrated switch chip, can be cascaded" width="1296" height="1065" loading="lazy" data-path="local-images:/technology/howto-Implement-tdoa-uwb-rtls-1/Anchor-poe-d2.png" data-immersive-translate-walked="e542162e-6dae-4162-a691-c1379cb461fe"> <figcaption>Dual network port anchor, POE power supply and reception, integrated switch chip, can be cascaded</figcaption> </figure> <p><br>With this level of integration of the anchor, it can only be mounted by machine. If welded by hand, it is a very difficult job.</p> <h2>Tag Hardware Design</h2> <p>We use the name-card style tags, which can be used in a wider range of applications. In fact, many end users use name-card style tags, and the response during use is good.</p> <p>The tag's MCU uses STM32F103CBT6, which has a smaller chip area and smaller RAM and Flash. In fact, we wanted to use STM32F10C8T6 at first, but later we found that Flash was too small. <br>Because we want to support online firmware upgrades, the Flash must be at least twice as large as the firmware, because in addition to the running firmware, space must be left for the newly uploaded firmware. Also leave some space for configuration parameters.</p> <p>The tag uses an 800mah lithium polymer battery for power supply, and the charging chip uses TP4057. This charging chip is cheap and has a simple interface. Because of this, it is not a complete battery management chip, it only charges, and it charges in LDO mode. <br>During the charging process, the input DC 5V is converted into the 3.5V~4.2V required by the battery, and the energy between these two voltage differences becomes heat. <br>If the charging current is designed to be too large, it will be very hot; if the charging current is small, the charging time will be very long.</p> <p>Later, I wanted to switch to a DC-DC charging chip, but the project was stopped, so I forgot about it. If a DC-DC charging chip is used, the heat generation will be much smaller, we can design the charging current to be larger, and charging will take much less time. <br>But the cost will increase a bit, and a large inductor may need to be added.</p> <p>We also designed a wireless charging function. If you are just playing with it alone, you don't need to do this part. Wireless charging uses TI's BQ51013 chip. This chip supports the QI wireless charging standard.</p> <p>With multiple uses in mind, tags add some small features:</p> <ul> <li>Photoresistor, used to detect ambient light brightness</li> <li>MPU6050 three-dimensional accelerometer</li> <li>Voltage divider resistor detects battery voltage</li> </ul> <p>The driver of the MPU6050 was not ready, and other functions of the firmware were greatly affected, so we blocked it during mass production. Due to insufficient manpower and too many things to do, MPU6050 never had time to tinker with. <br>In the end, it was simply not attached and left empty on the board.</p> <p>The voltage divider resistor detects the battery voltage and can roughly understand the remaining power. If possible, it is best to install a power detection chip. There should be a suitable power management chip now, a chip that integrates charging/discharging/power management. <br>At the beginning, in order to save power, we used 1M ohm voltage dividing resistors. Later, we found that this was not possible because there were discrete errors. Some boards can measure accurately, and some boards have large errors. <br>Because the ADC internal resistance of STM32 is not very large. Later we changed it to 100K euros and this problem was solved.</p> <p>In the design of tags, low power consumption needs to be considered in many aspects, so as to save power consumption as much as possible and make the tag's standby time longer.</p> <figure class="image align-center" data-immersive-translate-walked="e542162e-6dae-4162-a691-c1379cb461fe"><img src="https://entest.autoop.net/images/technology/howto-Implement-tdoa-uwb-rtls-1/tag-sch.png" alt="RTLS Tag's Schematic Diagram" width="2388" height="1711" loading="lazy" data-path="local-images:/technology/howto-Implement-tdoa-uwb-rtls-1/tag-sch.png" data-immersive-translate-walked="e542162e-6dae-4162-a691-c1379cb461fe"> <figcaption>RTLS Tag's Schematic Diagram</figcaption> </figure> <p><br><br></p> <figure class="image align-center" data-immersive-translate-walked="e542162e-6dae-4162-a691-c1379cb461fe"><img src="https://entest.autoop.net/images/technology/howto-Implement-tdoa-uwb-rtls-1/tag-pcb-2d-face.png" alt="RTLS Tag PCB 2D" width="2675" height="1644" loading="lazy" data-path="local-images:/technology/howto-Implement-tdoa-uwb-rtls-1/tag-pcb-2d-face.png" data-immersive-translate-walked="e542162e-6dae-4162-a691-c1379cb461fe"> <figcaption>RTLS Tag PCB 2D</figcaption> </figure> <figure class="image align-center" data-immersive-translate-walked="e542162e-6dae-4162-a691-c1379cb461fe"><img src="https://entest.autoop.net/images/technology/howto-Implement-tdoa-uwb-rtls-1/tag-pcb-3d.png" alt="RTLS Tag's PCB 3D" width="2603" height="1515" loading="lazy" data-path="local-images:/technology/howto-Implement-tdoa-uwb-rtls-1/tag-pcb-3d.png" data-immersive-translate-walked="e542162e-6dae-4162-a691-c1379cb461fe"> <figcaption>RTLS Tag's PCB 3D</figcaption> </figure> <figure class="image align-center" data-immersive-translate-walked="e542162e-6dae-4162-a691-c1379cb461fe"><img src="https://entest.autoop.net/images/technology/howto-Implement-tdoa-uwb-rtls-1/tag-pcba.png" alt="Tag PCBA physical photos" width="1293" height="754" loading="lazy" data-path="local-images:/technology/howto-Implement-tdoa-uwb-rtls-1/tag-pcba.png" data-immersive-translate-walked="e542162e-6dae-4162-a691-c1379cb461fe"> <figcaption>Tag PCBA physical photos</figcaption> </figure> <figure class="image align-center" data-immersive-translate-walked="e542162e-6dae-4162-a691-c1379cb461fe"><img src="https://entest.autoop.net/images/technology/howto-Implement-tdoa-uwb-rtls-1/tag-lower-power-1.png" alt="The minimum power consumption of the tag reaches 13.3uA" width="1373" height="866" loading="lazy" data-path="local-images:/technology/howto-Implement-tdoa-uwb-rtls-1/tag-lower-power-1.png" data-immersive-translate-walked="e542162e-6dae-4162-a691-c1379cb461fe"> <figcaption>The minimum power consumption of the tag reaches 13.3uA</figcaption> </figure> <figure class="image align-center" data-immersive-translate-walked="e542162e-6dae-4162-a691-c1379cb461fe"><img src="https://entest.autoop.net/images/technology/howto-Implement-tdoa-uwb-rtls-1/tag-low-power-2.jpg" alt="Use an oscilloscope to monitor the tag's current" width="800" height="600" loading="lazy" data-path="local-images:/technology/howto-Implement-tdoa-uwb-rtls-1/tag-low-power-2.jpg" data-immersive-translate-walked="e542162e-6dae-4162-a691-c1379cb461fe"> <figcaption>Use an oscilloscope to monitor the tag's current</figcaption> </figure> <p>The lowest power consumption of the tag reaches 13.3uA, which is the current when the tag is in sleep state. We also used an oscilloscope to view the current draw during tag operation. <br>From the photos, you can clearly see several working processes of the tag: first it is in a sleep state, then the MCU wakes up and the current increases, the DW1000 wakes up and the current increases again, transmits UWB data packets (short time/high current), and sleeps again.</p> <p>Here, the time between DW1000 waking up and launching is a bit long, which is waiting for DW1000 to enter a stable working state. It should be possible to shorten this wait and save some power.</p> <p>It is also worth mentioning that because the name-card style tag is very thin, in order to save space, the DWM1000 is welded from the back. If you solder from the front, the PCBA should be higher.</p> <p><img src="https://entest.autoop.net/images/technology/howto-Implement-tdoa-uwb-rtls-1/tag-pcba-2.png" width="948" height="1665" loading="lazy" data-path="local-images:/technology/howto-Implement-tdoa-uwb-rtls-1/tag-pcba-2.png"></p> <p><img src="https://entest.autoop.net/images/technology/howto-Implement-tdoa-uwb-rtls-1/tag-pcba-3.png" width="929" height="1648" loading="lazy" data-path="local-images:/technology/howto-Implement-tdoa-uwb-rtls-1/tag-pcba-3.png"></p> <p><img src="https://entest.autoop.net/images/technology/howto-Implement-tdoa-uwb-rtls-1/tag-pcba-4.png" width="976" height="1602" loading="lazy" data-path="local-images:/technology/howto-Implement-tdoa-uwb-rtls-1/tag-pcba-4.png"></p> <p>Our name-card style tag has been revised dozens of times, and each time there will be some slight differences, but the basic circuit remains the same. These photos are for your reference.</p> <p>The tag can also be made into a bracelet style.</p> <p><img src="https://entest.autoop.net/images/technology/howto-Implement-tdoa-uwb-rtls-1/tag-watch-pcba-1.png" width="1175" height="1646" loading="lazy" data-path="local-images:/technology/howto-Implement-tdoa-uwb-rtls-1/tag-watch-pcba-1.png"></p> <p><img src="https://entest.autoop.net/images/technology/howto-Implement-tdoa-uwb-rtls-1/tag-watch-pcba-2.png" width="1130" height="1706" loading="lazy" data-path="local-images:/technology/howto-Implement-tdoa-uwb-rtls-1/tag-watch-pcba-2.png"></p> <p><img src="https://entest.autoop.net/images/technology/howto-Implement-tdoa-uwb-rtls-1/tag-watch-pcba-3.png" width="2483" height="1630" loading="lazy" data-path="local-images:/technology/howto-Implement-tdoa-uwb-rtls-1/tag-watch-pcba-3.png"></p> <p><img src="https://entest.autoop.net/images/technology/howto-Implement-tdoa-uwb-rtls-1/tag-watch-pcba-4.png" width="1440" height="463" loading="lazy" data-path="local-images:/technology/howto-Implement-tdoa-uwb-rtls-1/tag-watch-pcba-4.png"></p> <p>We give customers OEM tags and install them on the car.</p> <p>Anyway, the basic circuit is still the same. Therefore, after the firmware is written, it is basically compatible. One firmware is compatible with the tags of all models.</p> <p>A customer wants to make a bracelet tag with a display. He plans to add OLED to display the time and some received messages, and also add a vibration motor. After some research, I found that STM32F103 is not enough. <br>To display messages, there must be Chinese characters, and then a Chinese character library must be obtained. The small Flash of STM32 will definitely not be able to fit it. The large Flash version of STM32 is difficult to buy and expensive. <br>I plan to use ESP32 as an MCU, and I can also add WiFi and Bluetooth support. Later, the client's project was stopped, and later, our project was also stopped, and we stopped working on it.</p> <p>If you are using it commercially, it is recommended to use ESP32 as the MCU. It is best to replace the MCU of the anchor/tag with ESP32. In this way, they can be unified and the code can be reused. ESP32 is cheap and performs well, which is really a good thing.</p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="bS3qUOJ3"><em style="box-sizing: border-box;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">This website is our home base, and this series of articles will be updated from time to time. </span><span style="box-sizing: border-box; vertical-align: inherit;">In addition to this site, this series of articles is also published on </span></span><a style="box-sizing: border-box; color: var(--link-color); text-decoration: underline;" href="https://translate.google.com/website?sl=en&amp;tl=zh-CN&amp;hl=zh-CN&amp;client=webapp&amp;u=https://www.zhihu.com/column/c_1725823226259939328" target="_blank" rel="noopener"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Zhihu</span></span></a><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;"> , </span></span><a style="box-sizing: border-box; color: var(--link-color); text-decoration: underline;" href="https://translate.google.com/website?sl=en&amp;tl=zh-CN&amp;hl=zh-CN&amp;client=webapp&amp;u=https://www.cnblogs.com/bd8ncf/" target="_blank" rel="noopener"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">cnBlogs</span></span></a><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;"> , </span></span><a style="box-sizing: border-box; color: var(--link-color); text-decoration: underline;" href="https://translate.google.com/website?sl=en&amp;tl=zh-CN&amp;hl=zh-CN&amp;client=webapp&amp;u=https://blog.csdn.net/weixin_43986679?type%3Dblog" target="_blank" rel="noopener"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">CSDN</span></span></a><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;"> and other websites.</span></span></em></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><em style="box-sizing: border-box;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">By the way, I'm looking for a job. Due to business reasons, the company was dissolved. I have 30+ years of work experience, 20+ years of experience in C/C++/Java/Delphi, and a little bit of Javascript/Python/Lua. <br>In 199x, I wrote a Chinese character system in x86 assembly, and later used Delphi to write a mail server. I have written countless application systems, and the code I have written should exceed 2 million lines. <br>10+ years of hardware design experience, designing multiple embedded products. In the early stages of this UWB location system, the hardware and software were all developed by me alone, and the team was only built later. Base Guiyang, China, or remotely. <br>If there are job opportunities, please contact me (bd8ncf@gmail.com) for a detailed resume.</span></span></em></p> <div id="cnblogs_post_body" class="blogpost-body cnblogs-markdown"> <h2 id="前言">Preface</h2> <p>This is a series of articles that will introduce you to how to implement a UWB precise location system using TDOA technology.</p> <p>IMPORTANT NOTE:</p> <ul> <li>Q: Do I need basic knowledge to create this location system?</li> <li style="color: rgb(45, 194, 107);"><span style="color: rgb(45, 194, 107);">A: This article is not for beginners. It requires a basic knowledge of electronic technology and software programming.</span></li> <li>Q: Are your hardware/software open source?</li> <li style="color: rgb(45, 194, 107);"><span style="color: rgb(45, 194, 107);">A: It is not open source. <br>In the article, I will introduce how to implement the UWB location system and tell you how to overcome the difficulties, but I will not directly give you the Gerber file of the PCB to make a board, nor will I give you the source code of the software, nor will I give you the compiled firmware. <br>I'm not going to give you any direct results, I'm just telling you how.</span></li> <li>Q: I am personally very interested in UWB location. Can I make a location system?</li> <li style="color: rgb(45, 194, 107);"><span style="color: rgb(45, 194, 107);">A: If you have a strong hardware/software background and a lot of time, you can certainly do it. This article is just for you to read!</span></li> <li>Q: I am a commercial company and I want to develop the UWB location system into a commercial product.</li> <li style="color: rgb(45, 194, 107);"><span style="color: rgb(45, 194, 107);">A: Of course. This article is also written for you. If you want to build the entire system from zero, after reading my article, you only need to draw the circuit and make the board; conceive the software structure and then coding. <br>In this way, I will mention all the difficulties in the article and introduce the solutions. <span style="color: rgb(224, 62, 45);">You don't need to hire people to do algorithm research</span>. If you want to save trouble and time, you can directly purchase our circuit diagram (AD engineering files), purchase our software source code, and then quickly enter the production process. (Website: <a href="https://en.uwbhome.top/">https://uwbhome.top</a> )</span></li> </ul> <p>Starting in 2016, we started the UWB location project and officially stopped this project by the end of 2021. Now with the permission of the boss, it is decrypted. So I wrote out the entire project process.</p> <p>If you are interested in UWB location, after reading this series of articles, you should be able to implement a UWB location system by yourself.</p> <p>If you are using it commercially, it is recommended to purchase our technology (by the way, advertising, it is definitely cheaper than doing it yourself from scratch, mainly because it saves trouble and gets quick results, so we have been through the pitfalls you may fall into. <br>Website: <a href="https://en.uwbhome.top/">https: //uwbhome.top</a> ).</p> <p>In recent years, UWB has become very popular. It has been speculated for a long time, but it seems that it has not been widely used in daily life. <br>However, in some specific fields, applications are becoming more and more widespread, such as underground coal mine location/chemical production industry location, etc. These high-risk industries have seen the benefits of UWB, so they are being used more and more.</p> <p>I won't write much about the wireless features of UWB, as there are already too many introductions on the Internet.</p> <p> </p> <h2 id="uwb芯片">UWB Chip</h2> <p>Currently, the UWB chip of DecaWave Company in Ireland is widely used. I haven't paid attention to this field for a long time. I visited DecaWave's website some time ago and found that it has changed and become a department of Qorvo. <br>It is said that it was renamed Qorvo after being acquired by Apple.</p> <p>We use the DW1000 chip, which is really powerful. Let's not talk about its UWB related technologies. In terms of low power consumption, it is really amazing. We once had a development board. When I was testing low-power consumption, I accidentally set the chip to deep sleep. <br>No matter what I did, I found that the chip didn't respond. I thought the chip was broken, so I left it aside. But a few weeks later, I picked up the "bad" board and tested it, and suddenly found that the chip was good again. <br>It turns out that because there are several small capacitors on the template, although the power is cut off, the small capacitors are still supplying power to the chip, so the chip has been sleeping. <br>After a few weeks, the small capacitors ran out of power, and the chip was completely out of power. Power on and reset, the chip is normal again.</p> <p>The following are the technical data of DW1000:</p> <ul> <li>Supports 110 kbit/s, 850 kbit/s &amp; 6.8 Mbit/s data rates</li> <li>6 frequency bands supported with center frequencies from 3.5 GHz to 6.5 GHz<br>Transmit Power ?14 dBm or ?10 dBm<br>Transmit Power Density &lt; ?41.3dBm / MHz<br>Preamble Length 64 μs to 4 ms<br>Supports Packet Sizes up to 1023 bytes<br>Modulation: BPM with BPSK<br>Integrated FEC and CRC insertion and checking<br>SPI interface to host controller (20 MHz max)<br>Allows easy integration with wide range of μControllers<br>Single Supply Voltage 2.8 V to 3.6 V<br>Low Power Consumption<br>Transmit mode from 31 mA*<br>Receive mode from 64 mA*<br>2 μA watchdog timer mode<br>100 nA deep sleep mode<br>Media Access Techniques<br>FDMA: 6 channels<br>CDMA: 12 different channel codes<br>Supports both two way ranging and one way ranging, using Time of Flight (TOF) and time difference of arrival (TDOA) methods<br>Fabricated in 90 nm CMOS<br>Industrial temperature range -40°C to +85°C<br>6 mm x 6 mm 48 pin QFN package<br>Hardware &amp; software applications support material available from DecaWave</li> </ul> <p>DecaWave provides a lot of routines for DW1000, how to send UWB data packets, how to receive UWB data packets, and several TOF ranging codes. The development board trek1000 kit provided by DecaWave also provides the source code of a TOF location sample system. <br>Many stores selling DW1000 development boards on Taobao claim to provide source code, and they should provide these codes.</p> <p><img src="https://entest.autoop.net/images/technology/howto-Implement-tdoa-uwb-rtls-1/TREK1000.png" width="1065" height="502" loading="lazy" data-path="local-images:/technology/howto-Implement-tdoa-uwb-rtls-1/TREK1000.png"></p> <p><em>Official development board TREK1000 kit, with 4 boards</em></p> <p> </p> </div> <h2>Technical difficulty one: TDOA technology</h2> <p>What is TDOA? The full English name of TDOA is Time Difference of Arrival. In fact, the GPS/Beidou navigation we often use, and the location technology used by mobile phones (receiving terminals) is TDOA. <br>The GPS chip on the mobile phone calculates the location of the mobile phone based on the time difference of the received satellite signals. GPS/Beidou uses downlink TDOA location , which means that the terminal being positioned calculates its own coordinates.</p> <p>We use <strong>uplink TDOA location</strong>.</p> <p>What we have to do is different. The person or object being located carries a tag, and this tag continuously sends UWB signals. We will deploy some anchors (Anchors) in the location area, and these anchors will receive UWB signals sent by Tags. <br>We will have a computer running a software called a location engine (RTLE). The Anchor converts the received UWB signal into some network data and sends it to the location engine. The location engine calculates the coordinates of the tag based on these data packets.</p> <p>There are also companies in the industry that are doing UWB downlink TDOA location. If downlink TDOA is performed, the terminal is required to have relatively strong computing capabilities, which is also a test for the terminal's power consumption. <br>GPS systems have been released for so many years. They used to be very large. However, these systems have been used in more and more applications and have gradually become smaller. If you do UWB downlink TDOA location, there will be many difficulties.</p> <p>Regarding the mathematical principles of TDOA technology, there is already a lot of information on the Internet, so I will briefly mention it here.</p> <p>Assume that the UWB signal sent by a Tag is received by two Anchors. The two Anchors receive it at different times, and there is a time difference. UWB signals are radio waves, and the time they fly in the air is about the same as the speed of light. <br>This time difference can be converted into a distance difference, which is the difference between the distance between the Tag and the two Anchors. Based on this distance difference, we can draw a curve around the two Anchors. <br>The distance difference between all points on this curve and the two Anchors is equal to the aforementioned distance difference. This is half of the hyperbola.</p> <p>If there are 3 Anchors, the signal sent by Tag can get 3 time differences. Draw three curves. The intersection of these three curves is the coordinates of Tag. What the location engine has to do is to list a few equations, then solve the equations and get the coordinates.</p> <p>It's really simple in principle. The trouble lies in solving the equations. Because there will be factors such as interference/error during implementation, the intersection points of the three curves do not coincide. <br>What we need is to quickly calculate an approximation, as close as possible to the numerical intersection of the curves.</p> <p>When we first started working, we searched online and found many papers. The author of almost every paper will say how awesome my algorithm is, cite a lot of data to prove it, and write a bunch of mathematical formulas that people can't understand. <br>I will discuss TDOA technology in detail later when I introduce how to write a location engine.</p> <h2>Technical difficulty two: clock synchronization</h2> <p>Since time difference is used for location, each anchor must have the same time. If you have watched war movies, you should still have images. After the commander arranges the tasks of each unit, he will say, "We will launch the battle on time at 12 o'clock. <br>Let's check the watch." Yes, if everyone's watches are inconsistent, some watches have already passed 12 o'clock, and some watches have not yet reached 12 o'clock, it will be a mess.</p> <p>The time of each anchor is unified. <br>When receiving the UWB signal from the tag, the anchor will record the time it was received, and then each anchor will send this time to the location engine, and the location engine will calculate the coordinates based on the difference in these times.</p> <p>When we were doing technical research, we contacted Decawave. They had a wireless clock synchronization solution that cost more than 100,000 US dollars. It was not code, just a solution.</p> <p>Later, we came up with a solution and found that the wireless clock synchronization solution is actually very simple, it just depends on whether you can think of it.</p> <p>These two technical difficulties: TDOA algorithm and clock synchronization scheme were indeed difficult in 2016/2017. I guess there are many companies that want to do UWB location, but after research, they are blocked by these two obstacles. <br>As long as you are willing to study hard, these problems will always be solved. So now there are more and more companies doing UWB location.</p> <p>After you read this series of articles of mine, you will find that these two "difficulties" are actually not that difficult.</p> <h2>What is Our Goal</h2> <p>What do you get after all the fuss? In other words, what are we going to do?</p> <p>To put it simply, we are <strong>building a UWB precise location system using TDOA technology</strong>.</p> <p>The person or object being located carries a tag, which continuously sends UWB signals. We will deploy some anchors (Anchors) in the location area, and these anchors will receive UWB signals sent by Tags.</p> <p>We will have a computer running a software called a location engine (RTLE). The Anchor converts the received UWB signal into some network data and sends it to the location engine. The location engine calculates the coordinates of the tag based on these data packets.</p> <p>This process is the standard TDOA location process, which is very simple.</p> <p>In this process, there are two types of hardware involved: tags and anchors; the software involved are: tag firmware, anchor firmware, and location engines.</p> <p>Of course, the above is a simplified version. Commercial products should also have some other software:</p> <ul> <li>Tag configurator</li> <li>Anchor configuration program</li> <li>Location engine manager</li> </ul> <p>For example, if we need to change the channel for UWB communication, do we need to recompile the tag firmware and anchor hardware and then flash them to the board? Wouldn't it be more convenient if you use a configuration program to set the channel parameters?</p> <p>Also, we want to add a new function to the firmware. Do we need to remove the board, connect the JTag and re-flash the firmware? Wouldn't it be more convenient to upgrade the firmware directly over the Internet?</p> <p>The location process is also more complicated in real environments. Usually, the maximum communication range of UWB chip DW1000 is 200 meters to 300 meters. What if the area we want to target is large? Generally, multiple small areas are divided into one large area. <br>Therefore, the location engine must support multi-region location.</p> <h2>Hardware Design and Selection</h2> <p>In terms of hardware, what we need to do is two things: tags and anchors.</p> <p>The most important components in hardware selection are the two components: UWB chip and MCU.</p> <p>We use DW1000 for UWB chip. Anyone who plays electronics knows that the design of radio frequency circuits has always been difficult. Therefore, analog electrical engineers are more valuable than digital electrical engineers, and the older they are, the more valuable they are. <br>Therefore, we do not use the DW1000 chip directly, but use the module <strong>DWM1000</strong>. The original factory packages the DW1000 into a module, so we don't have to worry about the radio frequency part. The module has a set of SPI interfaces, and we can happily connect it to the GPIO of the MCU.</p> <figure class="image align-center" data-immersive-translate-walked="e542162e-6dae-4162-a691-c1379cb461fe"><img src="https://entest.autoop.net/images/technology/howto-Implement-tdoa-uwb-rtls-1/DWM1000-1.png" alt="DWM1000" width="787" height="400" loading="lazy" data-path="local-images:/technology/howto-Implement-tdoa-uwb-rtls-1/DWM1000-1.png" data-immersive-translate-walked="e542162e-6dae-4162-a691-c1379cb461fe"> <figcaption>DWM1000 looks like this</figcaption> </figure> <p><img style="display: block; margin-left: auto; margin-right: auto;" src="https://entest.autoop.net/images/technology/howto-Implement-tdoa-uwb-rtls-1/DWM1000-Pin-Diagram.png" width="559" height="654" loading="lazy" data-path="local-images:/technology/howto-Implement-tdoa-uwb-rtls-1/DWM1000-Pin-Diagram.png"><br> </p> <figure class="image align-center" data-immersive-translate-walked="e542162e-6dae-4162-a691-c1379cb461fe"><img src="https://entest.autoop.net/images/technology/howto-Implement-tdoa-uwb-rtls-1/DWM1000.png" alt="DWM1000" width="664" height="803" loading="lazy" data-path="local-images:/technology/howto-Implement-tdoa-uwb-rtls-1/DWM1000.png" data-immersive-translate-walked="e542162e-6dae-4162-a691-c1379cb461fe"> <figcaption>Our actual shot of DWM1000</figcaption> </figure> <p> </p> <p>MCU selection. The main control MCU we use is  the <strong>STM32F103 </strong>series. This series of chips was very popular a few years ago. If I were to choose now, I would definitely choose ESP32. ESP32 is cheap, has good performance, and is highly scalable. Around 2020, we suffered from the price increase of ST's chips. <br>The normal price of the STM32F103RET6 we use for location anchors is only about 14 yuan, and the highest price rises to about 500 yuan, which is higher than the shipping price of our anchors. It's crazy.</p> <p>Because STM32F103 was used before, the introduction of this article also uses it as an example. If you use ESP32, there is still a lot of detailed work to be done. For example, ESP32 has WIFI and Bluetooth, which involves how to configure the network. <br>ESP32 can also add an additional chip to create a wired Ethernet connection, which involves wired and wireless dual connections. There will be two IP addresses in the network, and there are many details to consider. <br>So let's not consider the ESP32 for now, and let's just use the STM32F103.</p> <p>Whether it is a anchor or a tag, because the DWM1000 module is used, the hardware design is mainly the digital circuit part, which is a typical circuit, and there is basically no difficulty.</p> <h2>Anchor Hardware Design</h2> <p>The anchor will have more functions and has higher requirements for RAM and Flash, so the MCU chooses STM32F103RET6.</p> <p>In addition, you need to connect to the network. The network interface chip uses W5500. This chip also uses the SPI interface to connect to the MCU. I have used the W5500 in several projects before and am familiar with it, so I chose it. <br>Of course, if you choose other familiar network interface chips, that's no problem.</p> <p>For the power supply part, if you are doing experiments by yourself, you can directly use DC12V or DC5V. We use POE power supply in our products. The POE power receiving chip uses TI's TPS23753A, and uses an isolated design to protect the anchor circuit.</p> <p>In fact, our initial version used DC 12V power supply, and I have always wanted to use POE power supply. I drew several versions of the circuit and made several samples, but I still couldn't get the POE right. <br>Later, our team expanded and added a guy who specialized in hardware, and he finally solved POE.</p> <figure class="image align-center" data-immersive-translate-walked="e542162e-6dae-4162-a691-c1379cb461fe"><img src="https://entest.autoop.net/images/technology/howto-Implement-tdoa-uwb-rtls-1/Anchor-no-poe.png" width="600" height="631" loading="lazy" data-path="local-images:/technology/howto-Implement-tdoa-uwb-rtls-1/Anchor-no-poe.png" data-immersive-translate-walked="e542162e-6dae-4162-a691-c1379cb461fe"> <figcaption>The first mass-produced anchor, using 12V power supply</figcaption> </figure> <figure class="image align-center" data-immersive-translate-walked="e542162e-6dae-4162-a691-c1379cb461fe"><img src="https://entest.autoop.net/images/technology/howto-Implement-tdoa-uwb-rtls-1/Anchor-no-poe-sch.png" alt="Anchor circuit diagram" width="2386" height="1709" loading="lazy" data-path="local-images:/technology/howto-Implement-tdoa-uwb-rtls-1/Anchor-no-poe-sch.png" data-immersive-translate-walked="e542162e-6dae-4162-a691-c1379cb461fe"> <figcaption>Anchor circuit diagram</figcaption> </figure> <p>Below are photos of the finished anchor</p> <figure class="image" data-immersive-translate-walked="e542162e-6dae-4162-a691-c1379cb461fe"><img src="https://entest.autoop.net/images/technology/howto-Implement-tdoa-uwb-rtls-1/Anchor-no-poe-1.png" alt="RTLS Anchor PCBA" width="1389" height="1196" loading="lazy" data-path="local-images:/technology/howto-Implement-tdoa-uwb-rtls-1/Anchor-no-poe-1.png" data-immersive-translate-walked="e542162e-6dae-4162-a691-c1379cb461fe"> <figcaption>This is the PCBA corresponding to the circuit diagram above</figcaption> </figure> <figure class="image align-center" data-immersive-translate-walked="e542162e-6dae-4162-a691-c1379cb461fe"><img src="https://entest.autoop.net/images/technology/howto-Implement-tdoa-uwb-rtls-1/Anchor-no-poe-2.png" alt="RTLS Anchor PCBA" width="1559" height="1161" loading="lazy" data-path="local-images:/technology/howto-Implement-tdoa-uwb-rtls-1/Anchor-no-poe-2.png" data-immersive-translate-walked="e542162e-6dae-4162-a691-c1379cb461fe"> <figcaption>RTLS Anchor PCBA</figcaption> </figure> <p> </p> <figure class="image align-center" data-immersive-translate-walked="e542162e-6dae-4162-a691-c1379cb461fe"><img src="https://entest.autoop.net/images/technology/howto-Implement-tdoa-uwb-rtls-1/Anchor-no-poe-3.png" alt="RTLS Anchor PCBA" width="1380" height="1214" loading="lazy" data-path="local-images:/technology/howto-Implement-tdoa-uwb-rtls-1/Anchor-no-poe-3.png" data-immersive-translate-walked="e542162e-6dae-4162-a691-c1379cb461fe"> <figcaption>RTLS Anchor PCBA</figcaption> </figure> <p> </p> <figure class="image align-center" data-immersive-translate-walked="e542162e-6dae-4162-a691-c1379cb461fe"><img src="https://entest.autoop.net/images/technology/howto-Implement-tdoa-uwb-rtls-1/Anchor-no-poe-4.png" alt="This anchor is trying to connect to WIFI and adds a WIFI module." width="2084" height="1573" loading="lazy" data-path="local-images:/technology/howto-Implement-tdoa-uwb-rtls-1/Anchor-no-poe-4.png" data-immersive-translate-walked="e542162e-6dae-4162-a691-c1379cb461fe"> <figcaption>This anchor is trying to connect to WIFI and adds a WIFI module.</figcaption> </figure> <p> </p> <figure class="image" data-immersive-translate-walked="e542162e-6dae-4162-a691-c1379cb461fe"><img src="https://entest.autoop.net/images/technology/howto-Implement-tdoa-uwb-rtls-1/Anchor-no-poe-5.png" alt="This photo shows how to open the anchor casing. It is just right to compare the size of the human hand and the casing." width="1298" height="1182" loading="lazy" data-path="local-images:/technology/howto-Implement-tdoa-uwb-rtls-1/Anchor-no-poe-5.png" data-immersive-translate-walked="e542162e-6dae-4162-a691-c1379cb461fe"> <figcaption>This photo shows how to open the anchor casing. It is just right to compare the size of the human hand and the casing.</figcaption> </figure> <p><br>Please forgive me, I can't upload the AD project file of the anchor circuit, so I have to keep it for selling it. But I have included a high-definition picture of the anchor circuit, and you can draw a copy yourself.</p> <p>A 24C64 is used in the circuit in order to preserve the anchor configuration. Later, the firmware used Flash to simulate EEPROM, and the 24C64 was cancelled.</p> <p>If you are doing DIY, you don't need to make the board very small. <strong>The casing is a must! DW1000 and crystal oscillator are very sensitive to temperature. We have tested that if someone passes by the bare board without a casing, it will cause the DW1000 clock to change greatly.</strong></p> <p>Here is another photo of our latest version of the mass-produced anchor for everyone to appreciate. It is powered by POE, has dual network ports, and integrates a network switch chip. Multiple anchors can be cascaded hand in hand.</p> <figure class="image align-center" data-immersive-translate-walked="e542162e-6dae-4162-a691-c1379cb461fe"><img src="https://entest.autoop.net/images/technology/howto-Implement-tdoa-uwb-rtls-1/Anchor-poe-d2.png" alt="Dual network port anchor, POE power supply and reception, integrated switch chip, can be cascaded" width="1296" height="1065" loading="lazy" data-path="local-images:/technology/howto-Implement-tdoa-uwb-rtls-1/Anchor-poe-d2.png" data-immersive-translate-walked="e542162e-6dae-4162-a691-c1379cb461fe"> <figcaption>Dual network port anchor, POE power supply and reception, integrated switch chip, can be cascaded</figcaption> </figure> <p><br>With this level of integration of the anchor, it can only be mounted by machine. If welded by hand, it is a very difficult job.</p> <h2>Tag Hardware Design</h2> <p>We use the name-card style tags, which can be used in a wider range of applications. In fact, many end users use name-card style tags, and the response during use is good.</p> <p>The tag's MCU uses STM32F103CBT6, which has a smaller chip area and smaller RAM and Flash. In fact, we wanted to use STM32F10C8T6 at first, but later we found that Flash was too small. <br>Because we want to support online firmware upgrades, the Flash must be at least twice as large as the firmware, because in addition to the running firmware, space must be left for the newly uploaded firmware. Also leave some space for configuration parameters.</p> <p>The tag uses an 800mah lithium polymer battery for power supply, and the charging chip uses TP4057. This charging chip is cheap and has a simple interface. Because of this, it is not a complete battery management chip, it only charges, and it charges in LDO mode. <br>During the charging process, the input DC 5V is converted into the 3.5V~4.2V required by the battery, and the energy between these two voltage differences becomes heat. <br>If the charging current is designed to be too large, it will be very hot; if the charging current is small, the charging time will be very long.</p> <p>Later, I wanted to switch to a DC-DC charging chip, but the project was stopped, so I forgot about it. If a DC-DC charging chip is used, the heat generation will be much smaller, we can design the charging current to be larger, and charging will take much less time. <br>But the cost will increase a bit, and a large inductor may need to be added.</p> <p>We also designed a wireless charging function. If you are just playing with it alone, you don't need to do this part. Wireless charging uses TI's BQ51013 chip. This chip supports the QI wireless charging standard.</p> <p>With multiple uses in mind, tags add some small features:</p> <ul> <li>Photoresistor, used to detect ambient light brightness</li> <li>MPU6050 three-dimensional accelerometer</li> <li>Voltage divider resistor detects battery voltage</li> </ul> <p>The driver of the MPU6050 was not ready, and other functions of the firmware were greatly affected, so we blocked it during mass production. Due to insufficient manpower and too many things to do, MPU6050 never had time to tinker with. <br>In the end, it was simply not attached and left empty on the board.</p> <p>The voltage divider resistor detects the battery voltage and can roughly understand the remaining power. If possible, it is best to install a power detection chip. There should be a suitable power management chip now, a chip that integrates charging/discharging/power management. <br>At the beginning, in order to save power, we used 1M ohm voltage dividing resistors. Later, we found that this was not possible because there were discrete errors. Some boards can measure accurately, and some boards have large errors. <br>Because the ADC internal resistance of STM32 is not very large. Later we changed it to 100K euros and this problem was solved.</p> <p>In the design of tags, low power consumption needs to be considered in many aspects, so as to save power consumption as much as possible and make the tag's standby time longer.</p> <figure class="image align-center" data-immersive-translate-walked="e542162e-6dae-4162-a691-c1379cb461fe"><img src="https://entest.autoop.net/images/technology/howto-Implement-tdoa-uwb-rtls-1/tag-sch.png" alt="RTLS Tag's Schematic Diagram" width="2388" height="1711" loading="lazy" data-path="local-images:/technology/howto-Implement-tdoa-uwb-rtls-1/tag-sch.png" data-immersive-translate-walked="e542162e-6dae-4162-a691-c1379cb461fe"> <figcaption>RTLS Tag's Schematic Diagram</figcaption> </figure> <p><br><br></p> <figure class="image align-center" data-immersive-translate-walked="e542162e-6dae-4162-a691-c1379cb461fe"><img src="https://entest.autoop.net/images/technology/howto-Implement-tdoa-uwb-rtls-1/tag-pcb-2d-face.png" alt="RTLS Tag PCB 2D" width="2675" height="1644" loading="lazy" data-path="local-images:/technology/howto-Implement-tdoa-uwb-rtls-1/tag-pcb-2d-face.png" data-immersive-translate-walked="e542162e-6dae-4162-a691-c1379cb461fe"> <figcaption>RTLS Tag PCB 2D</figcaption> </figure> <figure class="image align-center" data-immersive-translate-walked="e542162e-6dae-4162-a691-c1379cb461fe"><img src="https://entest.autoop.net/images/technology/howto-Implement-tdoa-uwb-rtls-1/tag-pcb-3d.png" alt="RTLS Tag's PCB 3D" width="2603" height="1515" loading="lazy" data-path="local-images:/technology/howto-Implement-tdoa-uwb-rtls-1/tag-pcb-3d.png" data-immersive-translate-walked="e542162e-6dae-4162-a691-c1379cb461fe"> <figcaption>RTLS Tag's PCB 3D</figcaption> </figure> <figure class="image align-center" data-immersive-translate-walked="e542162e-6dae-4162-a691-c1379cb461fe"><img src="https://entest.autoop.net/images/technology/howto-Implement-tdoa-uwb-rtls-1/tag-pcba.png" alt="Tag PCBA physical photos" width="1293" height="754" loading="lazy" data-path="local-images:/technology/howto-Implement-tdoa-uwb-rtls-1/tag-pcba.png" data-immersive-translate-walked="e542162e-6dae-4162-a691-c1379cb461fe"> <figcaption>Tag PCBA physical photos</figcaption> </figure> <figure class="image align-center" data-immersive-translate-walked="e542162e-6dae-4162-a691-c1379cb461fe"><img src="https://entest.autoop.net/images/technology/howto-Implement-tdoa-uwb-rtls-1/tag-lower-power-1.png" alt="The minimum power consumption of the tag reaches 13.3uA" width="1373" height="866" loading="lazy" data-path="local-images:/technology/howto-Implement-tdoa-uwb-rtls-1/tag-lower-power-1.png" data-immersive-translate-walked="e542162e-6dae-4162-a691-c1379cb461fe"> <figcaption>The minimum power consumption of the tag reaches 13.3uA</figcaption> </figure> <figure class="image align-center" data-immersive-translate-walked="e542162e-6dae-4162-a691-c1379cb461fe"><img src="https://entest.autoop.net/images/technology/howto-Implement-tdoa-uwb-rtls-1/tag-low-power-2.jpg" alt="Use an oscilloscope to monitor the tag's current" width="800" height="600" loading="lazy" data-path="local-images:/technology/howto-Implement-tdoa-uwb-rtls-1/tag-low-power-2.jpg" data-immersive-translate-walked="e542162e-6dae-4162-a691-c1379cb461fe"> <figcaption>Use an oscilloscope to monitor the tag's current</figcaption> </figure> <p>The lowest power consumption of the tag reaches 13.3uA, which is the current when the tag is in sleep state. We also used an oscilloscope to view the current draw during tag operation. <br>From the photos, you can clearly see several working processes of the tag: first it is in a sleep state, then the MCU wakes up and the current increases, the DW1000 wakes up and the current increases again, transmits UWB data packets (short time/high current), and sleeps again.</p> <p>Here, the time between DW1000 waking up and launching is a bit long, which is waiting for DW1000 to enter a stable working state. It should be possible to shorten this wait and save some power.</p> <p>It is also worth mentioning that because the name-card style tag is very thin, in order to save space, the DWM1000 is welded from the back. If you solder from the front, the PCBA should be higher.</p> <p><img src="https://entest.autoop.net/images/technology/howto-Implement-tdoa-uwb-rtls-1/tag-pcba-2.png" width="948" height="1665" loading="lazy" data-path="local-images:/technology/howto-Implement-tdoa-uwb-rtls-1/tag-pcba-2.png"></p> <p><img src="https://entest.autoop.net/images/technology/howto-Implement-tdoa-uwb-rtls-1/tag-pcba-3.png" width="929" height="1648" loading="lazy" data-path="local-images:/technology/howto-Implement-tdoa-uwb-rtls-1/tag-pcba-3.png"></p> <p><img src="https://entest.autoop.net/images/technology/howto-Implement-tdoa-uwb-rtls-1/tag-pcba-4.png" width="976" height="1602" loading="lazy" data-path="local-images:/technology/howto-Implement-tdoa-uwb-rtls-1/tag-pcba-4.png"></p> <p>Our name-card style tag has been revised dozens of times, and each time there will be some slight differences, but the basic circuit remains the same. These photos are for your reference.</p> <p>The tag can also be made into a bracelet style.</p> <p><img src="https://entest.autoop.net/images/technology/howto-Implement-tdoa-uwb-rtls-1/tag-watch-pcba-1.png" width="1175" height="1646" loading="lazy" data-path="local-images:/technology/howto-Implement-tdoa-uwb-rtls-1/tag-watch-pcba-1.png"></p> <p><img src="https://entest.autoop.net/images/technology/howto-Implement-tdoa-uwb-rtls-1/tag-watch-pcba-2.png" width="1130" height="1706" loading="lazy" data-path="local-images:/technology/howto-Implement-tdoa-uwb-rtls-1/tag-watch-pcba-2.png"></p> <p><img src="https://entest.autoop.net/images/technology/howto-Implement-tdoa-uwb-rtls-1/tag-watch-pcba-3.png" width="2483" height="1630" loading="lazy" data-path="local-images:/technology/howto-Implement-tdoa-uwb-rtls-1/tag-watch-pcba-3.png"></p> <p><img src="https://entest.autoop.net/images/technology/howto-Implement-tdoa-uwb-rtls-1/tag-watch-pcba-4.png" width="1440" height="463" loading="lazy" data-path="local-images:/technology/howto-Implement-tdoa-uwb-rtls-1/tag-watch-pcba-4.png"></p> <p>We give customers OEM tags and install them on the car.</p> <p>Anyway, the basic circuit is still the same. Therefore, after the firmware is written, it is basically compatible. One firmware is compatible with the tags of all models.</p> <p>A customer wants to make a bracelet tag with a display. He plans to add OLED to display the time and some received messages, and also add a vibration motor. After some research, I found that STM32F103 is not enough. <br>To display messages, there must be Chinese characters, and then a Chinese character library must be obtained. The small Flash of STM32 will definitely not be able to fit it. The large Flash version of STM32 is difficult to buy and expensive. <br>I plan to use ESP32 as an MCU, and I can also add WiFi and Bluetooth support. Later, the client's project was stopped, and later, our project was also stopped, and we stopped working on it.</p> <p>If you are using it commercially, it is recommended to use ESP32 as the MCU. It is best to replace the MCU of the anchor/tag with ESP32. In this way, they can be unified and the code can be reused. ESP32 is cheap and performs well, which is really a good thing.</p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="bS3qUOJ3"><em style="box-sizing: border-box;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">This website is our home base, and this series of articles will be updated from time to time. </span><span style="box-sizing: border-box; vertical-align: inherit;">In addition to this site, this series of articles is also published on </span></span><a style="box-sizing: border-box; color: var(--link-color); text-decoration: underline;" href="https://translate.google.com/website?sl=en&amp;tl=zh-CN&amp;hl=zh-CN&amp;client=webapp&amp;u=https://www.zhihu.com/column/c_1725823226259939328" target="_blank" rel="noopener"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Zhihu</span></span></a><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;"> , </span></span><a style="box-sizing: border-box; color: var(--link-color); text-decoration: underline;" href="https://translate.google.com/website?sl=en&amp;tl=zh-CN&amp;hl=zh-CN&amp;client=webapp&amp;u=https://www.cnblogs.com/bd8ncf/" target="_blank" rel="noopener"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">cnBlogs</span></span></a><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;"> , </span></span><a style="box-sizing: border-box; color: var(--link-color); text-decoration: underline;" href="https://translate.google.com/website?sl=en&amp;tl=zh-CN&amp;hl=zh-CN&amp;client=webapp&amp;u=https://blog.csdn.net/weixin_43986679?type%3Dblog" target="_blank" rel="noopener"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">CSDN</span></span></a><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;"> and other websites.</span></span></em></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><em style="box-sizing: border-box;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">By the way, I'm looking for a job. Due to business reasons, the company was dissolved. I have 30+ years of work experience, 20+ years of experience in C/C++/Java/Delphi, and a little bit of Javascript/Python/Lua. <br>In 199x, I wrote a Chinese character system in x86 assembly, and later used Delphi to write a mail server. I have written countless application systems, and the code I have written should exceed 2 million lines. <br>10+ years of hardware design experience, designing multiple embedded products. In the early stages of this UWB location system, the hardware and software were all developed by me alone, and the team was only built later. Base Guiyang, China, or remotely. <br>If there are job opportunities, please contact me (bd8ncf@gmail.com) for a detailed resume.</span></span></em></p> How to implement UWB precise location system with TDOA technology(2) 2024-01-11T03:27:03+08:00 2024-01-11T03:27:03+08:00 https://entest.autoop.net/technology/howto-implement-tdoa-uwb-rtls-2.html zhang <p>This is a series of articles that will introduce you to how to implement a UWB precise location system using TDOA technology.</p> <p>IMPORTANT NOTE:</p> <ul> <li>Q: Do I need basic knowledge to create this location system?</li> <li><span style="color: rgb(45, 194, 107);">A: This article is not for beginners. It requires a basic knowledge of electronic technology and software programming.</span></li> <li>Q: Are your hardware/software open source?</li> <li style="color: rgb(45, 194, 107);"><span style="color: rgb(45, 194, 107);">A: It is not open source. <br>In the article, I will introduce how to implement the UWB location system and tell you how to overcome the difficulties, but I will not directly give you the Gerber file of the PCB to make a board, nor will I give you the source code of the software, nor will I give you the compiled firmware. <br>I'm not going to give you any direct results, I'm just telling you how.</span></li> <li>Q: I am personally very interested in UWB location. Can I make a location system?</li> <li style="color: rgb(45, 194, 107);"><span style="color: rgb(45, 194, 107);">A: If you have a strong hardware/software background and a lot of time, you can certainly do it. This article is just for you to read!</span></li> <li>Q: I am a commercial company and I want to develop the UWB location system into a commercial product.</li> <li style="color: rgb(45, 194, 107);"><span style="color: rgb(45, 194, 107);">A: Of course. This article is also written for you. If you want to build the entire system from zero, after reading my article, you only need to draw the circuit and make the board; conceive the software structure and then coding. <br>In this way, I will mention all the difficulties in the article and introduce the solutions. <span style="color: rgb(224, 62, 45);">You don't need to hire people to do algorithm research</span>. If you want to save trouble and time, you can directly purchase our circuit diagram (AD engineering files), purchase our software source code, and then quickly enter the production process. (Website: https://uwbhome.top )</span></li> </ul> <h2 style="box-sizing: border-box; color: rgb(34, 38, 42); margin-top: 0px; margin-bottom: 0.5rem; font-weight: var(--cassiopeia-font-weight-headings,700); line-height: 1.2; font-size: 2rem; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span class="" style="box-sizing: border-box; vertical-align: inherit;">Anchor firmware design-clock synchronization</span></span></h2> <h3 style="box-sizing: border-box; color: rgb(34, 38, 42); margin-top: 0px; margin-bottom: 0.5rem; font-weight: var(--cassiopeia-font-weight-headings,700); line-height: 1.2; font-size: 1.75rem; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Clock synchronization principle</span></span></h3> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="VRYsgXhz"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">We have said before that for TDOA technology, each anchor needs to have unified time, which is a difficulty. </span><span style="box-sizing: border-box; vertical-align: inherit;">How to synchronize the clock?</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="8t-xH8NI"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Assume that there are four anchors A/B/C/D in a location area. We also use another anchor CS as the clock source to send clock synchronization packets regularly. </span><span style="box-sizing: border-box; vertical-align: inherit;">The structure of this clock synchronization package is as follows:</span></span></p> <pre class="language-c"><code>typedef struct ieee154_broadcast_clock_sync_frame { uint8_t frameCtrl[2]; // 0, 2, frame control bytes 00-01: 0x01 (Frame Type 0x01=date), 0xC8 (0xC0=src extended address 64 bits, 0x08=dest address 16 bits) uint8_t seq8; // 2, 1, sequence_number 02 uint8_t panID[2]; // 3, 2, PAN ID 03-04 uint8_t destAddr[2]; // 5, 2, 0xFFFF uint8_t sourceAddr[8]; // 7, 8, 64Bits EUI地址 uint8_t messageType; //15, 1, Message Type = RTLS_MSG_TYPE_CLOCK_SYNC uint8_t seq64[8]; //16, 8, 发出的测距消息序号, 比 seq8 有更大的最大值 uint8_t timeStamp[8]; //24, 8, 时间戳 uint8_t fcs[2]; //32, 2 } BROADCAST_CLOCK_SYNC_MESSAGE;</code></pre> <div class="highlight" style="box-sizing: border-box; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"> <pre class="highlighter-hljs" style="box-sizing: border-box; font-family: var(--font-monospace); font-size: 0.875em; margin-top: 0px; margin-bottom: 1rem; display: block; overflow: auto;"><code style="box-sizing: border-box; font-family: var(--font-monospace); font-size: inherit; color: inherit; overflow-wrap: break-word; word-break: normal;"> </code></pre> </div> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="7xs6QZSu"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">This is a typical UWB packet for DW1000. </span><span style="box-sizing: border-box; vertical-align: inherit;">This is a broadcast type packet, which has several important fields. timeStamp is the timestamp, which is the time when anchor A sends this packet.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="CN_ae06k"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">When the four anchors A/B/C/D receive this synchronization packet, they record the timestamp and the time when the packet was received (local timestamp). In this way, we have two timestamps.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="9fCZMkbr"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">After a while, CS sends another synchronization packet. </span><span style="box-sizing: border-box; vertical-align: inherit;">After a anchor, such as anchor B, receives it, it records the remote timestamp of the CS anchor and the time stamp received locally, and obtains two more timestamps.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="5zUY0zGP"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Assume that the interval between the two packets sent by the CS is 100ms, that is, the time interval between the two synchronous transmissions is 100ms. </span><span style="box-sizing: border-box; vertical-align: inherit;">So under normal circumstances, when anchor B receives these two packets, the local time interval should also be 100ms. </span><span style="box-sizing: border-box; vertical-align: inherit;">Actually not!</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="B8RFK9A9"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Because the crystal oscillators used by the DWM1000 of the two anchors will not have exactly the same frequency due to various reasons, there will always be some differences.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="DKFtJ9em"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">What is the clock difference between the two anchors?</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="TI4b8x0K"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">deta = (ST2 - ST1) - (RT2 - RT1). </span><span style="box-sizing: border-box; vertical-align: inherit;">where deta is the difference, ST2 is the sending time of the second packet, ST1 is the sending time of the first packet, RT2 is the receiving time of the second packet, and RT is the receiving time of the first packet.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="m0CBkd4k"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">The difference rate is Ratio = deta / (ST2-ST1)</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="59JIo1sm"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">In this way, the start time is known, and the clock discrepancy rate is also known. </span><span style="box-sizing: border-box; vertical-align: inherit;">We can convert any local timestamp to a timestamp based on CS.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="-w4JVAoD"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">When a tag sends a UWB location data packet, all four anchors A/B/C/D receive the packet. A/B/C/D convert the local timestamp upon receipt to the CS time as the basis. Everyone sends this timestamp to the location engine. The location engine gets 4 times. <br>Based on their difference, the coordinates of the tag can be calculated.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="gPs5UVmI"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Seeing this, you should have a question in your mind. </span><span style="box-sizing: border-box; vertical-align: inherit;">The sending time of the synchronization data packet sent by the CS is the moment when the UWB data packet leaves a gate of the DW1000 chip in the CS. </span><span style="box-sizing: border-box; vertical-align: inherit;">The UWB signal then passes through the internal circuit of the chip, and then is transmitted into the air through the transmitting antenna, reaches the antenna of anchor B, is transmitted inside the antenna of anchor B, passes through some internal circuits of the chip, and reaches the receiving gate of DW1000 in anchor B. <br>At that moment is the moment of reception. </span><span style="box-sizing: border-box; vertical-align: inherit;">This process takes a lot of time. How do you get this time? </span><span style="box-sizing: border-box; vertical-align: inherit;">It is introduced in the manual of the DW1000 chip that we need to consider the transmitting antenna delay/receiving antenna delay.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="i7wOJKnl"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">The answer is, leave it alone.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="5QskalWG"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">We assume that the DW1000 of anchor B is connected to the antenna through a long radio frequency cable. After the clock synchronization packet reaches the antenna of anchor B, it passes through a long cable before reaching the DW1000 chip. </span><span style="box-sizing: border-box; vertical-align: inherit;">Of course, the same goes for the location data packets sent by the tags. After arriving at the antenna of the B anchor, they then go through a long cable before reaching the DW1000 chip. </span><span style="box-sizing: border-box; vertical-align: inherit;">Assume that a section of the cable is added, causing the radio wave to run 1ms longer in the cable. Of course, the clock synchronization packet and the location packet both spend 1ms longer on the road. </span><span style="box-sizing: border-box; vertical-align: inherit;">If we take this 1ms into account when calculating the timestamp when anchor B receives the clock synchronization packet, then when the location engine calculates the time difference, the extra 1ms spent on the tag's location packet must be deducted. </span><span style="box-sizing: border-box; vertical-align: inherit;">So the time these two packets spend in the cable cancels out in the calculation formula.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="JL91s2eI"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">When installing a anchor, we care about "where the anchor is installed." In fact, we don't really care about the location of the anchor, but the location of the anchor antenna. </span><span style="box-sizing: border-box; vertical-align: inherit;">The location of the antenna is what matters. </span><span style="box-sizing: border-box; vertical-align: inherit;">Clock synchronization packets arrive at the antenna, location data packets arrive at the antenna, it doesn't matter where the anchor itself is.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="ekyTsL0b"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">This is also one of the advantages of TDOA. There is no need to worry about antenna delay. There is no need to do antenna delay calibration before leaving the factory like TOF anchors and TOF tags.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="IVAF3r5m"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">The above analysis is in the scenario of using a separate anchor as the clock source. </span><span style="box-sizing: border-box; vertical-align: inherit;">Our original system used a separate clock source. </span><span style="box-sizing: border-box; vertical-align: inherit;">The hardware and firmware of the clock source are exactly the same as those of a normal anchor, depending on whether it is configured as a clock source or a normal anchor. </span><span style="box-sizing: border-box; vertical-align: inherit;">When used as a clock source, it has only one function, which is to send clock synchronization packets regularly. <br>The DW1000 of the clock source only transmits but does not receive; when used as an ordinary anchor, it receives the clock synchronization packets sent by the clock source and the location packets sent by the tags. <br>The DW1000 of the ordinary anchor DW1000 only receives but does not transmit. </span><span style="box-sizing: border-box; vertical-align: inherit;">Later, in order to reduce costs, we merged the two functions. An ordinary anchor can be used as both a anchor and a clock source. <br>It is usually in the receiving state, periodically switches to the transmitting state to send a clock synchronization packet, and then immediately switches back to the receiving state. </span><span style="box-sizing: border-box; vertical-align: inherit;">This way, a separate clock source can be saved.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="61XaZLMb"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">If the anchor serves as the clock source at the same time, then the antenna delay of the anchor as the clock source will have an impact on the calculation. </span><span style="box-sizing: border-box; vertical-align: inherit;">For clock synchronization packets, it is the transmit delay; for location data packets, it is the receive delay. </span><span style="box-sizing: border-box; vertical-align: inherit;">The difference between the internal transmit delay and receive delay of DW1000 is not big and can be ignored in calculation. </span><span style="box-sizing: border-box; vertical-align: inherit;">However, if there is an external PA/LNA and the transmission and reception routes are quite different, this anomaly needs to be taken into consideration.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="Dl9zdgve"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">When we originally designed the entire system, we considered using a unified time for the entire system. </span><span style="box-sizing: border-box; vertical-align: inherit;">A large location area can be divided into multiple small location areas. </span><span style="box-sizing: border-box; vertical-align: inherit;">We can deploy a root clock, and each area has a minute clock. Synchronize the time from the root clock and synchronize the clocks step by step.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="eWiBGSxh"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">However, things are not that simple. The main problem is error. </span><span style="box-sizing: border-box; vertical-align: inherit;">We cannot rule out errors between clocks.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="k2Q0eZpP"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">For example, the time of root clock R is synchronized to A1/B1, then A1 is synchronized to A2, and B1 is synchronized to B2. </span><span style="box-sizing: border-box; vertical-align: inherit;">Then we will find that the error between A2 and B2 will be relatively large. </span><span style="box-sizing: border-box; vertical-align: inherit;">Because clock synchronization itself has errors, multi-level synchronization will lead to error accumulation, and the final error will become larger and larger.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="oi-1P5p2"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Finally, we found that unifying the time of the entire system is of little significance. We only need to unify the time among several anchors in a small location area.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="JivjOPSf"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Careful students must have noticed that in the clock synchronization packet structure defined earlier, there is a field seq64. </span><span style="box-sizing: border-box; vertical-align: inherit;">This is a 64-bit integer. </span><span style="box-sizing: border-box; vertical-align: inherit;">The DW1000 chip internally defines an 8-bit seq, which is placed after the frame control field. </span><span style="box-sizing: border-box; vertical-align: inherit;">We found that 1 byte can only express a packet sequence number of 256 at most, and it will wrap up quickly. </span><span style="box-sizing: border-box; vertical-align: inherit;">Sometimes, when we care about packets in a larger time scale, we cannot tell the difference. </span><span style="box-sizing: border-box; vertical-align: inherit;">Therefore, we set a separate 64-bit packet sequence number.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="kP4QZ2iX"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">In addition, the effective data of the DW1000 timestamp is 40 bits, and its unit is approximately 15.6ps.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="jdnPXfwF"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Later, in consideration of excellence, we newly defined a more concise clock synchronization package.</span></span></p> <div class="highlight" style="box-sizing: border-box; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"> <pre class="highlighter-hljs" style="box-sizing: border-box; font-family: var(--font-monospace); font-size: 0.875em; margin-top: 0px; margin-bottom: 1rem; display: block; overflow: auto;"><code style="box-sizing: border-box; font-family: var(--font-monospace); font-size: inherit; color: inherit; overflow-wrap: break-word; word-break: normal;">typedef struct ieee154_broadcast_mini_clock_sync_frame { uint8_t frameCtrl[2]; // 0, 2: frame control bytes 00-01: 0x01 (Frame Type 0x01=date), 0xC8 (0xC0=src extended address 64 bits, 0x08=dest address 16 bits) uint8_t seq8; // 2, 1: sequence_number 02 uint8_t panID[2]; // 3, 2: PAN ID 03-04 uint8_t destAddr[2]; // 5, 2: 0xFFFF uint8_t sourceAddr[8]; // 7, 8: 64 Bits EUI地址 uint8_t messageType; // 15,1: Message Type = RTLS_MSG_TYPE_MINI_CLOCK_SYNC uint8_t seq32_3[3]; // 16,3: 发出的测距消息序号的高 24 位,即高 3 字节 uint8_t timeStamp[5]; // 19,5: 时间戳, 40 Bits uint8_t fcs[2]; // 24,2: } BROADCAST_MINI_CLOCK_SYNC_MESSAGE; // 以上合计 26 字节</code></pre> </div> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="V5C5NfNB"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">There is no need to make seq 64 bits, 32 bits is enough. If there is a seq8 in the front, then only 3 bytes are needed in the back, so change seq64 to seq32_3; the effective bits of the timestamp are only 40 bits, so there is no need to use it. 64 bits.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="ptuYRaeu"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">The new clock synchronization packet size is reduced from 34 bytes to 26 bytes.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="KFQp0HXe"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Because wireless signals are essentially broadcasts, there can only be one sound in the air at the same time. If other sounds appear, it is interference. </span><span style="box-sizing: border-box; vertical-align: inherit;">Therefore, we must reduce channel occupation as much as possible. The smaller the data packets transmitted, the shorter the occupied time. </span><span style="box-sizing: border-box; vertical-align: inherit;">Time can be freed up to accommodate more tags; and the shorter the time a data packet occupies the channel, the smaller the chance of being interfered with.</span></span></p> <h3 style="box-sizing: border-box; color: rgb(34, 38, 42); margin-top: 0px; margin-bottom: 0.5rem; font-weight: var(--cassiopeia-font-weight-headings,700); line-height: 1.2; font-size: 1.75rem; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Anchor sharing - clock synchronization with multiple clock sources</span></span></h3> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="d0BMsarx"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Because the definition of UWB business is near-field wireless communication, radio regulatory authorities in almost all countries have strict restrictions on UWB signal power and do not allow high-power transmission. </span><span style="box-sizing: border-box; vertical-align: inherit;">Because the bandwidth occupied by UWB is too wide, if the power is high, it becomes a source of interference.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="qS1yqrz_"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">When the original DW1000 transmits at maximum power and communicates at a rate of 850K, the coverage range is approximately 200 meters to 300 meters. </span><span style="box-sizing: border-box; vertical-align: inherit;">In fact, this maximum power is beyond the standard. </span><span style="box-sizing: border-box; vertical-align: inherit;">If the signal strength required by the Radio Administration is followed, the communication distance will be within 20 meters.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="V0x7qgC6"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">In any case, when we want to locate a large area, we often need to divide it into multiple small location areas. </span><span style="box-sizing: border-box; vertical-align: inherit;">We assume that there is an area of ​​100 meters x 100 meters divided into 4 areas of 25 meters x 25 meters. </span><span style="box-sizing: border-box; vertical-align: inherit;">Assuming that each area uses 4 anchors, then 4 areas require 4x4=16 anchors.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="ZFNAstUJ"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">If the anchors can be shared, and the anchors at the edge of the location area can be shared by adjacent areas, then we only need to install one anchor at each vertex of the word "field", which only requires 3*3=9 anchors.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="7tjdmue8"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Using as few anchors as possible can reduce user investment and reduce project construction difficulty.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="CwdVuc1E"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">For the clock synchronization we mentioned earlier, the anchor can record the timestamps of several more clock sources to achieve the effect of synchronizing time with multiple clock sources.</span></span></p> <div class="highlight" style="box-sizing: border-box; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"> <pre class="highlighter-hljs" style="box-sizing: border-box; font-family: var(--font-monospace); font-size: 0.875em; margin-top: 0px; margin-bottom: 1rem; display: block; overflow: auto;"><code style="box-sizing: border-box; font-family: var(--font-monospace); font-size: inherit; color: inherit; overflow-wrap: break-word; word-break: normal;">typedef struct tag_ClockSource_Sync_Info { uint8_t clockSourceId[8]; double factor; double lastFactors[CLOCKSOURCE_SYNC_INFO_LAST_FACTOR_NUM]; int64_t offset; int64_t localStartTime; int64_t lastSyncTime; SAMPLE_KALMAN_FILTER_PARAMETER kfp; SAMPLE_RC_FILTER_PARAMETER rfp; double ppm; double lastFactorAcc[CLOCKSOURCE_SYNC_INFO_LAST_FACTOR_NUM]; double factorAcc; } CLOCKSOURCE_SYNC_INFO;</code></pre> </div> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="UxgQSs6w"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">The above structure records the clock synchronization data of a certain clock source.</span></span></p> <div class="highlight" style="box-sizing: border-box; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"> <pre class="highlighter-hljs" style="box-sizing: border-box; font-family: var(--font-monospace); font-size: 0.875em; margin-top: 0px; margin-bottom: 1rem; display: block; overflow: auto;"><code style="box-sizing: border-box; font-family: var(--font-monospace); font-size: inherit; color: inherit; overflow-wrap: break-word; word-break: normal;">#define CLOCKSOURCE_SYNC_INFO_NUM 15 // 记录 15 个时钟源的同步信息 CLOCKSOURCE_SYNC_INFO clockSourceSyncInfo[CLOCKSOURCE_SYNC_INFO_NUM];</code></pre> </div> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="-GfDSdIX"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">The above array records data from multiple clock sources.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="T9-7C1GK"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">The specific number of clock sources allowed to be synchronized is related to the RAM of the MCU. </span><span style="box-sizing: border-box; vertical-align: inherit;">In reality, there are actually not too many areas sharing the same anchor, and 15 basically have different functions.</span></span></p> <h3 style="box-sizing: border-box; color: rgb(34, 38, 42); margin-top: 0px; margin-bottom: 0.5rem; font-weight: var(--cassiopeia-font-weight-headings,700); line-height: 1.2; font-size: 1.75rem; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Interference factors for clock synchronization</span></span></h3> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="H2Brxqle"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">If you calculate the discrepancy rate of the clock every time you receive a clock synchronization packet, you will find that it keeps changing. </span><span style="box-sizing: border-box; vertical-align: inherit;">We expect to get a stable, or at least a little varying, difference rate over a period of time. </span><span style="box-sizing: border-box; vertical-align: inherit;">But this is impossible! </span><span style="box-sizing: border-box; vertical-align: inherit;">There are so many “distraction” factors.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="SFNT9_YJ"><strong style="box-sizing: border-box; font-weight: bolder;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Crystal oscillator frequency changes</span></span></strong></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="kODu1nep"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">The crystal oscillator of DW1000 is the source of the clock. </span><span style="box-sizing: border-box; vertical-align: inherit;">There are many factors that affect the frequency production of crystal oscillators. Temperature and humidity changes/voltage changes will affect the frequency of crystal oscillators. </span><span style="box-sizing: border-box; vertical-align: inherit;">Changes in the capacitance of the pad capacitors at both ends of the crystal oscillator will also have an impact on the frequency (some circuits adjust the frequency of the circuit by adjusting the capacitance of the two pad capacitors). <br>Changes in temperature, humidity and voltage will also have an impact on the two capacitors.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="Z3KUunqa"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">The Datasheet of DW1000 recommends "Crystal (38.4 MHz +/-10ppm)" and "TCXO (optional use in Anchor nodes. 38.4 MHz)". </span><span style="box-sizing: border-box; vertical-align: inherit;">The DWM1000 module encapsulates the DW1000 chip in an iron box, which is beneficial to the stability of the crystal oscillator frequency, because there is a certain insulation effect in the iron box, which prevents the temperature of the crystal oscillator from being quickly affected by air flow.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="Wqr1ck1s"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">In fact, inaccurate frequency is not terrible. </span><span style="box-sizing: border-box; vertical-align: inherit;">No matter how large the frequency deviation is, we can calibrate it through calculation. </span><span style="box-sizing: border-box; vertical-align: inherit;">What we fear is irregular and rapid change.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="vFPcYauM"><strong style="box-sizing: border-box; font-weight: bolder;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Changes in radio wave transmission speed</span></span></strong></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="ZMAF46HZ"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Radio waves are transmitted in the air, and air, as a medium, is unstable. </span><span style="box-sizing: border-box; vertical-align: inherit;">The temperature/humidity/air pressure of the air will affect the transmission speed of radio waves in the air.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="chPtTOE2"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Once, I mounted the development board on a tripod next to my desk and observed changes in the clock synchronization discrepancy rate. </span><span style="box-sizing: border-box; vertical-align: inherit;">A colleague happened to be passing by, and I immediately saw a drastic change in the curve. </span><span style="box-sizing: border-box; vertical-align: inherit;">This is why I emphasized the importance of the shell in the previous anchor circuit design section.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="RFbH980M"><strong style="box-sizing: border-box; font-weight: bolder;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Maintain clock synchronization stability</span></span></strong></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="d_Di9xaP"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Because there are many factors that affect clock synchronization differences, we must find ways to maintain stability. </span><span style="box-sizing: border-box; vertical-align: inherit;">There are several ways:</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="hQ7ctLFD"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Shorten the clock synchronization period. </span><span style="box-sizing: border-box; vertical-align: inherit;">We set the clock synchronization period to 250ms. </span><span style="box-sizing: border-box; vertical-align: inherit;">A shorter clock synchronization period can keep the current clock synchronization data updated and match the latest various influencing factors.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="YbPxj_nW"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Kalman filter or other filtering methods. </span><span style="box-sizing: border-box; vertical-align: inherit;">Generally speaking, changes in frequency are random points similar to a normal distribution: frequency has an overall change trend. <br>If the difference rate of our clocks is drawn, it is generally a gradually changing curve, but each time it is calculated The point does not fall exactly on the curve, but is near the curve. </span><span style="box-sizing: border-box; vertical-align: inherit;">We can use filters to get the values ​​on the curve.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="Av6CgUIx"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">The effect of using filtering is very limited. The most important thing is to shorten the clock synchronization period. </span><span style="box-sizing: border-box; vertical-align: inherit;">Because the value obtained through the filter is not the actual situation, but an ideal value. </span><span style="box-sizing: border-box; vertical-align: inherit;">For example, because changes in air temperature cause the transmission speed of radio waves from the clock to the anchor to change, we arrive at a value that excludes this effect, but in fact this value is of little significance. </span><span style="box-sizing: border-box; vertical-align: inherit;">Because the speed of location packets sent by tags will also be affected, the influence of air changes should be eliminated together. <br>If only clock synchronization is excluded, but the location packets sent by tags are not excluded, then the calculation results will definitely have a large deviation.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="bS3qUOJ3"><em style="box-sizing: border-box;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">I originally planned to write one article on anchor firmware design, but I found that just clock synchronization alone requires so much content. </span><span style="box-sizing: border-box; vertical-align: inherit;">It seems that there is still a lot to write. </span><span style="box-sizing: border-box; vertical-align: inherit;">Write slowly.</span></span></em></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="bS3qUOJ3"><em style="box-sizing: border-box;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">This website is our home base, and this series of articles will be updated from time to time. </span><span style="box-sizing: border-box; vertical-align: inherit;">In addition to this site, this series of articles is also published on </span></span><a style="box-sizing: border-box; color: var(--link-color); text-decoration: underline;" href="https://translate.google.com/website?sl=en&amp;tl=zh-CN&amp;hl=zh-CN&amp;client=webapp&amp;u=https://www.zhihu.com/column/c_1725823226259939328" target="_blank" rel="noopener"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Zhihu</span></span></a><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;"> , </span></span><a style="box-sizing: border-box; color: var(--link-color); text-decoration: underline;" href="https://translate.google.com/website?sl=en&amp;tl=zh-CN&amp;hl=zh-CN&amp;client=webapp&amp;u=https://www.cnblogs.com/bd8ncf/" target="_blank" rel="noopener"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">cnBlogs</span></span></a><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;"> , </span></span><a style="box-sizing: border-box; color: var(--link-color); text-decoration: underline;" href="https://translate.google.com/website?sl=en&amp;tl=zh-CN&amp;hl=zh-CN&amp;client=webapp&amp;u=https://blog.csdn.net/weixin_43986679?type%3Dblog" target="_blank" rel="noopener"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">CSDN</span></span></a><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;"> and other websites.</span></span></em></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><em style="box-sizing: border-box;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">By the way, I'm looking for a job. Due to business reasons, the company was dissolved. I have 30+ years of work experience, 20+ years of experience in C/C++/Java/Delphi, and a little bit of Javascript/Python/Lua. <br>In 199x, I wrote a Chinese character system in x86 assembly, and later used Delphi to write a mail server. I have written countless application systems, and the code I have written should exceed 2 million lines. <br>10+ years of hardware design experience, designing multiple embedded products. In the early stages of this UWB location system, the hardware and software were all developed by me alone, and the team was only built later. Base Guiyang, China, or remotely. <br>If there are job opportunities, please contact me for a detailed resume.</span></span></em></p> <p> </p> <p>This is a series of articles that will introduce you to how to implement a UWB precise location system using TDOA technology.</p> <p>IMPORTANT NOTE:</p> <ul> <li>Q: Do I need basic knowledge to create this location system?</li> <li><span style="color: rgb(45, 194, 107);">A: This article is not for beginners. It requires a basic knowledge of electronic technology and software programming.</span></li> <li>Q: Are your hardware/software open source?</li> <li style="color: rgb(45, 194, 107);"><span style="color: rgb(45, 194, 107);">A: It is not open source. <br>In the article, I will introduce how to implement the UWB location system and tell you how to overcome the difficulties, but I will not directly give you the Gerber file of the PCB to make a board, nor will I give you the source code of the software, nor will I give you the compiled firmware. <br>I'm not going to give you any direct results, I'm just telling you how.</span></li> <li>Q: I am personally very interested in UWB location. Can I make a location system?</li> <li style="color: rgb(45, 194, 107);"><span style="color: rgb(45, 194, 107);">A: If you have a strong hardware/software background and a lot of time, you can certainly do it. This article is just for you to read!</span></li> <li>Q: I am a commercial company and I want to develop the UWB location system into a commercial product.</li> <li style="color: rgb(45, 194, 107);"><span style="color: rgb(45, 194, 107);">A: Of course. This article is also written for you. If you want to build the entire system from zero, after reading my article, you only need to draw the circuit and make the board; conceive the software structure and then coding. <br>In this way, I will mention all the difficulties in the article and introduce the solutions. <span style="color: rgb(224, 62, 45);">You don't need to hire people to do algorithm research</span>. If you want to save trouble and time, you can directly purchase our circuit diagram (AD engineering files), purchase our software source code, and then quickly enter the production process. (Website: https://uwbhome.top )</span></li> </ul> <h2 style="box-sizing: border-box; color: rgb(34, 38, 42); margin-top: 0px; margin-bottom: 0.5rem; font-weight: var(--cassiopeia-font-weight-headings,700); line-height: 1.2; font-size: 2rem; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span class="" style="box-sizing: border-box; vertical-align: inherit;">Anchor firmware design-clock synchronization</span></span></h2> <h3 style="box-sizing: border-box; color: rgb(34, 38, 42); margin-top: 0px; margin-bottom: 0.5rem; font-weight: var(--cassiopeia-font-weight-headings,700); line-height: 1.2; font-size: 1.75rem; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Clock synchronization principle</span></span></h3> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="VRYsgXhz"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">We have said before that for TDOA technology, each anchor needs to have unified time, which is a difficulty. </span><span style="box-sizing: border-box; vertical-align: inherit;">How to synchronize the clock?</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="8t-xH8NI"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Assume that there are four anchors A/B/C/D in a location area. We also use another anchor CS as the clock source to send clock synchronization packets regularly. </span><span style="box-sizing: border-box; vertical-align: inherit;">The structure of this clock synchronization package is as follows:</span></span></p> <pre class="language-c"><code>typedef struct ieee154_broadcast_clock_sync_frame { uint8_t frameCtrl[2]; // 0, 2, frame control bytes 00-01: 0x01 (Frame Type 0x01=date), 0xC8 (0xC0=src extended address 64 bits, 0x08=dest address 16 bits) uint8_t seq8; // 2, 1, sequence_number 02 uint8_t panID[2]; // 3, 2, PAN ID 03-04 uint8_t destAddr[2]; // 5, 2, 0xFFFF uint8_t sourceAddr[8]; // 7, 8, 64Bits EUI地址 uint8_t messageType; //15, 1, Message Type = RTLS_MSG_TYPE_CLOCK_SYNC uint8_t seq64[8]; //16, 8, 发出的测距消息序号, 比 seq8 有更大的最大值 uint8_t timeStamp[8]; //24, 8, 时间戳 uint8_t fcs[2]; //32, 2 } BROADCAST_CLOCK_SYNC_MESSAGE;</code></pre> <div class="highlight" style="box-sizing: border-box; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"> <pre class="highlighter-hljs" style="box-sizing: border-box; font-family: var(--font-monospace); font-size: 0.875em; margin-top: 0px; margin-bottom: 1rem; display: block; overflow: auto;"><code style="box-sizing: border-box; font-family: var(--font-monospace); font-size: inherit; color: inherit; overflow-wrap: break-word; word-break: normal;"> </code></pre> </div> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="7xs6QZSu"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">This is a typical UWB packet for DW1000. </span><span style="box-sizing: border-box; vertical-align: inherit;">This is a broadcast type packet, which has several important fields. timeStamp is the timestamp, which is the time when anchor A sends this packet.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="CN_ae06k"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">When the four anchors A/B/C/D receive this synchronization packet, they record the timestamp and the time when the packet was received (local timestamp). In this way, we have two timestamps.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="9fCZMkbr"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">After a while, CS sends another synchronization packet. </span><span style="box-sizing: border-box; vertical-align: inherit;">After a anchor, such as anchor B, receives it, it records the remote timestamp of the CS anchor and the time stamp received locally, and obtains two more timestamps.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="5zUY0zGP"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Assume that the interval between the two packets sent by the CS is 100ms, that is, the time interval between the two synchronous transmissions is 100ms. </span><span style="box-sizing: border-box; vertical-align: inherit;">So under normal circumstances, when anchor B receives these two packets, the local time interval should also be 100ms. </span><span style="box-sizing: border-box; vertical-align: inherit;">Actually not!</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="B8RFK9A9"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Because the crystal oscillators used by the DWM1000 of the two anchors will not have exactly the same frequency due to various reasons, there will always be some differences.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="DKFtJ9em"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">What is the clock difference between the two anchors?</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="TI4b8x0K"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">deta = (ST2 - ST1) - (RT2 - RT1). </span><span style="box-sizing: border-box; vertical-align: inherit;">where deta is the difference, ST2 is the sending time of the second packet, ST1 is the sending time of the first packet, RT2 is the receiving time of the second packet, and RT is the receiving time of the first packet.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="m0CBkd4k"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">The difference rate is Ratio = deta / (ST2-ST1)</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="59JIo1sm"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">In this way, the start time is known, and the clock discrepancy rate is also known. </span><span style="box-sizing: border-box; vertical-align: inherit;">We can convert any local timestamp to a timestamp based on CS.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="-w4JVAoD"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">When a tag sends a UWB location data packet, all four anchors A/B/C/D receive the packet. A/B/C/D convert the local timestamp upon receipt to the CS time as the basis. Everyone sends this timestamp to the location engine. The location engine gets 4 times. <br>Based on their difference, the coordinates of the tag can be calculated.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="gPs5UVmI"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Seeing this, you should have a question in your mind. </span><span style="box-sizing: border-box; vertical-align: inherit;">The sending time of the synchronization data packet sent by the CS is the moment when the UWB data packet leaves a gate of the DW1000 chip in the CS. </span><span style="box-sizing: border-box; vertical-align: inherit;">The UWB signal then passes through the internal circuit of the chip, and then is transmitted into the air through the transmitting antenna, reaches the antenna of anchor B, is transmitted inside the antenna of anchor B, passes through some internal circuits of the chip, and reaches the receiving gate of DW1000 in anchor B. <br>At that moment is the moment of reception. </span><span style="box-sizing: border-box; vertical-align: inherit;">This process takes a lot of time. How do you get this time? </span><span style="box-sizing: border-box; vertical-align: inherit;">It is introduced in the manual of the DW1000 chip that we need to consider the transmitting antenna delay/receiving antenna delay.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="i7wOJKnl"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">The answer is, leave it alone.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="5QskalWG"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">We assume that the DW1000 of anchor B is connected to the antenna through a long radio frequency cable. After the clock synchronization packet reaches the antenna of anchor B, it passes through a long cable before reaching the DW1000 chip. </span><span style="box-sizing: border-box; vertical-align: inherit;">Of course, the same goes for the location data packets sent by the tags. After arriving at the antenna of the B anchor, they then go through a long cable before reaching the DW1000 chip. </span><span style="box-sizing: border-box; vertical-align: inherit;">Assume that a section of the cable is added, causing the radio wave to run 1ms longer in the cable. Of course, the clock synchronization packet and the location packet both spend 1ms longer on the road. </span><span style="box-sizing: border-box; vertical-align: inherit;">If we take this 1ms into account when calculating the timestamp when anchor B receives the clock synchronization packet, then when the location engine calculates the time difference, the extra 1ms spent on the tag's location packet must be deducted. </span><span style="box-sizing: border-box; vertical-align: inherit;">So the time these two packets spend in the cable cancels out in the calculation formula.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="JL91s2eI"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">When installing a anchor, we care about "where the anchor is installed." In fact, we don't really care about the location of the anchor, but the location of the anchor antenna. </span><span style="box-sizing: border-box; vertical-align: inherit;">The location of the antenna is what matters. </span><span style="box-sizing: border-box; vertical-align: inherit;">Clock synchronization packets arrive at the antenna, location data packets arrive at the antenna, it doesn't matter where the anchor itself is.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="ekyTsL0b"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">This is also one of the advantages of TDOA. There is no need to worry about antenna delay. There is no need to do antenna delay calibration before leaving the factory like TOF anchors and TOF tags.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="IVAF3r5m"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">The above analysis is in the scenario of using a separate anchor as the clock source. </span><span style="box-sizing: border-box; vertical-align: inherit;">Our original system used a separate clock source. </span><span style="box-sizing: border-box; vertical-align: inherit;">The hardware and firmware of the clock source are exactly the same as those of a normal anchor, depending on whether it is configured as a clock source or a normal anchor. </span><span style="box-sizing: border-box; vertical-align: inherit;">When used as a clock source, it has only one function, which is to send clock synchronization packets regularly. <br>The DW1000 of the clock source only transmits but does not receive; when used as an ordinary anchor, it receives the clock synchronization packets sent by the clock source and the location packets sent by the tags. <br>The DW1000 of the ordinary anchor DW1000 only receives but does not transmit. </span><span style="box-sizing: border-box; vertical-align: inherit;">Later, in order to reduce costs, we merged the two functions. An ordinary anchor can be used as both a anchor and a clock source. <br>It is usually in the receiving state, periodically switches to the transmitting state to send a clock synchronization packet, and then immediately switches back to the receiving state. </span><span style="box-sizing: border-box; vertical-align: inherit;">This way, a separate clock source can be saved.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="61XaZLMb"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">If the anchor serves as the clock source at the same time, then the antenna delay of the anchor as the clock source will have an impact on the calculation. </span><span style="box-sizing: border-box; vertical-align: inherit;">For clock synchronization packets, it is the transmit delay; for location data packets, it is the receive delay. </span><span style="box-sizing: border-box; vertical-align: inherit;">The difference between the internal transmit delay and receive delay of DW1000 is not big and can be ignored in calculation. </span><span style="box-sizing: border-box; vertical-align: inherit;">However, if there is an external PA/LNA and the transmission and reception routes are quite different, this anomaly needs to be taken into consideration.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="Dl9zdgve"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">When we originally designed the entire system, we considered using a unified time for the entire system. </span><span style="box-sizing: border-box; vertical-align: inherit;">A large location area can be divided into multiple small location areas. </span><span style="box-sizing: border-box; vertical-align: inherit;">We can deploy a root clock, and each area has a minute clock. Synchronize the time from the root clock and synchronize the clocks step by step.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="eWiBGSxh"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">However, things are not that simple. The main problem is error. </span><span style="box-sizing: border-box; vertical-align: inherit;">We cannot rule out errors between clocks.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="k2Q0eZpP"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">For example, the time of root clock R is synchronized to A1/B1, then A1 is synchronized to A2, and B1 is synchronized to B2. </span><span style="box-sizing: border-box; vertical-align: inherit;">Then we will find that the error between A2 and B2 will be relatively large. </span><span style="box-sizing: border-box; vertical-align: inherit;">Because clock synchronization itself has errors, multi-level synchronization will lead to error accumulation, and the final error will become larger and larger.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="oi-1P5p2"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Finally, we found that unifying the time of the entire system is of little significance. We only need to unify the time among several anchors in a small location area.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="JivjOPSf"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Careful students must have noticed that in the clock synchronization packet structure defined earlier, there is a field seq64. </span><span style="box-sizing: border-box; vertical-align: inherit;">This is a 64-bit integer. </span><span style="box-sizing: border-box; vertical-align: inherit;">The DW1000 chip internally defines an 8-bit seq, which is placed after the frame control field. </span><span style="box-sizing: border-box; vertical-align: inherit;">We found that 1 byte can only express a packet sequence number of 256 at most, and it will wrap up quickly. </span><span style="box-sizing: border-box; vertical-align: inherit;">Sometimes, when we care about packets in a larger time scale, we cannot tell the difference. </span><span style="box-sizing: border-box; vertical-align: inherit;">Therefore, we set a separate 64-bit packet sequence number.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="kP4QZ2iX"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">In addition, the effective data of the DW1000 timestamp is 40 bits, and its unit is approximately 15.6ps.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="jdnPXfwF"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Later, in consideration of excellence, we newly defined a more concise clock synchronization package.</span></span></p> <div class="highlight" style="box-sizing: border-box; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"> <pre class="highlighter-hljs" style="box-sizing: border-box; font-family: var(--font-monospace); font-size: 0.875em; margin-top: 0px; margin-bottom: 1rem; display: block; overflow: auto;"><code style="box-sizing: border-box; font-family: var(--font-monospace); font-size: inherit; color: inherit; overflow-wrap: break-word; word-break: normal;">typedef struct ieee154_broadcast_mini_clock_sync_frame { uint8_t frameCtrl[2]; // 0, 2: frame control bytes 00-01: 0x01 (Frame Type 0x01=date), 0xC8 (0xC0=src extended address 64 bits, 0x08=dest address 16 bits) uint8_t seq8; // 2, 1: sequence_number 02 uint8_t panID[2]; // 3, 2: PAN ID 03-04 uint8_t destAddr[2]; // 5, 2: 0xFFFF uint8_t sourceAddr[8]; // 7, 8: 64 Bits EUI地址 uint8_t messageType; // 15,1: Message Type = RTLS_MSG_TYPE_MINI_CLOCK_SYNC uint8_t seq32_3[3]; // 16,3: 发出的测距消息序号的高 24 位,即高 3 字节 uint8_t timeStamp[5]; // 19,5: 时间戳, 40 Bits uint8_t fcs[2]; // 24,2: } BROADCAST_MINI_CLOCK_SYNC_MESSAGE; // 以上合计 26 字节</code></pre> </div> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="V5C5NfNB"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">There is no need to make seq 64 bits, 32 bits is enough. If there is a seq8 in the front, then only 3 bytes are needed in the back, so change seq64 to seq32_3; the effective bits of the timestamp are only 40 bits, so there is no need to use it. 64 bits.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="ptuYRaeu"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">The new clock synchronization packet size is reduced from 34 bytes to 26 bytes.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="KFQp0HXe"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Because wireless signals are essentially broadcasts, there can only be one sound in the air at the same time. If other sounds appear, it is interference. </span><span style="box-sizing: border-box; vertical-align: inherit;">Therefore, we must reduce channel occupation as much as possible. The smaller the data packets transmitted, the shorter the occupied time. </span><span style="box-sizing: border-box; vertical-align: inherit;">Time can be freed up to accommodate more tags; and the shorter the time a data packet occupies the channel, the smaller the chance of being interfered with.</span></span></p> <h3 style="box-sizing: border-box; color: rgb(34, 38, 42); margin-top: 0px; margin-bottom: 0.5rem; font-weight: var(--cassiopeia-font-weight-headings,700); line-height: 1.2; font-size: 1.75rem; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Anchor sharing - clock synchronization with multiple clock sources</span></span></h3> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="d0BMsarx"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Because the definition of UWB business is near-field wireless communication, radio regulatory authorities in almost all countries have strict restrictions on UWB signal power and do not allow high-power transmission. </span><span style="box-sizing: border-box; vertical-align: inherit;">Because the bandwidth occupied by UWB is too wide, if the power is high, it becomes a source of interference.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="qS1yqrz_"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">When the original DW1000 transmits at maximum power and communicates at a rate of 850K, the coverage range is approximately 200 meters to 300 meters. </span><span style="box-sizing: border-box; vertical-align: inherit;">In fact, this maximum power is beyond the standard. </span><span style="box-sizing: border-box; vertical-align: inherit;">If the signal strength required by the Radio Administration is followed, the communication distance will be within 20 meters.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="V0x7qgC6"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">In any case, when we want to locate a large area, we often need to divide it into multiple small location areas. </span><span style="box-sizing: border-box; vertical-align: inherit;">We assume that there is an area of ​​100 meters x 100 meters divided into 4 areas of 25 meters x 25 meters. </span><span style="box-sizing: border-box; vertical-align: inherit;">Assuming that each area uses 4 anchors, then 4 areas require 4x4=16 anchors.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="ZFNAstUJ"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">If the anchors can be shared, and the anchors at the edge of the location area can be shared by adjacent areas, then we only need to install one anchor at each vertex of the word "field", which only requires 3*3=9 anchors.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="7tjdmue8"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Using as few anchors as possible can reduce user investment and reduce project construction difficulty.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="CwdVuc1E"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">For the clock synchronization we mentioned earlier, the anchor can record the timestamps of several more clock sources to achieve the effect of synchronizing time with multiple clock sources.</span></span></p> <div class="highlight" style="box-sizing: border-box; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"> <pre class="highlighter-hljs" style="box-sizing: border-box; font-family: var(--font-monospace); font-size: 0.875em; margin-top: 0px; margin-bottom: 1rem; display: block; overflow: auto;"><code style="box-sizing: border-box; font-family: var(--font-monospace); font-size: inherit; color: inherit; overflow-wrap: break-word; word-break: normal;">typedef struct tag_ClockSource_Sync_Info { uint8_t clockSourceId[8]; double factor; double lastFactors[CLOCKSOURCE_SYNC_INFO_LAST_FACTOR_NUM]; int64_t offset; int64_t localStartTime; int64_t lastSyncTime; SAMPLE_KALMAN_FILTER_PARAMETER kfp; SAMPLE_RC_FILTER_PARAMETER rfp; double ppm; double lastFactorAcc[CLOCKSOURCE_SYNC_INFO_LAST_FACTOR_NUM]; double factorAcc; } CLOCKSOURCE_SYNC_INFO;</code></pre> </div> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="UxgQSs6w"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">The above structure records the clock synchronization data of a certain clock source.</span></span></p> <div class="highlight" style="box-sizing: border-box; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"> <pre class="highlighter-hljs" style="box-sizing: border-box; font-family: var(--font-monospace); font-size: 0.875em; margin-top: 0px; margin-bottom: 1rem; display: block; overflow: auto;"><code style="box-sizing: border-box; font-family: var(--font-monospace); font-size: inherit; color: inherit; overflow-wrap: break-word; word-break: normal;">#define CLOCKSOURCE_SYNC_INFO_NUM 15 // 记录 15 个时钟源的同步信息 CLOCKSOURCE_SYNC_INFO clockSourceSyncInfo[CLOCKSOURCE_SYNC_INFO_NUM];</code></pre> </div> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="-GfDSdIX"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">The above array records data from multiple clock sources.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="T9-7C1GK"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">The specific number of clock sources allowed to be synchronized is related to the RAM of the MCU. </span><span style="box-sizing: border-box; vertical-align: inherit;">In reality, there are actually not too many areas sharing the same anchor, and 15 basically have different functions.</span></span></p> <h3 style="box-sizing: border-box; color: rgb(34, 38, 42); margin-top: 0px; margin-bottom: 0.5rem; font-weight: var(--cassiopeia-font-weight-headings,700); line-height: 1.2; font-size: 1.75rem; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Interference factors for clock synchronization</span></span></h3> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="H2Brxqle"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">If you calculate the discrepancy rate of the clock every time you receive a clock synchronization packet, you will find that it keeps changing. </span><span style="box-sizing: border-box; vertical-align: inherit;">We expect to get a stable, or at least a little varying, difference rate over a period of time. </span><span style="box-sizing: border-box; vertical-align: inherit;">But this is impossible! </span><span style="box-sizing: border-box; vertical-align: inherit;">There are so many “distraction” factors.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="SFNT9_YJ"><strong style="box-sizing: border-box; font-weight: bolder;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Crystal oscillator frequency changes</span></span></strong></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="kODu1nep"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">The crystal oscillator of DW1000 is the source of the clock. </span><span style="box-sizing: border-box; vertical-align: inherit;">There are many factors that affect the frequency production of crystal oscillators. Temperature and humidity changes/voltage changes will affect the frequency of crystal oscillators. </span><span style="box-sizing: border-box; vertical-align: inherit;">Changes in the capacitance of the pad capacitors at both ends of the crystal oscillator will also have an impact on the frequency (some circuits adjust the frequency of the circuit by adjusting the capacitance of the two pad capacitors). <br>Changes in temperature, humidity and voltage will also have an impact on the two capacitors.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="Z3KUunqa"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">The Datasheet of DW1000 recommends "Crystal (38.4 MHz +/-10ppm)" and "TCXO (optional use in Anchor nodes. 38.4 MHz)". </span><span style="box-sizing: border-box; vertical-align: inherit;">The DWM1000 module encapsulates the DW1000 chip in an iron box, which is beneficial to the stability of the crystal oscillator frequency, because there is a certain insulation effect in the iron box, which prevents the temperature of the crystal oscillator from being quickly affected by air flow.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="Wqr1ck1s"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">In fact, inaccurate frequency is not terrible. </span><span style="box-sizing: border-box; vertical-align: inherit;">No matter how large the frequency deviation is, we can calibrate it through calculation. </span><span style="box-sizing: border-box; vertical-align: inherit;">What we fear is irregular and rapid change.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="vFPcYauM"><strong style="box-sizing: border-box; font-weight: bolder;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Changes in radio wave transmission speed</span></span></strong></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="ZMAF46HZ"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Radio waves are transmitted in the air, and air, as a medium, is unstable. </span><span style="box-sizing: border-box; vertical-align: inherit;">The temperature/humidity/air pressure of the air will affect the transmission speed of radio waves in the air.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="chPtTOE2"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Once, I mounted the development board on a tripod next to my desk and observed changes in the clock synchronization discrepancy rate. </span><span style="box-sizing: border-box; vertical-align: inherit;">A colleague happened to be passing by, and I immediately saw a drastic change in the curve. </span><span style="box-sizing: border-box; vertical-align: inherit;">This is why I emphasized the importance of the shell in the previous anchor circuit design section.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="RFbH980M"><strong style="box-sizing: border-box; font-weight: bolder;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Maintain clock synchronization stability</span></span></strong></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="d_Di9xaP"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Because there are many factors that affect clock synchronization differences, we must find ways to maintain stability. </span><span style="box-sizing: border-box; vertical-align: inherit;">There are several ways:</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="hQ7ctLFD"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Shorten the clock synchronization period. </span><span style="box-sizing: border-box; vertical-align: inherit;">We set the clock synchronization period to 250ms. </span><span style="box-sizing: border-box; vertical-align: inherit;">A shorter clock synchronization period can keep the current clock synchronization data updated and match the latest various influencing factors.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="YbPxj_nW"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Kalman filter or other filtering methods. </span><span style="box-sizing: border-box; vertical-align: inherit;">Generally speaking, changes in frequency are random points similar to a normal distribution: frequency has an overall change trend. <br>If the difference rate of our clocks is drawn, it is generally a gradually changing curve, but each time it is calculated The point does not fall exactly on the curve, but is near the curve. </span><span style="box-sizing: border-box; vertical-align: inherit;">We can use filters to get the values ​​on the curve.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="Av6CgUIx"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">The effect of using filtering is very limited. The most important thing is to shorten the clock synchronization period. </span><span style="box-sizing: border-box; vertical-align: inherit;">Because the value obtained through the filter is not the actual situation, but an ideal value. </span><span style="box-sizing: border-box; vertical-align: inherit;">For example, because changes in air temperature cause the transmission speed of radio waves from the clock to the anchor to change, we arrive at a value that excludes this effect, but in fact this value is of little significance. </span><span style="box-sizing: border-box; vertical-align: inherit;">Because the speed of location packets sent by tags will also be affected, the influence of air changes should be eliminated together. <br>If only clock synchronization is excluded, but the location packets sent by tags are not excluded, then the calculation results will definitely have a large deviation.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="bS3qUOJ3"><em style="box-sizing: border-box;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">I originally planned to write one article on anchor firmware design, but I found that just clock synchronization alone requires so much content. </span><span style="box-sizing: border-box; vertical-align: inherit;">It seems that there is still a lot to write. </span><span style="box-sizing: border-box; vertical-align: inherit;">Write slowly.</span></span></em></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="bS3qUOJ3"><em style="box-sizing: border-box;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">This website is our home base, and this series of articles will be updated from time to time. </span><span style="box-sizing: border-box; vertical-align: inherit;">In addition to this site, this series of articles is also published on </span></span><a style="box-sizing: border-box; color: var(--link-color); text-decoration: underline;" href="https://translate.google.com/website?sl=en&amp;tl=zh-CN&amp;hl=zh-CN&amp;client=webapp&amp;u=https://www.zhihu.com/column/c_1725823226259939328" target="_blank" rel="noopener"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Zhihu</span></span></a><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;"> , </span></span><a style="box-sizing: border-box; color: var(--link-color); text-decoration: underline;" href="https://translate.google.com/website?sl=en&amp;tl=zh-CN&amp;hl=zh-CN&amp;client=webapp&amp;u=https://www.cnblogs.com/bd8ncf/" target="_blank" rel="noopener"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">cnBlogs</span></span></a><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;"> , </span></span><a style="box-sizing: border-box; color: var(--link-color); text-decoration: underline;" href="https://translate.google.com/website?sl=en&amp;tl=zh-CN&amp;hl=zh-CN&amp;client=webapp&amp;u=https://blog.csdn.net/weixin_43986679?type%3Dblog" target="_blank" rel="noopener"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">CSDN</span></span></a><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;"> and other websites.</span></span></em></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><em style="box-sizing: border-box;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">By the way, I'm looking for a job. Due to business reasons, the company was dissolved. I have 30+ years of work experience, 20+ years of experience in C/C++/Java/Delphi, and a little bit of Javascript/Python/Lua. <br>In 199x, I wrote a Chinese character system in x86 assembly, and later used Delphi to write a mail server. I have written countless application systems, and the code I have written should exceed 2 million lines. <br>10+ years of hardware design experience, designing multiple embedded products. In the early stages of this UWB location system, the hardware and software were all developed by me alone, and the team was only built later. Base Guiyang, China, or remotely. <br>If there are job opportunities, please contact me for a detailed resume.</span></span></em></p> <p> </p> How to implement UWB precise location system with TDOA technology(3) 2024-01-11T03:28:37+08:00 2024-01-11T03:28:37+08:00 https://entest.autoop.net/technology/howto-implement-tdoa-uwb-rtls-3.html zhang <p>This is a series of articles that will introduce you to how to implement a UWB precise location system using TDOA technology.</p> <p>IMPORTANT NOTE:</p> <ul> <li>Q: Do I need basic knowledge to create this location system?</li> <li><span style="color: rgb(45, 194, 107);">A: This article is not for beginners. It requires a basic knowledge of electronic technology and software programming.</span></li> <li>Q: Are your hardware/software open source?</li> <li style="color: rgb(45, 194, 107);"><span style="color: rgb(45, 194, 107);">A: It is not open source. <br>In the article, I will introduce how to implement the UWB location system and tell you how to overcome the difficulties, but I will not directly give you the Gerber file of the PCB to make a board, nor will I give you the source code of the software, nor will I give you the compiled firmware. <br>I'm not going to give you any direct results, I'm just telling you how.</span></li> <li>Q: I am personally very interested in UWB location. Can I make a location system?</li> <li style="color: rgb(45, 194, 107);"><span style="color: rgb(45, 194, 107);">A: If you have a strong hardware/software background and a lot of time, you can certainly do it. This article is just for you to read!</span></li> <li>Q: I am a commercial company and I want to develop the UWB location system into a commercial product.</li> <li style="color: rgb(45, 194, 107);"><span style="color: rgb(45, 194, 107);">A: Of course. This article is also written for you. If you want to build the entire system from zero, after reading my article, you only need to draw the circuit and make the board; conceive the software structure and then coding. <br>In this way, I will mention all the difficulties in the article and introduce the solutions. <span style="color: rgb(224, 62, 45);">You don't need to hire people to do algorithm research</span>. If you want to save trouble and time, you can directly purchase our circuit diagram (AD engineering files), purchase our software source code, and then quickly enter the production process. (Website: https://uwbhome.top )</span></li> </ul> <p><span data-cke-copybin-start="1">​</span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><em style="box-sizing: border-box;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">The previous article introduced the method of clock synchronization, in order to get some practical information out as soon as possible, so that readers would not think that I only wrote some general talk without technical content. </span><span style="box-sizing: border-box; vertical-align: inherit;">Write slowly next step.</span></span></em></p> <h2 style="box-sizing: border-box; color: rgb(34, 38, 42); margin-top: 0px; margin-bottom: 0.5rem; font-weight: var(--cassiopeia-font-weight-headings,700); line-height: 1.2; font-size: 2rem; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Anchor firmware design-Flash layout</span></span></h2> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">When writing firmware for an MCU, if you are a beginner, you may start writing applications directly as soon as you get started. </span><span style="box-sizing: border-box; vertical-align: inherit;">Veterans will first consider the layout, what things are to be done, what is the relationship between them, etc., and must be considered thoroughly.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">The Flash of the anchor is divided into 4 blocks: Bootloader, Application1, Application2, and Data.\</span></span></p> <h2 style="box-sizing: border-box; color: rgb(34, 38, 42); margin-top: 0px; margin-bottom: 0.5rem; font-weight: var(--cassiopeia-font-weight-headings,700); line-height: 1.2; font-size: 2rem; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Anchor </span></span><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">firmware design-online upgrade</span></span></h2> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">It is important that the product's firmware is field upgradeable. </span><span style="box-sizing: border-box; vertical-align: inherit;">On-site upgrade means that the firmware can be upgraded directly at the customer's site through a local area network or the like without removing the installed product. </span><span style="box-sizing: border-box; vertical-align: inherit;">You know, when a product has been installed at a customer site thousands of kilometers away, and you suddenly find a bug in the firmware, what should you do? </span><span style="box-sizing: border-box; vertical-align: inherit;">If it can be upgraded on site, the code will be corrected in the office, new firmware will be generated, sent to customers on site, and the firmware will be upgraded on site. </span><span style="box-sizing: border-box; vertical-align: inherit;">During this process, you don't need to leave your office at all.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">If the firmware of your product cannot be upgraded on site, I'm sorry. After discovering the bug, you can only ask the customer to disassemble the product and send it back to the company. You can flash the new firmware and send it to the customer... It's a headache to think about it.</span></span></p> <h3 style="box-sizing: border-box; color: rgb(34, 38, 42); margin-top: 0px; margin-bottom: 0.5rem; font-weight: var(--cassiopeia-font-weight-headings,700); line-height: 1.2; font-size: 1.75rem; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Anchor firmware design-Bootloader</span></span></h3> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Bootloader is the startup code, Application1/Application2 are the applications, and Data holds the configuration data.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">When powering on, the program in the Bootloader is executed first. It determines which Application1/Application2 is valid and jumps to the valid Application for execution. </span><span style="box-sizing: border-box; vertical-align: inherit;">There are two variables in the Data area: Application1Valid and Application2Valid. If True, the corresponding Application is valid.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">In the production stage, the worker responsible for production is only responsible for flashing the Bootloader. At this time, Application1Valid and Application2Valid are both False.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">After powering on, if a valid Application cannot be found, the Bootloader will start the network part of the code: DHCP Client/TCP Client/DNS Client/UDP Server/UDP Client, etc. </span><span style="box-sizing: border-box; vertical-align: inherit;">If it is connected to the network, it will always send a UDP packet to the network to request initialization.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">After the factory initialization program receives the UDP packet requesting initialization, it will register the basic information of the new anchor, such as MCU ID, etc., and then assign it an EUI64 address. This address will later be the ID of the anchor. </span><span style="box-sizing: border-box; vertical-align: inherit;">A serial number is also assigned. </span><span style="box-sizing: border-box; vertical-align: inherit;">Then the default configuration data must be written. </span><span style="box-sizing: border-box; vertical-align: inherit;">The factory initialization process then begins sending firmware to the new anchor. </span><span style="box-sizing: border-box; vertical-align: inherit;">After the bootloader receives the firmware, it writes it to an invalid Application area (at the beginning, the Application1 area must be invalid). </span><span style="box-sizing: border-box; vertical-align: inherit;">The firmware will be sent in many packages. </span><span style="box-sizing: border-box; vertical-align: inherit;">After receiving the firmware, the Bootloader will set Applicaiton1Valid to True and then restart.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">After powering on again, the Bootloader finds that Application1 is valid and jumps to Application1 for execution.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">This completes the startup of the new firmware.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">In fact, the network-related code and firmware receiving code in the Bootloader are only executed once during factory initialization and will not be executed again in the future. </span><span style="box-sizing: border-box; vertical-align: inherit;">Because after leaving the factory, one of Application1 and Application2 is always valid.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">If the bootloader finds that both areas are valid, it will invalidate the second area. </span><span style="box-sizing: border-box; vertical-align: inherit;">Only one area is allowed to be valid, and the invalid area is reserved for the new upgraded firmware.</span></span></p> <h3 style="box-sizing: border-box; color: rgb(34, 38, 42); margin-top: 0px; margin-bottom: 0.5rem; font-weight: var(--cassiopeia-font-weight-headings,700); line-height: 1.2; font-size: 1.75rem; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Anchor firmware design-firmware upgrade</span></span></h3> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">In the firmware Application, there is also a firmware upgrade code similar to the aforementioned Bootloader. </span><span style="box-sizing: border-box; vertical-align: inherit;">It just needs to determine which area is invalid, save the received new firmware to the invalid area, and set the corresponding variables to be valid, and set the variables corresponding to the running area to be invalid. </span><span style="box-sizing: border-box; vertical-align: inherit;">The next time the power is turned on, the Bootloader will jump to the new firmware for execution.</span></span></p> <h2 style="box-sizing: border-box; color: rgb(34, 38, 42); margin-top: 0px; margin-bottom: 0.5rem; font-weight: var(--cassiopeia-font-weight-headings,700); line-height: 1.2; font-size: 2rem; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Anchor firmware design-program structure</span></span></h2> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Now I will introduce how to write Application.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Because the anchor still has a lot of functions, several functions need to be executed "concurrently". </span><span style="box-sizing: border-box; vertical-align: inherit;">"Concurrency" here refers to logic, because STM32 does not support preemptive execution/does not support multi-threading/has only one core, all codes can only be executed sequentially, and there will be no real concurrency.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Therefore, MCU cannot run naked and must use RTOS. </span><span style="box-sizing: border-box; vertical-align: inherit;">At first, because I was familiar with uCOS, I used it. </span><span style="box-sizing: border-box; vertical-align: inherit;">If I were to choose now, I would most likely use FreeRTOS.</span></span></p> <ul style="box-sizing: border-box; padding-left: 2rem; margin-top: 0px; margin-bottom: 1rem; overflow: hidden; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"> <li style="box-sizing: border-box;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">For the clock synchronization part, if it is used as a clock source, UWB clock synchronization packets need to be sent regularly;</span></span></li> <li style="box-sizing: border-box;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">UWB chip processing is responsible for the status management of DW1000 and the sending and receiving of UWB data packets.</span></span></li> <li style="box-sizing: border-box;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Network processing, including DHCP Client/DNS Client/UDP Server/UDP Client, etc.</span></span></li> <li style="box-sizing: border-box;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">watchdog task</span></span></li> </ul> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Let’s start with the simple part first.</span></span></p> <h3 style="box-sizing: border-box; color: rgb(34, 38, 42); margin-top: 0px; margin-bottom: 0.5rem; font-weight: var(--cassiopeia-font-weight-headings,700); line-height: 1.2; font-size: 1.75rem; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">watchdog task</span></span></h3> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">STM32 has a watchdog. If the dog feeding function is not called in time, the MCU will think that the program has hung up and it will automatically reset. </span><span style="box-sizing: border-box; vertical-align: inherit;">Our program is divided into many tasks, and each task may fail, so we create a watchdog task. </span><span style="box-sizing: border-box; vertical-align: inherit;">Each task has a watchdog variable, which is set to 0 by each task in time. The watchdog task loop adds 1 to these variables and determines the value of these variables. If it exceeds a certain limit, the corresponding task is judged to have hung up. , reset the MCU. </span><span style="box-sizing: border-box; vertical-align: inherit;">The watchdog task is also responsible for feeding the dogs.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">In short, we must ensure that each task can work normally and reset it immediately when the task hangs up.</span></span></p> <h3 style="box-sizing: border-box; color: rgb(34, 38, 42); margin-top: 0px; margin-bottom: 0.5rem; font-weight: var(--cassiopeia-font-weight-headings,700); line-height: 1.2; font-size: 1.75rem; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">DW1000 processing tasks</span></span></h3> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Considering that multiple DW1000s may be built into one anchor in the future, we define DW1000 related data as a structure:</span></span></p> <pre class="language-c"><code>typedef struct __DW1000_MODULE__ { uint16_t Module_SPI_Prescaler; SPI_TypeDef* SPIn; GPIO_TypeDef* Module_SPI_Port; uint16_t Module_SPI_SCK_Pin; uint16_t Module_SPI_MISO_Pin; uint16_t Module_SPI_MOSI_Pin; GPIO_TypeDef* Module_SPI_CS_Port; uint16_t Module_SPI_CS_Pin; GPIO_TypeDef* Module_RSTn_Port; uint16_t Module_RSTn_Pin; GPIO_TypeDef* Module_RST_IRQ_Port; uint16_t Module_RST_IRQ_Pin; uint32_t Module_RST_IRQ_EXTI_Line; uint8_t Module_RST_IRQ_EXTI_PortSource; uint8_t Module_RST_IRQ_EXTI_PinSource; IRQn_Type Module_RST_IRQ_EXTI_IRQn; GPIO_TypeDef* Module_IRQ_Port; uint16_t Module_IRQ_Pin; uint32_t Module_IRQ_EXTI_Line; uint8_t Module_IRQ_EXTI_PortSource; uint8_t Module_IRQ_EXTI_PinSource; IRQn_Type Module_IRQ_EXTI_IRQn; uint8_t Module_IRQ_EXTI_USEIRQ; uint8_t Module_RST_IRQ_EXTI_USEIRQ; uint8_t crystal_oscillator_trim; uint8_t rx_buffer[RX_BUF_LEN]; DW_EVENT DWEvents[MAX_EVENT_NUMBER]; uint8_t DWEventIdxIn, DWEventIdxOut; DW_EVENT dw_event_g; CLOCKSOURCE_SYNC_INFO clockSourceSyncInfo[CLOCKSOURCE_SYNC_INFO_NUM]; SEEN_CLOCK_SOURCE seenClockSources[SEEN_CLOCK_SOURCE_NUM]; dwt_local_data_t dw1000Local; } DW1000_MODULE; typedef DW1000_MODULE* PDW1000_MODULE;</code></pre> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">In this case, some code can be reused, and the program will be more flexible.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">I want to complain about DecaWave here. The working condition of DW1000 is not very stable. </span><span style="box-sizing: border-box; vertical-align: inherit;">Sometimes some strange phenomena occur. </span><span style="box-sizing: border-box; vertical-align: inherit;">Therefore, we must often judge the status of DW1000. If it is not in the expected status, it is determined to be dead, and we must reset DW1000 in time. </span><span style="box-sizing: border-box; vertical-align: inherit;">Of course, there aren’t many of these cases, but when they are, we have to deal with them. </span><span style="box-sizing: border-box; vertical-align: inherit;">Otherwise, at the customer site, the anchor and firmware are alive, but the DW1000 is dead and cannot send or receive data, which would be very embarrassing.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">The main job of the anchor is to receive UWB data packets. In order to ensure that the received data packets can be processed in time without affecting the reception of subsequent UWB packets, we have created a queue for caching. </span><span style="box-sizing: border-box; vertical-align: inherit;">The DW1000 task only receives UWB packets, puts them in the queue immediately after receiving them, and then processes subsequent UWB packets. </span><span style="box-sizing: border-box; vertical-align: inherit;">Packets in the queue are processed by other tasks.</span></span></p> <h3 style="box-sizing: border-box; color: rgb(34, 38, 42); margin-top: 0px; margin-bottom: 0.5rem; font-weight: var(--cassiopeia-font-weight-headings,700); line-height: 1.2; font-size: 1.75rem; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">network tasks</span></span></h3> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">The work of network tasks is more complicated.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">One of its most important tasks is to reassemble the received UWB into a new data packet and send it to the location engine.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Other tasks are auxiliary.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><strong style="box-sizing: border-box; font-weight: bolder;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">DHCP client</span></span></strong><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;"> . </span><span style="box-sizing: border-box; vertical-align: inherit;">In many cases, IP address management is troublesome. If each anchor configures IP addresses one by one, it will be a laborious task. </span><span style="box-sizing: border-box; vertical-align: inherit;">Generally speaking, unless the customer requires each device to be configured with a specified IP address, it is more convenient to use DHCP to assign IP addresses. </span><span style="box-sizing: border-box; vertical-align: inherit;">The W5500 chip has a DHCP client code example, just copy it and modify it. </span><span style="box-sizing: border-box; vertical-align: inherit;">Its code is not complete in processing, such as the renewal of DHCP IP address contract after expiration, and how to deal with IP address conflicts, etc. We have done some improvement work on the code.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><strong style="box-sizing: border-box; font-weight: bolder;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">DNS client</span></span></strong><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;"> . </span><span style="box-sizing: border-box; vertical-align: inherit;">In fact, it doesn’t need to be used. </span><span style="box-sizing: border-box; vertical-align: inherit;">If the location engine is not in the local area network, but in a far away place, such as a cloud host on the Internet. </span><span style="box-sizing: border-box; vertical-align: inherit;">It would be better to use DNS to specify the address of the <span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">location </span></span>engine. In case the IP address of the <span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">location </span></span>engine changes, the domain name can remain unchanged. </span><span style="box-sizing: border-box; vertical-align: inherit;">We do not use DNS. Most of our previous customers are within the local area network, and only a few have placed their <span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">location </span></span>engines on the Internet.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><strong style="box-sizing: border-box; font-weight: bolder;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">UDP</span></span></strong><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;"> . </span><span style="box-sizing: border-box; vertical-align: inherit;">We use UDP to implement automatic discovery of <span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">location </span></span>engines. </span><span style="box-sizing: border-box; vertical-align: inherit;">If configured for automatic discovery of the <span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">location </span></span>engine, the network task will check whether a TCP connection is established with the <span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">location </span></span>engine. If not, it will broadcast a UDP packet (<span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">location </span></span>engine discovery packet) and request a reply from the <span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">location </span></span>engine. </span><span style="box-sizing: border-box; vertical-align: inherit;">After the <span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">location </span></span>engine receives the UDP packet, it will reply with information such as its own IP address. </span><span style="box-sizing: border-box; vertical-align: inherit;">The anchor will establish a TCP connection with the <span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">location </span></span>engine.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><strong style="box-sizing: border-box; font-weight: bolder;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Anchor configuration</span></span></strong><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;"> . </span><span style="box-sizing: border-box; vertical-align: inherit;">In earlier versions, we used UDP to transmit anchor configuration information. </span><span style="box-sizing: border-box; vertical-align: inherit;">The advantage of using UDP is that it can broadcast. The disadvantage is that UDP is connectionless and may be lost. </span><span style="box-sizing: border-box; vertical-align: inherit;">Later, we uniformly changed to using TCP to transmit anchor configuration information. </span><span style="box-sizing: border-box; vertical-align: inherit;">The anchor configuration program first uses UDP broadcast to find out which anchors are in the LAN, and then establishes TCP connections with them to transmit configuration information in both directions.</span></span></p> <h2 style="box-sizing: border-box; color: rgb(34, 38, 42); margin-top: 0px; margin-bottom: 0.5rem; font-weight: var(--cassiopeia-font-weight-headings,700); line-height: 1.2; font-size: 2rem; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Anchor Firmware Design-Miscellaneous Functions</span></span></h2> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><strong style="box-sizing: border-box; font-weight: bolder;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Reset factory setting</span></span></strong><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;"> . </span><span style="box-sizing: border-box; vertical-align: inherit;">In order to ensure data security, the anchor is set with a password, and the anchor configuration program must use the correct user name and password to configure the anchor. </span><span style="box-sizing: border-box; vertical-align: inherit;">Since it is a password, there is a possibility of forgetting it. </span><span style="box-sizing: border-box; vertical-align: inherit;">In addition, it is also possible that the user configured the anchor and messed up the data, and was too lazy to change it one by one, so we designed a factory reset function.</span></span></p> <pre class="language-c"><code>// RS232端口 GPIOA (被挪用于检测是否恢复出厂设置) #define USART1_TX PA9 // out #define USART1_RX PA10 // in #define USART1_PORT GPIOA if ((!GPIO_ReadInputDataBit(USART1_PORT, USART1_TX)) || (!GPIO_ReadInputDataBit(USART1_PORT, USART1_RX))) { //== 恢复出厂设置 RestoreToFactoryConfig(); HardReset(); }</code></pre> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">USART1_TX and USART1_RX are useless on factory products. Correspondingly, PA9 and PA10 are used to detect whether to restore factory settings. </span><span style="box-sizing: border-box; vertical-align: inherit;">When you need to restore factory settings, short one of these two pins to GND and power on again.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><strong style="box-sizing: border-box; font-weight: bolder;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Alarm function</span></span></strong><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;"> . </span><span style="box-sizing: border-box; vertical-align: inherit;">A customer plans to use our system in a coal mine (important reminder, the product requires intrinsic safety certification before being used in a coal mine) and needs to add an alarm function. </span><span style="box-sizing: border-box; vertical-align: inherit;">When a danger occurs, the system can send an alarm message to the tag so that workers carrying the tag can receive evacuation signals in time. </span><span style="box-sizing: border-box; vertical-align: inherit;">The process is roughly like this. The application calls the interface of the <span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">location </span></span>engine. The <span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">location </span></span>engine sends the data packet to the clock source (or the anchor that plays the role of the clock name) through the network. The clock source sends a UWB alarm data packet in the task of sending the clock synchronization data packet. <br>After the tag receives the UWB alarm data packet, it will immediately alarm (red light, or vibrate). </span><span style="box-sizing: border-box; vertical-align: inherit;">There are two types of alarm messages: broadcast to everyone, and tags with specified IDs.</span></span></p> <h2 style="box-sizing: border-box; color: rgb(34, 38, 42); margin-top: 0px; margin-bottom: 0.5rem; font-weight: var(--cassiopeia-font-weight-headings,700); line-height: 1.2; font-size: 2rem; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Anchor firmware design - trap you may encounter</span></span></h2> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">The first trap is the status of DW1000. </span><span style="box-sizing: border-box; vertical-align: inherit;">It's been said before. </span><span style="box-sizing: border-box; vertical-align: inherit;">We need to regularly check the working status of DW1000 in the system. If it is abnormal, reset DW1000 in time.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">The second trap is the W5500 crystal oscillator. </span><span style="box-sizing: border-box; vertical-align: inherit;">When we first mass-produced the anchor, the W5500 used a passive crystal oscillator. This was a normal circuit design. Our previous test boards were all designed in this way. </span><span style="box-sizing: border-box; vertical-align: inherit;">The W5500 we used in some previous products also used passive crystal oscillators. </span><span style="box-sizing: border-box; vertical-align: inherit;">However, the production of the anchor was completed. After receiving the goods, the test found that the W5500 crystal oscillators of many anchors did not vibrate. </span><span style="box-sizing: border-box; vertical-align: inherit;">At that time, I tried various methods to find out the cause, including changing the pad capacitor, re-soldering, etc. </span><span style="box-sizing: border-box; vertical-align: inherit;">This vibration starting problem seems to be in an uncertain state. Some will start by themselves after a period of time after powering on, some will never vibrate, and some will even start to vibrate and then stop by themselves. </span><span style="box-sizing: border-box; vertical-align: inherit;">As a result, we have to judge the status of the W5500 during firmware initialization to see if it is normal, and we also frequently judge the status of the W5500 during network tasks. </span><span style="box-sizing: border-box; vertical-align: inherit;">Later, our hardware design switched to active crystal oscillator, and everything was OK. </span><span style="box-sizing: border-box; vertical-align: inherit;">After that, our other products using W5500 all used active crystal oscillators.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><em style="box-sizing: border-box;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">This is the second article on anchor firmware design. I will go back to update some details later.</span></span></em></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="bS3qUOJ3"><em style="box-sizing: border-box;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">This website is our home base, and this series of articles will be updated from time to time. </span><span style="box-sizing: border-box; vertical-align: inherit;">In addition to this site, this series of articles is also published on </span></span><a style="box-sizing: border-box; color: var(--link-color); text-decoration: underline;" href="https://translate.google.com/website?sl=en&amp;tl=zh-CN&amp;hl=zh-CN&amp;client=webapp&amp;u=https://www.zhihu.com/column/c_1725823226259939328" target="_blank" rel="noopener"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Zhihu</span></span></a><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;"> , </span></span><a style="box-sizing: border-box; color: var(--link-color); text-decoration: underline;" href="https://translate.google.com/website?sl=en&amp;tl=zh-CN&amp;hl=zh-CN&amp;client=webapp&amp;u=https://www.cnblogs.com/bd8ncf/" target="_blank" rel="noopener"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">cnBlogs</span></span></a><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;"> , </span></span><a style="box-sizing: border-box; color: var(--link-color); text-decoration: underline;" href="https://translate.google.com/website?sl=en&amp;tl=zh-CN&amp;hl=zh-CN&amp;client=webapp&amp;u=https://blog.csdn.net/weixin_43986679?type%3Dblog" target="_blank" rel="noopener"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">CSDN</span></span></a><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;"> and other websites.</span></span></em></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><em style="box-sizing: border-box;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">By the way, I'm looking for a job. Due to business reasons, the company was dissolved. I have 30+ years of work experience, 20+ years of experience in C/C++/Java/Delphi, and a little bit of Javascript/Python/Lua. <br>In 199x, I wrote a Chinese character system in x86 assembly, and later used Delphi to write a mail server. I have written countless application systems, and the code I have written should exceed 2 million lines. <br>10+ years of hardware design experience, designing multiple embedded products. In the early stages of this UWB location system, the hardware and software were all developed by me alone, and the team was only built later. Base Guiyang, China, or remotely. <br>If there are job opportunities, please contact me for a detailed resume.</span></span></em></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"> </p> <p>This is a series of articles that will introduce you to how to implement a UWB precise location system using TDOA technology.</p> <p>IMPORTANT NOTE:</p> <ul> <li>Q: Do I need basic knowledge to create this location system?</li> <li><span style="color: rgb(45, 194, 107);">A: This article is not for beginners. It requires a basic knowledge of electronic technology and software programming.</span></li> <li>Q: Are your hardware/software open source?</li> <li style="color: rgb(45, 194, 107);"><span style="color: rgb(45, 194, 107);">A: It is not open source. <br>In the article, I will introduce how to implement the UWB location system and tell you how to overcome the difficulties, but I will not directly give you the Gerber file of the PCB to make a board, nor will I give you the source code of the software, nor will I give you the compiled firmware. <br>I'm not going to give you any direct results, I'm just telling you how.</span></li> <li>Q: I am personally very interested in UWB location. Can I make a location system?</li> <li style="color: rgb(45, 194, 107);"><span style="color: rgb(45, 194, 107);">A: If you have a strong hardware/software background and a lot of time, you can certainly do it. This article is just for you to read!</span></li> <li>Q: I am a commercial company and I want to develop the UWB location system into a commercial product.</li> <li style="color: rgb(45, 194, 107);"><span style="color: rgb(45, 194, 107);">A: Of course. This article is also written for you. If you want to build the entire system from zero, after reading my article, you only need to draw the circuit and make the board; conceive the software structure and then coding. <br>In this way, I will mention all the difficulties in the article and introduce the solutions. <span style="color: rgb(224, 62, 45);">You don't need to hire people to do algorithm research</span>. If you want to save trouble and time, you can directly purchase our circuit diagram (AD engineering files), purchase our software source code, and then quickly enter the production process. (Website: https://uwbhome.top )</span></li> </ul> <p><span data-cke-copybin-start="1">​</span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><em style="box-sizing: border-box;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">The previous article introduced the method of clock synchronization, in order to get some practical information out as soon as possible, so that readers would not think that I only wrote some general talk without technical content. </span><span style="box-sizing: border-box; vertical-align: inherit;">Write slowly next step.</span></span></em></p> <h2 style="box-sizing: border-box; color: rgb(34, 38, 42); margin-top: 0px; margin-bottom: 0.5rem; font-weight: var(--cassiopeia-font-weight-headings,700); line-height: 1.2; font-size: 2rem; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Anchor firmware design-Flash layout</span></span></h2> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">When writing firmware for an MCU, if you are a beginner, you may start writing applications directly as soon as you get started. </span><span style="box-sizing: border-box; vertical-align: inherit;">Veterans will first consider the layout, what things are to be done, what is the relationship between them, etc., and must be considered thoroughly.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">The Flash of the anchor is divided into 4 blocks: Bootloader, Application1, Application2, and Data.\</span></span></p> <h2 style="box-sizing: border-box; color: rgb(34, 38, 42); margin-top: 0px; margin-bottom: 0.5rem; font-weight: var(--cassiopeia-font-weight-headings,700); line-height: 1.2; font-size: 2rem; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Anchor </span></span><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">firmware design-online upgrade</span></span></h2> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">It is important that the product's firmware is field upgradeable. </span><span style="box-sizing: border-box; vertical-align: inherit;">On-site upgrade means that the firmware can be upgraded directly at the customer's site through a local area network or the like without removing the installed product. </span><span style="box-sizing: border-box; vertical-align: inherit;">You know, when a product has been installed at a customer site thousands of kilometers away, and you suddenly find a bug in the firmware, what should you do? </span><span style="box-sizing: border-box; vertical-align: inherit;">If it can be upgraded on site, the code will be corrected in the office, new firmware will be generated, sent to customers on site, and the firmware will be upgraded on site. </span><span style="box-sizing: border-box; vertical-align: inherit;">During this process, you don't need to leave your office at all.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">If the firmware of your product cannot be upgraded on site, I'm sorry. After discovering the bug, you can only ask the customer to disassemble the product and send it back to the company. You can flash the new firmware and send it to the customer... It's a headache to think about it.</span></span></p> <h3 style="box-sizing: border-box; color: rgb(34, 38, 42); margin-top: 0px; margin-bottom: 0.5rem; font-weight: var(--cassiopeia-font-weight-headings,700); line-height: 1.2; font-size: 1.75rem; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Anchor firmware design-Bootloader</span></span></h3> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Bootloader is the startup code, Application1/Application2 are the applications, and Data holds the configuration data.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">When powering on, the program in the Bootloader is executed first. It determines which Application1/Application2 is valid and jumps to the valid Application for execution. </span><span style="box-sizing: border-box; vertical-align: inherit;">There are two variables in the Data area: Application1Valid and Application2Valid. If True, the corresponding Application is valid.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">In the production stage, the worker responsible for production is only responsible for flashing the Bootloader. At this time, Application1Valid and Application2Valid are both False.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">After powering on, if a valid Application cannot be found, the Bootloader will start the network part of the code: DHCP Client/TCP Client/DNS Client/UDP Server/UDP Client, etc. </span><span style="box-sizing: border-box; vertical-align: inherit;">If it is connected to the network, it will always send a UDP packet to the network to request initialization.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">After the factory initialization program receives the UDP packet requesting initialization, it will register the basic information of the new anchor, such as MCU ID, etc., and then assign it an EUI64 address. This address will later be the ID of the anchor. </span><span style="box-sizing: border-box; vertical-align: inherit;">A serial number is also assigned. </span><span style="box-sizing: border-box; vertical-align: inherit;">Then the default configuration data must be written. </span><span style="box-sizing: border-box; vertical-align: inherit;">The factory initialization process then begins sending firmware to the new anchor. </span><span style="box-sizing: border-box; vertical-align: inherit;">After the bootloader receives the firmware, it writes it to an invalid Application area (at the beginning, the Application1 area must be invalid). </span><span style="box-sizing: border-box; vertical-align: inherit;">The firmware will be sent in many packages. </span><span style="box-sizing: border-box; vertical-align: inherit;">After receiving the firmware, the Bootloader will set Applicaiton1Valid to True and then restart.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">After powering on again, the Bootloader finds that Application1 is valid and jumps to Application1 for execution.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">This completes the startup of the new firmware.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">In fact, the network-related code and firmware receiving code in the Bootloader are only executed once during factory initialization and will not be executed again in the future. </span><span style="box-sizing: border-box; vertical-align: inherit;">Because after leaving the factory, one of Application1 and Application2 is always valid.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">If the bootloader finds that both areas are valid, it will invalidate the second area. </span><span style="box-sizing: border-box; vertical-align: inherit;">Only one area is allowed to be valid, and the invalid area is reserved for the new upgraded firmware.</span></span></p> <h3 style="box-sizing: border-box; color: rgb(34, 38, 42); margin-top: 0px; margin-bottom: 0.5rem; font-weight: var(--cassiopeia-font-weight-headings,700); line-height: 1.2; font-size: 1.75rem; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Anchor firmware design-firmware upgrade</span></span></h3> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">In the firmware Application, there is also a firmware upgrade code similar to the aforementioned Bootloader. </span><span style="box-sizing: border-box; vertical-align: inherit;">It just needs to determine which area is invalid, save the received new firmware to the invalid area, and set the corresponding variables to be valid, and set the variables corresponding to the running area to be invalid. </span><span style="box-sizing: border-box; vertical-align: inherit;">The next time the power is turned on, the Bootloader will jump to the new firmware for execution.</span></span></p> <h2 style="box-sizing: border-box; color: rgb(34, 38, 42); margin-top: 0px; margin-bottom: 0.5rem; font-weight: var(--cassiopeia-font-weight-headings,700); line-height: 1.2; font-size: 2rem; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Anchor firmware design-program structure</span></span></h2> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Now I will introduce how to write Application.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Because the anchor still has a lot of functions, several functions need to be executed "concurrently". </span><span style="box-sizing: border-box; vertical-align: inherit;">"Concurrency" here refers to logic, because STM32 does not support preemptive execution/does not support multi-threading/has only one core, all codes can only be executed sequentially, and there will be no real concurrency.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Therefore, MCU cannot run naked and must use RTOS. </span><span style="box-sizing: border-box; vertical-align: inherit;">At first, because I was familiar with uCOS, I used it. </span><span style="box-sizing: border-box; vertical-align: inherit;">If I were to choose now, I would most likely use FreeRTOS.</span></span></p> <ul style="box-sizing: border-box; padding-left: 2rem; margin-top: 0px; margin-bottom: 1rem; overflow: hidden; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"> <li style="box-sizing: border-box;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">For the clock synchronization part, if it is used as a clock source, UWB clock synchronization packets need to be sent regularly;</span></span></li> <li style="box-sizing: border-box;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">UWB chip processing is responsible for the status management of DW1000 and the sending and receiving of UWB data packets.</span></span></li> <li style="box-sizing: border-box;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Network processing, including DHCP Client/DNS Client/UDP Server/UDP Client, etc.</span></span></li> <li style="box-sizing: border-box;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">watchdog task</span></span></li> </ul> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Let’s start with the simple part first.</span></span></p> <h3 style="box-sizing: border-box; color: rgb(34, 38, 42); margin-top: 0px; margin-bottom: 0.5rem; font-weight: var(--cassiopeia-font-weight-headings,700); line-height: 1.2; font-size: 1.75rem; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">watchdog task</span></span></h3> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">STM32 has a watchdog. If the dog feeding function is not called in time, the MCU will think that the program has hung up and it will automatically reset. </span><span style="box-sizing: border-box; vertical-align: inherit;">Our program is divided into many tasks, and each task may fail, so we create a watchdog task. </span><span style="box-sizing: border-box; vertical-align: inherit;">Each task has a watchdog variable, which is set to 0 by each task in time. The watchdog task loop adds 1 to these variables and determines the value of these variables. If it exceeds a certain limit, the corresponding task is judged to have hung up. , reset the MCU. </span><span style="box-sizing: border-box; vertical-align: inherit;">The watchdog task is also responsible for feeding the dogs.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">In short, we must ensure that each task can work normally and reset it immediately when the task hangs up.</span></span></p> <h3 style="box-sizing: border-box; color: rgb(34, 38, 42); margin-top: 0px; margin-bottom: 0.5rem; font-weight: var(--cassiopeia-font-weight-headings,700); line-height: 1.2; font-size: 1.75rem; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">DW1000 processing tasks</span></span></h3> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Considering that multiple DW1000s may be built into one anchor in the future, we define DW1000 related data as a structure:</span></span></p> <pre class="language-c"><code>typedef struct __DW1000_MODULE__ { uint16_t Module_SPI_Prescaler; SPI_TypeDef* SPIn; GPIO_TypeDef* Module_SPI_Port; uint16_t Module_SPI_SCK_Pin; uint16_t Module_SPI_MISO_Pin; uint16_t Module_SPI_MOSI_Pin; GPIO_TypeDef* Module_SPI_CS_Port; uint16_t Module_SPI_CS_Pin; GPIO_TypeDef* Module_RSTn_Port; uint16_t Module_RSTn_Pin; GPIO_TypeDef* Module_RST_IRQ_Port; uint16_t Module_RST_IRQ_Pin; uint32_t Module_RST_IRQ_EXTI_Line; uint8_t Module_RST_IRQ_EXTI_PortSource; uint8_t Module_RST_IRQ_EXTI_PinSource; IRQn_Type Module_RST_IRQ_EXTI_IRQn; GPIO_TypeDef* Module_IRQ_Port; uint16_t Module_IRQ_Pin; uint32_t Module_IRQ_EXTI_Line; uint8_t Module_IRQ_EXTI_PortSource; uint8_t Module_IRQ_EXTI_PinSource; IRQn_Type Module_IRQ_EXTI_IRQn; uint8_t Module_IRQ_EXTI_USEIRQ; uint8_t Module_RST_IRQ_EXTI_USEIRQ; uint8_t crystal_oscillator_trim; uint8_t rx_buffer[RX_BUF_LEN]; DW_EVENT DWEvents[MAX_EVENT_NUMBER]; uint8_t DWEventIdxIn, DWEventIdxOut; DW_EVENT dw_event_g; CLOCKSOURCE_SYNC_INFO clockSourceSyncInfo[CLOCKSOURCE_SYNC_INFO_NUM]; SEEN_CLOCK_SOURCE seenClockSources[SEEN_CLOCK_SOURCE_NUM]; dwt_local_data_t dw1000Local; } DW1000_MODULE; typedef DW1000_MODULE* PDW1000_MODULE;</code></pre> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">In this case, some code can be reused, and the program will be more flexible.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">I want to complain about DecaWave here. The working condition of DW1000 is not very stable. </span><span style="box-sizing: border-box; vertical-align: inherit;">Sometimes some strange phenomena occur. </span><span style="box-sizing: border-box; vertical-align: inherit;">Therefore, we must often judge the status of DW1000. If it is not in the expected status, it is determined to be dead, and we must reset DW1000 in time. </span><span style="box-sizing: border-box; vertical-align: inherit;">Of course, there aren’t many of these cases, but when they are, we have to deal with them. </span><span style="box-sizing: border-box; vertical-align: inherit;">Otherwise, at the customer site, the anchor and firmware are alive, but the DW1000 is dead and cannot send or receive data, which would be very embarrassing.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">The main job of the anchor is to receive UWB data packets. In order to ensure that the received data packets can be processed in time without affecting the reception of subsequent UWB packets, we have created a queue for caching. </span><span style="box-sizing: border-box; vertical-align: inherit;">The DW1000 task only receives UWB packets, puts them in the queue immediately after receiving them, and then processes subsequent UWB packets. </span><span style="box-sizing: border-box; vertical-align: inherit;">Packets in the queue are processed by other tasks.</span></span></p> <h3 style="box-sizing: border-box; color: rgb(34, 38, 42); margin-top: 0px; margin-bottom: 0.5rem; font-weight: var(--cassiopeia-font-weight-headings,700); line-height: 1.2; font-size: 1.75rem; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">network tasks</span></span></h3> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">The work of network tasks is more complicated.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">One of its most important tasks is to reassemble the received UWB into a new data packet and send it to the location engine.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Other tasks are auxiliary.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><strong style="box-sizing: border-box; font-weight: bolder;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">DHCP client</span></span></strong><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;"> . </span><span style="box-sizing: border-box; vertical-align: inherit;">In many cases, IP address management is troublesome. If each anchor configures IP addresses one by one, it will be a laborious task. </span><span style="box-sizing: border-box; vertical-align: inherit;">Generally speaking, unless the customer requires each device to be configured with a specified IP address, it is more convenient to use DHCP to assign IP addresses. </span><span style="box-sizing: border-box; vertical-align: inherit;">The W5500 chip has a DHCP client code example, just copy it and modify it. </span><span style="box-sizing: border-box; vertical-align: inherit;">Its code is not complete in processing, such as the renewal of DHCP IP address contract after expiration, and how to deal with IP address conflicts, etc. We have done some improvement work on the code.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><strong style="box-sizing: border-box; font-weight: bolder;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">DNS client</span></span></strong><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;"> . </span><span style="box-sizing: border-box; vertical-align: inherit;">In fact, it doesn’t need to be used. </span><span style="box-sizing: border-box; vertical-align: inherit;">If the location engine is not in the local area network, but in a far away place, such as a cloud host on the Internet. </span><span style="box-sizing: border-box; vertical-align: inherit;">It would be better to use DNS to specify the address of the <span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">location </span></span>engine. In case the IP address of the <span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">location </span></span>engine changes, the domain name can remain unchanged. </span><span style="box-sizing: border-box; vertical-align: inherit;">We do not use DNS. Most of our previous customers are within the local area network, and only a few have placed their <span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">location </span></span>engines on the Internet.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><strong style="box-sizing: border-box; font-weight: bolder;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">UDP</span></span></strong><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;"> . </span><span style="box-sizing: border-box; vertical-align: inherit;">We use UDP to implement automatic discovery of <span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">location </span></span>engines. </span><span style="box-sizing: border-box; vertical-align: inherit;">If configured for automatic discovery of the <span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">location </span></span>engine, the network task will check whether a TCP connection is established with the <span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">location </span></span>engine. If not, it will broadcast a UDP packet (<span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">location </span></span>engine discovery packet) and request a reply from the <span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">location </span></span>engine. </span><span style="box-sizing: border-box; vertical-align: inherit;">After the <span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">location </span></span>engine receives the UDP packet, it will reply with information such as its own IP address. </span><span style="box-sizing: border-box; vertical-align: inherit;">The anchor will establish a TCP connection with the <span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">location </span></span>engine.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><strong style="box-sizing: border-box; font-weight: bolder;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Anchor configuration</span></span></strong><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;"> . </span><span style="box-sizing: border-box; vertical-align: inherit;">In earlier versions, we used UDP to transmit anchor configuration information. </span><span style="box-sizing: border-box; vertical-align: inherit;">The advantage of using UDP is that it can broadcast. The disadvantage is that UDP is connectionless and may be lost. </span><span style="box-sizing: border-box; vertical-align: inherit;">Later, we uniformly changed to using TCP to transmit anchor configuration information. </span><span style="box-sizing: border-box; vertical-align: inherit;">The anchor configuration program first uses UDP broadcast to find out which anchors are in the LAN, and then establishes TCP connections with them to transmit configuration information in both directions.</span></span></p> <h2 style="box-sizing: border-box; color: rgb(34, 38, 42); margin-top: 0px; margin-bottom: 0.5rem; font-weight: var(--cassiopeia-font-weight-headings,700); line-height: 1.2; font-size: 2rem; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Anchor Firmware Design-Miscellaneous Functions</span></span></h2> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><strong style="box-sizing: border-box; font-weight: bolder;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Reset factory setting</span></span></strong><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;"> . </span><span style="box-sizing: border-box; vertical-align: inherit;">In order to ensure data security, the anchor is set with a password, and the anchor configuration program must use the correct user name and password to configure the anchor. </span><span style="box-sizing: border-box; vertical-align: inherit;">Since it is a password, there is a possibility of forgetting it. </span><span style="box-sizing: border-box; vertical-align: inherit;">In addition, it is also possible that the user configured the anchor and messed up the data, and was too lazy to change it one by one, so we designed a factory reset function.</span></span></p> <pre class="language-c"><code>// RS232端口 GPIOA (被挪用于检测是否恢复出厂设置) #define USART1_TX PA9 // out #define USART1_RX PA10 // in #define USART1_PORT GPIOA if ((!GPIO_ReadInputDataBit(USART1_PORT, USART1_TX)) || (!GPIO_ReadInputDataBit(USART1_PORT, USART1_RX))) { //== 恢复出厂设置 RestoreToFactoryConfig(); HardReset(); }</code></pre> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">USART1_TX and USART1_RX are useless on factory products. Correspondingly, PA9 and PA10 are used to detect whether to restore factory settings. </span><span style="box-sizing: border-box; vertical-align: inherit;">When you need to restore factory settings, short one of these two pins to GND and power on again.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><strong style="box-sizing: border-box; font-weight: bolder;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Alarm function</span></span></strong><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;"> . </span><span style="box-sizing: border-box; vertical-align: inherit;">A customer plans to use our system in a coal mine (important reminder, the product requires intrinsic safety certification before being used in a coal mine) and needs to add an alarm function. </span><span style="box-sizing: border-box; vertical-align: inherit;">When a danger occurs, the system can send an alarm message to the tag so that workers carrying the tag can receive evacuation signals in time. </span><span style="box-sizing: border-box; vertical-align: inherit;">The process is roughly like this. The application calls the interface of the <span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">location </span></span>engine. The <span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">location </span></span>engine sends the data packet to the clock source (or the anchor that plays the role of the clock name) through the network. The clock source sends a UWB alarm data packet in the task of sending the clock synchronization data packet. <br>After the tag receives the UWB alarm data packet, it will immediately alarm (red light, or vibrate). </span><span style="box-sizing: border-box; vertical-align: inherit;">There are two types of alarm messages: broadcast to everyone, and tags with specified IDs.</span></span></p> <h2 style="box-sizing: border-box; color: rgb(34, 38, 42); margin-top: 0px; margin-bottom: 0.5rem; font-weight: var(--cassiopeia-font-weight-headings,700); line-height: 1.2; font-size: 2rem; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Anchor firmware design - trap you may encounter</span></span></h2> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">The first trap is the status of DW1000. </span><span style="box-sizing: border-box; vertical-align: inherit;">It's been said before. </span><span style="box-sizing: border-box; vertical-align: inherit;">We need to regularly check the working status of DW1000 in the system. If it is abnormal, reset DW1000 in time.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">The second trap is the W5500 crystal oscillator. </span><span style="box-sizing: border-box; vertical-align: inherit;">When we first mass-produced the anchor, the W5500 used a passive crystal oscillator. This was a normal circuit design. Our previous test boards were all designed in this way. </span><span style="box-sizing: border-box; vertical-align: inherit;">The W5500 we used in some previous products also used passive crystal oscillators. </span><span style="box-sizing: border-box; vertical-align: inherit;">However, the production of the anchor was completed. After receiving the goods, the test found that the W5500 crystal oscillators of many anchors did not vibrate. </span><span style="box-sizing: border-box; vertical-align: inherit;">At that time, I tried various methods to find out the cause, including changing the pad capacitor, re-soldering, etc. </span><span style="box-sizing: border-box; vertical-align: inherit;">This vibration starting problem seems to be in an uncertain state. Some will start by themselves after a period of time after powering on, some will never vibrate, and some will even start to vibrate and then stop by themselves. </span><span style="box-sizing: border-box; vertical-align: inherit;">As a result, we have to judge the status of the W5500 during firmware initialization to see if it is normal, and we also frequently judge the status of the W5500 during network tasks. </span><span style="box-sizing: border-box; vertical-align: inherit;">Later, our hardware design switched to active crystal oscillator, and everything was OK. </span><span style="box-sizing: border-box; vertical-align: inherit;">After that, our other products using W5500 all used active crystal oscillators.</span></span></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><em style="box-sizing: border-box;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">This is the second article on anchor firmware design. I will go back to update some details later.</span></span></em></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="bS3qUOJ3"><em style="box-sizing: border-box;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">This website is our home base, and this series of articles will be updated from time to time. </span><span style="box-sizing: border-box; vertical-align: inherit;">In addition to this site, this series of articles is also published on </span></span><a style="box-sizing: border-box; color: var(--link-color); text-decoration: underline;" href="https://translate.google.com/website?sl=en&amp;tl=zh-CN&amp;hl=zh-CN&amp;client=webapp&amp;u=https://www.zhihu.com/column/c_1725823226259939328" target="_blank" rel="noopener"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Zhihu</span></span></a><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;"> , </span></span><a style="box-sizing: border-box; color: var(--link-color); text-decoration: underline;" href="https://translate.google.com/website?sl=en&amp;tl=zh-CN&amp;hl=zh-CN&amp;client=webapp&amp;u=https://www.cnblogs.com/bd8ncf/" target="_blank" rel="noopener"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">cnBlogs</span></span></a><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;"> , </span></span><a style="box-sizing: border-box; color: var(--link-color); text-decoration: underline;" href="https://translate.google.com/website?sl=en&amp;tl=zh-CN&amp;hl=zh-CN&amp;client=webapp&amp;u=https://blog.csdn.net/weixin_43986679?type%3Dblog" target="_blank" rel="noopener"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">CSDN</span></span></a><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;"> and other websites.</span></span></em></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><em style="box-sizing: border-box;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">By the way, I'm looking for a job. Due to business reasons, the company was dissolved. I have 30+ years of work experience, 20+ years of experience in C/C++/Java/Delphi, and a little bit of Javascript/Python/Lua. <br>In 199x, I wrote a Chinese character system in x86 assembly, and later used Delphi to write a mail server. I have written countless application systems, and the code I have written should exceed 2 million lines. <br>10+ years of hardware design experience, designing multiple embedded products. In the early stages of this UWB location system, the hardware and software were all developed by me alone, and the team was only built later. Base Guiyang, China, or remotely. <br>If there are job opportunities, please contact me for a detailed resume.</span></span></em></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"> </p> How to implement UWB precise location system with TDOA technology(4) 2024-01-11T03:34:14+08:00 2024-01-11T03:34:14+08:00 https://entest.autoop.net/technology/howto-implement-tdoa-uwb-rtls-4.html zhang <p>This is a series of articles that will introduce you to how to implement a UWB precise location system using TDOA technology.</p> <p>IMPORTANT NOTE:</p> <ul> <li>Q: Do I need basic knowledge to create this location system?</li> <li><span style="color: rgb(45, 194, 107);">A: This article is not for beginners. It requires a basic knowledge of electronic technology and software programming.</span></li> <li>Q: Are your hardware/software open source?</li> <li style="color: rgb(45, 194, 107);"><span style="color: rgb(45, 194, 107);">A: It is not open source. In the article, I will introduce how to implement the UWB location system and tell you how to overcome the difficulties, but I will not directly give you the Gerber file of the PCB to make a board, nor will I give you the source code of the software, nor will I give you the compiled firmware. I'm not going to give you any direct results, I'm just telling you how.</span></li> <li>Q: I am personally very interested in UWB location. Can I make a location system?</li> <li style="color: rgb(45, 194, 107);"><span style="color: rgb(45, 194, 107);">A: If you have a strong hardware/software background and a lot of time, you can certainly do it. This article is just for you to read!</span></li> <li>Q: I am a commercial company and I want to develop the UWB location system into a commercial product.</li> <li style="color: rgb(45, 194, 107);"><span style="color: rgb(45, 194, 107);">A: Of course. This article is also written for you. If you want to build the entire system from zero, after reading my article, you only need to draw the circuit and make the board; conceive the software structure and then coding. In this way, I will mention all the difficulties in the article and introduce the solutions. <span style="color: rgb(224, 62, 45);">You don't need to hire people to do algorithm research</span>. If you want to save trouble and time, you can directly purchase our circuit diagram (AD engineering files), purchase our software source code, and then quickly enter the production process. (Website: https://uwbhome.top )</span></li> </ul> <h2>Tag firmware design</h2> <p>In the previous article, I introduced the hardware design of the location anchor and tags, and the firmware design of the anchor (including the algorithm principle of clock synchronization). According to the normal roadmap, the next step should be the firmware design of the tag. But the tag's firmware is really simple and there isn't much content to write. After thinking about it, I decided to write an article for it.</p> <p>The most important function of the tag is to regularly send TDOA location data packets, and other functions are additional. This function is too simple to implement. Many of the sample codes provided by decawave can send uwb data packets, but the format of the data packets needs to comply with our definition.</p> <p>The format of the UWB TDOA location data packet we define is as follows:</p> <pre class="language-c"><code>// Tag测距帧 // 广播帧, Tag 发出的测距消息, 各个 Anchor 根据收到这个帧的时间差来应用 TDOA 测距 typedef struct ieee154_broadcast_tag_range_frame { uint8_t frameCtrl[2]; // 0, 2: frame control bytes 00-01: 0x01 (Frame Type 0x01=date), 0xC8 (0xC0=src extended address 64 bits, 0x08=dest address 16 bits) uint8_t seq8; // 2, 1: sequence_number 02 uint8_t panID[2]; // 3, 2: PAN ID 03-04 uint8_t destAddr[2]; // 5, 2: 0xFFFF uint8_t sourceAddr[8]; // 7, 8: 64Bits EUI地址 uint8_t messageType; // 15, 1: Message Type = RTLS_MSG_TYPE_TAG_RANGE uint8_t seq64[8]; // 16, 8: Tag 发出的测距消息序号, 比 seq8 有更在的最大值 uint8_t powerVoltage[2]; // 24, 2: 电源电压*1000 uint8_t batteryVoltage[2]; // 26, 2: 电池电压*1000 uint8_t lighteness[2]; // 28, 2: 亮度, 直接 ADC 转换过来的值 uint8_t switchStatus; // 30, 1: 开关状态 int16_t imu_aacx; // 31, 2: int16_t imu_aacy; // 33, 2: int16_t imu_aacz; // 35, 2: int32_t imu_roll; // 37, 4: int32_t imu_pitch; // 41, 4: int32_t imu_yaw; // 45, 4: int16_t imu_temp; // 49, 2: uint8_t fcs[2]; // 51, 2 } BROADCAST_TAG_RANGE_MESSAGE;</code></pre> <p data-first-child="" data-pid="CQ3VPkNC"> </p> <p data-first-child="" data-pid="CQ3VPkNC">Later we found that this data packet was too big and there were many fields that were unnecessary, so we changed it to a smaller format:</p> <pre class="language-c"><code>// Tag测距帧, 最小测距帧 // 广播帧, Tag 发出的测距消息, 各个 Anchor 根据收到这个帧的时间差来应用 TDOA 测距 typedef struct ieee154_broadcast_tag_range_min_frame_v2 { uint8_t frameCtrl[2]; // 0, 2: frame control bytes 00-01: 0x01 (Frame Type 0x01=date), 0xC8 (0xC0=src extended address 64 bits, 0x08=dest address 16 bits) uint8_t seq8; // 2, 1: sequence_number 02 uint8_t panID[2]; // 3, 2: PAN ID 03-04 uint8_t destAddr[2]; // 5, 2: 0xFFFF uint8_t sourceAddr[8]; // 7, 8: 64Bits EUI地址 uint8_t messageType; // 15, 1: Message Type = RTLS_MSG_TYPE_TAG_MIN_RANGE_V2 uint8_t seq32_3[3]; // 16, 3: Tag 发出的测距消息序号的高3字节, 与 seq8 组合为 seq32, 比 seq8 有更在的最大值 uint8_t switchStatus; // 19, 1: 开关状态 uint8_t fcs[2]; // 20, we allow space for the CRC as it is logically part of the message. However ScenSor TX calculates and adds these bytes. } BROADCAST_TAG_RANGE_MIN_MESSAGE_V2; // 以上合计 22 字节</code></pre> <p>Reduced from 53 bytes to 22 bytes. In this way, the time a location packet occupies the frequency during transmission is reduced by 42%. This means more tags can be accommodated.</p> <p>You should notice that the minimized data packet does not even contain voltage data. We also define a location data packet containing voltage data, which is sent regularly at intervals, because the battery voltage does not change rapidly. A packet of voltage information will do.</p> <p>A customer customized a tag with a heart rate sensor, and we also added a location data package containing heart rate and blood oxygen data.</p> <p>Unlike the anchor that can communicate through the network, the tag can only communicate via USB. The USB interface uses HID mode and can be driver-free. Do not use an analog COM port, because if you use COM communication, on the one hand, you need to install a driver, on the other hand, COM conflicts may occur, which will cause more trouble. Using the HID method is much simpler.</p> <p>USB communication requires the use of an external crystal oscillator, and the built-in RC oscillator of STM32 cannot be used. Because the frequency of the RC oscillator is not very accurate, if you use an RC oscillator, it may cause compatibility issues. On some computers, communication may fail due to inaccurate frequencies.</p> <p>The power saving mode of STM32 uses STOP mode, which is relatively moderate.</p> <p>Pay attention to the clock frequency of STM32. Under normal circumstances, the clock of STM32 is 72MHz. Because we do not need such high computing power, we can use 48MHz. A lower frequency can save power. Other lower frequencies will not work, because we also need to provide a 12MHz frequency for the USB part, and lower frequency combinations cannot produce 12MHz.</p> <p>Also, such a simple program does not need to run an OS, just run naked. There are two reasons for not running the OS:</p> <ol> <li>The structure of RTOS is complex, and we also need to enter the STOP state, which makes the program logic much more complicated.</li> <li>The RAM/Flash of the STM32F103CBT6 chip is relatively small and is not suitable for large programs.</li> </ol> <p>If you have any ideas, please leave me a message or comment.</p> <p>That's it for this article, except that the source code is not given directly. The next article will introduce the TDOA algorithm and location engine.</p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="bS3qUOJ3"><em style="box-sizing: border-box;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">This website is our home base, and this series of articles will be updated from time to time. </span><span style="box-sizing: border-box; vertical-align: inherit;">In addition to this site, this series of articles is also published on </span></span><a style="box-sizing: border-box; color: var(--link-color); text-decoration: underline;" href="https://translate.google.com/website?sl=en&amp;tl=zh-CN&amp;hl=zh-CN&amp;client=webapp&amp;u=https://www.zhihu.com/column/c_1725823226259939328" target="_blank" rel="noopener"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Zhihu</span></span></a><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;"> , </span></span><a style="box-sizing: border-box; color: var(--link-color); text-decoration: underline;" href="https://translate.google.com/website?sl=en&amp;tl=zh-CN&amp;hl=zh-CN&amp;client=webapp&amp;u=https://www.cnblogs.com/bd8ncf/" target="_blank" rel="noopener"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">cnBlogs</span></span></a><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;"> , </span></span><a style="box-sizing: border-box; color: var(--link-color); text-decoration: underline;" href="https://translate.google.com/website?sl=en&amp;tl=zh-CN&amp;hl=zh-CN&amp;client=webapp&amp;u=https://blog.csdn.net/weixin_43986679?type%3Dblog" target="_blank" rel="noopener"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">CSDN</span></span></a><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;"> and other websites.</span></span></em></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><em style="box-sizing: border-box;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">By the way, I'm looking for a job. Due to business reasons, the company was dissolved. I have 30+ years of work experience, 20+ years of experience in C/C++/Java/Delphi, and a little bit of Javascript/Python/Lua. In 199x, I wrote a Chinese character system in x86 assembly, and later used Delphi to write a mail server. I have written countless application systems, and the code I have written should exceed 2 million lines. 10+ years of hardware design experience, designing multiple embedded products. In the early stages of this UWB location system, the hardware and software were all developed by me alone, and the team was only built later. Base Guiyang, China, or remotely. If there are job opportunities, please contact me for a detailed resume.</span></span></em></p> <p data-pid="r4oonxe9"><em> </em></p> <p>This is a series of articles that will introduce you to how to implement a UWB precise location system using TDOA technology.</p> <p>IMPORTANT NOTE:</p> <ul> <li>Q: Do I need basic knowledge to create this location system?</li> <li><span style="color: rgb(45, 194, 107);">A: This article is not for beginners. It requires a basic knowledge of electronic technology and software programming.</span></li> <li>Q: Are your hardware/software open source?</li> <li style="color: rgb(45, 194, 107);"><span style="color: rgb(45, 194, 107);">A: It is not open source. In the article, I will introduce how to implement the UWB location system and tell you how to overcome the difficulties, but I will not directly give you the Gerber file of the PCB to make a board, nor will I give you the source code of the software, nor will I give you the compiled firmware. I'm not going to give you any direct results, I'm just telling you how.</span></li> <li>Q: I am personally very interested in UWB location. Can I make a location system?</li> <li style="color: rgb(45, 194, 107);"><span style="color: rgb(45, 194, 107);">A: If you have a strong hardware/software background and a lot of time, you can certainly do it. This article is just for you to read!</span></li> <li>Q: I am a commercial company and I want to develop the UWB location system into a commercial product.</li> <li style="color: rgb(45, 194, 107);"><span style="color: rgb(45, 194, 107);">A: Of course. This article is also written for you. If you want to build the entire system from zero, after reading my article, you only need to draw the circuit and make the board; conceive the software structure and then coding. In this way, I will mention all the difficulties in the article and introduce the solutions. <span style="color: rgb(224, 62, 45);">You don't need to hire people to do algorithm research</span>. If you want to save trouble and time, you can directly purchase our circuit diagram (AD engineering files), purchase our software source code, and then quickly enter the production process. (Website: https://uwbhome.top )</span></li> </ul> <h2>Tag firmware design</h2> <p>In the previous article, I introduced the hardware design of the location anchor and tags, and the firmware design of the anchor (including the algorithm principle of clock synchronization). According to the normal roadmap, the next step should be the firmware design of the tag. But the tag's firmware is really simple and there isn't much content to write. After thinking about it, I decided to write an article for it.</p> <p>The most important function of the tag is to regularly send TDOA location data packets, and other functions are additional. This function is too simple to implement. Many of the sample codes provided by decawave can send uwb data packets, but the format of the data packets needs to comply with our definition.</p> <p>The format of the UWB TDOA location data packet we define is as follows:</p> <pre class="language-c"><code>// Tag测距帧 // 广播帧, Tag 发出的测距消息, 各个 Anchor 根据收到这个帧的时间差来应用 TDOA 测距 typedef struct ieee154_broadcast_tag_range_frame { uint8_t frameCtrl[2]; // 0, 2: frame control bytes 00-01: 0x01 (Frame Type 0x01=date), 0xC8 (0xC0=src extended address 64 bits, 0x08=dest address 16 bits) uint8_t seq8; // 2, 1: sequence_number 02 uint8_t panID[2]; // 3, 2: PAN ID 03-04 uint8_t destAddr[2]; // 5, 2: 0xFFFF uint8_t sourceAddr[8]; // 7, 8: 64Bits EUI地址 uint8_t messageType; // 15, 1: Message Type = RTLS_MSG_TYPE_TAG_RANGE uint8_t seq64[8]; // 16, 8: Tag 发出的测距消息序号, 比 seq8 有更在的最大值 uint8_t powerVoltage[2]; // 24, 2: 电源电压*1000 uint8_t batteryVoltage[2]; // 26, 2: 电池电压*1000 uint8_t lighteness[2]; // 28, 2: 亮度, 直接 ADC 转换过来的值 uint8_t switchStatus; // 30, 1: 开关状态 int16_t imu_aacx; // 31, 2: int16_t imu_aacy; // 33, 2: int16_t imu_aacz; // 35, 2: int32_t imu_roll; // 37, 4: int32_t imu_pitch; // 41, 4: int32_t imu_yaw; // 45, 4: int16_t imu_temp; // 49, 2: uint8_t fcs[2]; // 51, 2 } BROADCAST_TAG_RANGE_MESSAGE;</code></pre> <p data-first-child="" data-pid="CQ3VPkNC"> </p> <p data-first-child="" data-pid="CQ3VPkNC">Later we found that this data packet was too big and there were many fields that were unnecessary, so we changed it to a smaller format:</p> <pre class="language-c"><code>// Tag测距帧, 最小测距帧 // 广播帧, Tag 发出的测距消息, 各个 Anchor 根据收到这个帧的时间差来应用 TDOA 测距 typedef struct ieee154_broadcast_tag_range_min_frame_v2 { uint8_t frameCtrl[2]; // 0, 2: frame control bytes 00-01: 0x01 (Frame Type 0x01=date), 0xC8 (0xC0=src extended address 64 bits, 0x08=dest address 16 bits) uint8_t seq8; // 2, 1: sequence_number 02 uint8_t panID[2]; // 3, 2: PAN ID 03-04 uint8_t destAddr[2]; // 5, 2: 0xFFFF uint8_t sourceAddr[8]; // 7, 8: 64Bits EUI地址 uint8_t messageType; // 15, 1: Message Type = RTLS_MSG_TYPE_TAG_MIN_RANGE_V2 uint8_t seq32_3[3]; // 16, 3: Tag 发出的测距消息序号的高3字节, 与 seq8 组合为 seq32, 比 seq8 有更在的最大值 uint8_t switchStatus; // 19, 1: 开关状态 uint8_t fcs[2]; // 20, we allow space for the CRC as it is logically part of the message. However ScenSor TX calculates and adds these bytes. } BROADCAST_TAG_RANGE_MIN_MESSAGE_V2; // 以上合计 22 字节</code></pre> <p>Reduced from 53 bytes to 22 bytes. In this way, the time a location packet occupies the frequency during transmission is reduced by 42%. This means more tags can be accommodated.</p> <p>You should notice that the minimized data packet does not even contain voltage data. We also define a location data packet containing voltage data, which is sent regularly at intervals, because the battery voltage does not change rapidly. A packet of voltage information will do.</p> <p>A customer customized a tag with a heart rate sensor, and we also added a location data package containing heart rate and blood oxygen data.</p> <p>Unlike the anchor that can communicate through the network, the tag can only communicate via USB. The USB interface uses HID mode and can be driver-free. Do not use an analog COM port, because if you use COM communication, on the one hand, you need to install a driver, on the other hand, COM conflicts may occur, which will cause more trouble. Using the HID method is much simpler.</p> <p>USB communication requires the use of an external crystal oscillator, and the built-in RC oscillator of STM32 cannot be used. Because the frequency of the RC oscillator is not very accurate, if you use an RC oscillator, it may cause compatibility issues. On some computers, communication may fail due to inaccurate frequencies.</p> <p>The power saving mode of STM32 uses STOP mode, which is relatively moderate.</p> <p>Pay attention to the clock frequency of STM32. Under normal circumstances, the clock of STM32 is 72MHz. Because we do not need such high computing power, we can use 48MHz. A lower frequency can save power. Other lower frequencies will not work, because we also need to provide a 12MHz frequency for the USB part, and lower frequency combinations cannot produce 12MHz.</p> <p>Also, such a simple program does not need to run an OS, just run naked. There are two reasons for not running the OS:</p> <ol> <li>The structure of RTOS is complex, and we also need to enter the STOP state, which makes the program logic much more complicated.</li> <li>The RAM/Flash of the STM32F103CBT6 chip is relatively small and is not suitable for large programs.</li> </ol> <p>If you have any ideas, please leave me a message or comment.</p> <p>That's it for this article, except that the source code is not given directly. The next article will introduce the TDOA algorithm and location engine.</p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;" data-pid="bS3qUOJ3"><em style="box-sizing: border-box;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">This website is our home base, and this series of articles will be updated from time to time. </span><span style="box-sizing: border-box; vertical-align: inherit;">In addition to this site, this series of articles is also published on </span></span><a style="box-sizing: border-box; color: var(--link-color); text-decoration: underline;" href="https://translate.google.com/website?sl=en&amp;tl=zh-CN&amp;hl=zh-CN&amp;client=webapp&amp;u=https://www.zhihu.com/column/c_1725823226259939328" target="_blank" rel="noopener"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">Zhihu</span></span></a><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;"> , </span></span><a style="box-sizing: border-box; color: var(--link-color); text-decoration: underline;" href="https://translate.google.com/website?sl=en&amp;tl=zh-CN&amp;hl=zh-CN&amp;client=webapp&amp;u=https://www.cnblogs.com/bd8ncf/" target="_blank" rel="noopener"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">cnBlogs</span></span></a><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;"> , </span></span><a style="box-sizing: border-box; color: var(--link-color); text-decoration: underline;" href="https://translate.google.com/website?sl=en&amp;tl=zh-CN&amp;hl=zh-CN&amp;client=webapp&amp;u=https://blog.csdn.net/weixin_43986679?type%3Dblog" target="_blank" rel="noopener"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">CSDN</span></span></a><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;"> and other websites.</span></span></em></p> <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1rem; color: rgb(34, 38, 42); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><em style="box-sizing: border-box;"><span style="box-sizing: border-box; vertical-align: inherit;"><span style="box-sizing: border-box; vertical-align: inherit;">By the way, I'm looking for a job. Due to business reasons, the company was dissolved. I have 30+ years of work experience, 20+ years of experience in C/C++/Java/Delphi, and a little bit of Javascript/Python/Lua. In 199x, I wrote a Chinese character system in x86 assembly, and later used Delphi to write a mail server. I have written countless application systems, and the code I have written should exceed 2 million lines. 10+ years of hardware design experience, designing multiple embedded products. In the early stages of this UWB location system, the hardware and software were all developed by me alone, and the team was only built later. Base Guiyang, China, or remotely. If there are job opportunities, please contact me for a detailed resume.</span></span></em></p> <p data-pid="r4oonxe9"><em> </em></p> André Chr. Andersen's paper "Signal Emitter Positioning Using Multilateration" 2024-01-08T08:50:34+08:00 2024-01-08T08:50:34+08:00 https://entest.autoop.net/technology/andr%C3%A9-chr-andersen-paper-signal-emitter-positioning-using-multilateration.html zhang <p class="entry-header">This article was published on André Chr. Andersen's blog, <a href="http://blog.andersen.im/2012/07/signal-emitter-positioning-using-multilateration">http://blog.andersen.im/2012/07/signal-emitter-positioning-using-multilateration</a> .</p> <p class="entry-header">Unfortunately, his blog cannot be opened now. Maybe he has no longer maintained it.</p> <p class="entry-header">The TDOA algorithm used by our first version of the positioning engine comes from this article of his. André Chr. Andersen also provided MATLAB code at the end of the article, and Paul Hayes translated his MATLAB code toy into Python code, which can be found on github <a href="https://github.com/paulhayes/MultilaterationExample">https://github.com/paulhayes/MultilaterationExample</a> .</p> <p>This algorithm is for ultrasonic positioning, but it is essentially the same as UWB positioning. The important thing is that this is a simple and easy-to-implement Multilateration algorithm, which can be used in UWB coordinate calculations after modification.</p> <header class="entry-header"></header> <p class="entry-header">Many thanks to André Chr. Andersen and Paul Hayes. Without their algorithms and codes, our project might have been terminated early.</p> <p class="entry-header">Andersen's algorithm works, but there are some problems. Mainly reflected in two aspects:</p> <ol> <li class="entry-header">The calculated coordinates are not accurate. The tag is more accurate when it is in the center of the area, but when the standard is at the edge of the area, the error becomes very large.</li> <li class="entry-header">Errors may occur during the iteration process in the algorithm, resulting in coordinates sometimes not being calculated. Due to the influence of various factors, the TDOA value we get is definitely inaccurate and has errors. In fact, what we expect to get is an approximate value. But the error is too large, and sometimes outrageous coordinates are obtained, which is more embarrassing.</li> </ol> <p>We later developed two algorithms ourselves, and finally adopted the least squares method, which achieved a better balance between speed and accuracy.</p> <p class="entry-header">The following is the Python code rewritten by Paul Hayes.</p> <header class="entry-header"></header><header class="entry-header"></header> <pre class="language-python"><code>########################### # # Python rewrite of multilateration technique by André Andersen in his [blog post](http://blog.andersen.im/2012/07/signal-emitter-positioning-using-multilateration). # ############################ from numpy import * from numpy.linalg import * import json #speed of sound in medium v = 3450 numOfDimensions = 3 nSensors = 5 region = 3 sensorRegion = 2 #choose a random sensor location emitterLocation = region * ( random.random_sample(numOfDimensions) - 0.5 ) sensorLocations = [ sensorRegion * ( random.random_sample(numOfDimensions)-0.5 ) for n in range(nSensors) ] p = matrix( sensorLocations ).T #Time from emitter to each sensor sensorTimes = [ sqrt( dot(location-emitterLocation,location-emitterLocation) ) / v for location in sensorLocations ] c = argmin(sensorTimes) cTime = sensorTimes[c] #sensors delta time relative to sensor c t = sensorDeltaTimes = [ sensorTime - cTime for sensorTime in sensorTimes ] ijs = range(nSensors) del ijs[c] A = zeros([nSensors-1,numOfDimensions]) b = zeros([nSensors-1,1]) iRow = 0 rankA = 0 for i in ijs: for j in ijs: A[iRow,:] = 2*( v*(t[j])*(p[:,i]-p[:,c]).T - v*(t[i])*(p[:,j]-p[:,c]).T ) b[iRow] = v*(t[i])*(v*v*(t[j])**2-p[:,j].T*p[:,j]) + \ (v*(t[i])-v*(t[j]))*p[:,c].T*p[:,c] + \ v*(t[j])*(p[:,i].T*p[:,i]-v*v*(t[i])**2) rankA = matrix_rank(A) if rankA &gt;= numOfDimensions : break iRow += 1 if rankA &gt;= numOfDimensions: break calculatedLocation = asarray( lstsq(A,b)[0] )[:,0] print "Emitter location: %s " % emitterLocation print "Calculated position of emitter: %s " % calculatedLocation</code></pre> <p class="entry-header">This article was published on André Chr. Andersen's blog, <a href="http://blog.andersen.im/2012/07/signal-emitter-positioning-using-multilateration">http://blog.andersen.im/2012/07/signal-emitter-positioning-using-multilateration</a> .</p> <p class="entry-header">Unfortunately, his blog cannot be opened now. Maybe he has no longer maintained it.</p> <p class="entry-header">The TDOA algorithm used by our first version of the positioning engine comes from this article of his. André Chr. Andersen also provided MATLAB code at the end of the article, and Paul Hayes translated his MATLAB code toy into Python code, which can be found on github <a href="https://github.com/paulhayes/MultilaterationExample">https://github.com/paulhayes/MultilaterationExample</a> .</p> <p>This algorithm is for ultrasonic positioning, but it is essentially the same as UWB positioning. The important thing is that this is a simple and easy-to-implement Multilateration algorithm, which can be used in UWB coordinate calculations after modification.</p> <header class="entry-header"></header> <p class="entry-header">Many thanks to André Chr. Andersen and Paul Hayes. Without their algorithms and codes, our project might have been terminated early.</p> <p class="entry-header">Andersen's algorithm works, but there are some problems. Mainly reflected in two aspects:</p> <ol> <li class="entry-header">The calculated coordinates are not accurate. The tag is more accurate when it is in the center of the area, but when the standard is at the edge of the area, the error becomes very large.</li> <li class="entry-header">Errors may occur during the iteration process in the algorithm, resulting in coordinates sometimes not being calculated. Due to the influence of various factors, the TDOA value we get is definitely inaccurate and has errors. In fact, what we expect to get is an approximate value. But the error is too large, and sometimes outrageous coordinates are obtained, which is more embarrassing.</li> </ol> <p>We later developed two algorithms ourselves, and finally adopted the least squares method, which achieved a better balance between speed and accuracy.</p> <p class="entry-header">The following is the Python code rewritten by Paul Hayes.</p> <header class="entry-header"></header><header class="entry-header"></header> <pre class="language-python"><code>########################### # # Python rewrite of multilateration technique by André Andersen in his [blog post](http://blog.andersen.im/2012/07/signal-emitter-positioning-using-multilateration). # ############################ from numpy import * from numpy.linalg import * import json #speed of sound in medium v = 3450 numOfDimensions = 3 nSensors = 5 region = 3 sensorRegion = 2 #choose a random sensor location emitterLocation = region * ( random.random_sample(numOfDimensions) - 0.5 ) sensorLocations = [ sensorRegion * ( random.random_sample(numOfDimensions)-0.5 ) for n in range(nSensors) ] p = matrix( sensorLocations ).T #Time from emitter to each sensor sensorTimes = [ sqrt( dot(location-emitterLocation,location-emitterLocation) ) / v for location in sensorLocations ] c = argmin(sensorTimes) cTime = sensorTimes[c] #sensors delta time relative to sensor c t = sensorDeltaTimes = [ sensorTime - cTime for sensorTime in sensorTimes ] ijs = range(nSensors) del ijs[c] A = zeros([nSensors-1,numOfDimensions]) b = zeros([nSensors-1,1]) iRow = 0 rankA = 0 for i in ijs: for j in ijs: A[iRow,:] = 2*( v*(t[j])*(p[:,i]-p[:,c]).T - v*(t[i])*(p[:,j]-p[:,c]).T ) b[iRow] = v*(t[i])*(v*v*(t[j])**2-p[:,j].T*p[:,j]) + \ (v*(t[i])-v*(t[j]))*p[:,c].T*p[:,c] + \ v*(t[j])*(p[:,i].T*p[:,i]-v*v*(t[i])**2) rankA = matrix_rank(A) if rankA &gt;= numOfDimensions : break iRow += 1 if rankA &gt;= numOfDimensions: break calculatedLocation = asarray( lstsq(A,b)[0] )[:,0] print "Emitter location: %s " % emitterLocation print "Calculated position of emitter: %s " % calculatedLocation</code></pre> Hardware Design of Location Anchor 2023-12-04T03:50:27+08:00 2023-12-04T03:50:27+08:00 https://entest.autoop.net/technology/design-anchor-hw.html zhang <h3>Hardware Design of Location Anchor</h3> <p>The main control of the location anchor is STM32F103RET6. This MCU has a relatively large Flash and a relatively large RAM, and is suitable for running RTOS.</p> <p>The UWB transceiver of the anchor uses the DW1000 chip. We directly used the DWM1000 module in the early stage, because the DWM1000 module has already completed the radio frequency part and provides some SPI interfaces to the outside world. We do not need to worry about the analog part of the circuit and can just focus on the logic circuit. Later, some anchor types were added, and some changes were made in this part. Several new designs were added: (1) Making your own modules similar to DWM1000 can save costs; (2) Your own UWB modules use ceramic antennas or PCB antennas, and there are also IPX The base lead uses an external high-gain underline; (3) Add PA/LNA. The original communication distance can reach up to 300 meters at the rate of 850K, and it can reach more than 1000 meters after adding PA/LNA.</p> <p>The network interface chip uses W5500. This chip uses SPI interface and the network speed is 100M. In fact, judging from the amount of UWB data, 100M is too much, and 10M is enough.</p> <p>There are two designs for the power supply: (1) using POE power supply, which is used in major mass production models; (2) using DC-DC to convert 12V to 3.3V for use by on-board devices, which is used in the initial prototype and Used upon request by some OEM customers.</p> <p>We also have a model of anchor that integrates a network switch chip and POE power supply. Multiple anchors can be cascaded and strung together to save wiring costs.</p> <p>The research and development process of the anchor goes through several stages.</p> <p>The first stage is experimental in nature.</p> <p>{phocagallery view=category|alias=anchor-dev-try}</p> <p> </p> <p>As you can see from the picture above, during the design, the network not only supports Ethernet (RJ45 interface), but also supports WIFI and uses 12V power supply. WIFI uses the ESP8266 module. A large box is used for the casing.</p> <p>The second stage is miniaturization.</p> <p>{phocagallery view=category|alias=anchor-dev-small}</p> <p>As can be seen from the above picture, ESP WIFI is no longer considered. The DW1000 module is fixed in the center of the anchor through the adapter board. On the one hand, the box space is smaller, and on the other hand, the DW1000 module is kept as far away from the PCB and the installation surface as possible to reduce interference. .</p> <p>Officially as the external sales stage of the product.</p> <p>{phocagallery view=category|alias=anchor-dev-normal}</p> <p>As can be seen from the above figure, the anchor at this stage uses POE for power supply. The power supply part occupies less than half of the PCB area because we use an isolated design to isolate the anchor's digital circuit from the network cable power supply to ensure the safety of the anchor's digital circuit.</p> <p>Going one step further, we integrated a network switch chip and POE power supply.</p> <p>{phocagallery view=category|alias=anchor-dev-2net}</p> <p>The pictures above are our original promotional photos, and the PCB is more integrated.</p> <p>In order to facilitate disassembly and assembly, we have made some changes to the anchor.</p> <p>{phocagallery view=category|alias=anchor-dev-install}</p> <p>As can be seen from the above set of pictures, the structure of the anchor is more reasonable.</p> <p>During the development process, we also tried other network connection methods.</p> <p>{phocagallery view=category|alias=anchor-dev-other}</p> <p>The first picture above is using 433M radio frequency transmission, and the second picture is using MTK's WIFI module for transmission. However, both experiments were unsuccessful due to transmission speed issues.</p> <p>Later, we plan to use ESP32 as the WIFI interface and also use ESP32 as the main control MCU, so that STM32 and W5500 can be eliminated. On the one hand, it can save costs, on the other hand, it can support both WIFI and Ethernet. If the MCU is replaced, the anchor firmware needs to be completely rewritten, which is a bit of a workload. Not long after this plan was launched, the company decided to stop the project, and the research and development of new anchors was also suspended. The picture below is the new anchor PCB using ESP32 as the main control.</p> <p>{phocagallery view=category|alias=anchor-dev-esp32}</p> <p>We also designed a waterproof outdoor anchor. The radio frequency signal is led out from the UWB module to the external antenna using an IPX socket. We also designed a bright LED at the bottom of the anchor as the anchor identification (the switch can be controlled by software).</p> <p>{phocagallery view=category|alias=outdoor-anchor}</p> <p>We have also designed a special UWB module for outdoor anchors, using an SMA interface to connect to peripheral antennas.</p> <p>{phocagallery view=category|alias=um2000}</p> <p> </p> <h3>Hardware Design of Location Anchor</h3> <p>The main control of the location anchor is STM32F103RET6. This MCU has a relatively large Flash and a relatively large RAM, and is suitable for running RTOS.</p> <p>The UWB transceiver of the anchor uses the DW1000 chip. We directly used the DWM1000 module in the early stage, because the DWM1000 module has already completed the radio frequency part and provides some SPI interfaces to the outside world. We do not need to worry about the analog part of the circuit and can just focus on the logic circuit. Later, some anchor types were added, and some changes were made in this part. Several new designs were added: (1) Making your own modules similar to DWM1000 can save costs; (2) Your own UWB modules use ceramic antennas or PCB antennas, and there are also IPX The base lead uses an external high-gain underline; (3) Add PA/LNA. The original communication distance can reach up to 300 meters at the rate of 850K, and it can reach more than 1000 meters after adding PA/LNA.</p> <p>The network interface chip uses W5500. This chip uses SPI interface and the network speed is 100M. In fact, judging from the amount of UWB data, 100M is too much, and 10M is enough.</p> <p>There are two designs for the power supply: (1) using POE power supply, which is used in major mass production models; (2) using DC-DC to convert 12V to 3.3V for use by on-board devices, which is used in the initial prototype and Used upon request by some OEM customers.</p> <p>We also have a model of anchor that integrates a network switch chip and POE power supply. Multiple anchors can be cascaded and strung together to save wiring costs.</p> <p>The research and development process of the anchor goes through several stages.</p> <p>The first stage is experimental in nature.</p> <p>{phocagallery view=category|alias=anchor-dev-try}</p> <p> </p> <p>As you can see from the picture above, during the design, the network not only supports Ethernet (RJ45 interface), but also supports WIFI and uses 12V power supply. WIFI uses the ESP8266 module. A large box is used for the casing.</p> <p>The second stage is miniaturization.</p> <p>{phocagallery view=category|alias=anchor-dev-small}</p> <p>As can be seen from the above picture, ESP WIFI is no longer considered. The DW1000 module is fixed in the center of the anchor through the adapter board. On the one hand, the box space is smaller, and on the other hand, the DW1000 module is kept as far away from the PCB and the installation surface as possible to reduce interference. .</p> <p>Officially as the external sales stage of the product.</p> <p>{phocagallery view=category|alias=anchor-dev-normal}</p> <p>As can be seen from the above figure, the anchor at this stage uses POE for power supply. The power supply part occupies less than half of the PCB area because we use an isolated design to isolate the anchor's digital circuit from the network cable power supply to ensure the safety of the anchor's digital circuit.</p> <p>Going one step further, we integrated a network switch chip and POE power supply.</p> <p>{phocagallery view=category|alias=anchor-dev-2net}</p> <p>The pictures above are our original promotional photos, and the PCB is more integrated.</p> <p>In order to facilitate disassembly and assembly, we have made some changes to the anchor.</p> <p>{phocagallery view=category|alias=anchor-dev-install}</p> <p>As can be seen from the above set of pictures, the structure of the anchor is more reasonable.</p> <p>During the development process, we also tried other network connection methods.</p> <p>{phocagallery view=category|alias=anchor-dev-other}</p> <p>The first picture above is using 433M radio frequency transmission, and the second picture is using MTK's WIFI module for transmission. However, both experiments were unsuccessful due to transmission speed issues.</p> <p>Later, we plan to use ESP32 as the WIFI interface and also use ESP32 as the main control MCU, so that STM32 and W5500 can be eliminated. On the one hand, it can save costs, on the other hand, it can support both WIFI and Ethernet. If the MCU is replaced, the anchor firmware needs to be completely rewritten, which is a bit of a workload. Not long after this plan was launched, the company decided to stop the project, and the research and development of new anchors was also suspended. The picture below is the new anchor PCB using ESP32 as the main control.</p> <p>{phocagallery view=category|alias=anchor-dev-esp32}</p> <p>We also designed a waterproof outdoor anchor. The radio frequency signal is led out from the UWB module to the external antenna using an IPX socket. We also designed a bright LED at the bottom of the anchor as the anchor identification (the switch can be controlled by software).</p> <p>{phocagallery view=category|alias=outdoor-anchor}</p> <p>We have also designed a special UWB module for outdoor anchors, using an SMA interface to connect to peripheral antennas.</p> <p>{phocagallery view=category|alias=um2000}</p> <p> </p> Hardware Design for Location Tags 2023-12-12T10:00:37+08:00 2023-12-12T10:00:37+08:00 https://entest.autoop.net/technology/design-tag-hw.html zhang <h3>Hardware Design for Location Tags</h3> <p>Our mass-produced location tags are name-card style and use DW1000 as the UWB transceiver. In the early stage, the DWM1000 module was used, and in the later stage, the self-designed UWB module was used. Some models also added LNA/PA to increase the location range.</p> <p>Use STM32F103RBT6 as the main control MCU. Our initial purchase price for this chip was about 12 yuan to 14 yuan, and later it rose to 180 yuan per piece. It was really crazy and made us very passive. However, it later fell back.</p> <p>The power supply uses an 800mah lithium battery as the power source, and uses a USB interface for charging, which also serves as the tag configuration interface.</p> <p>There is an MPU6050 three-dimensional accelerometer chip designed on the tag. During mass production, it was found that the effect was not very great, and this chip was not attached in the later production.</p> <p>There are 2 LEDs designed on the tag, one red and one green.</p> <p>There is a button designed on the tag, which can be used for alarm purposes. Specific uses require server-side design. The firmware design can support multiple buttons, and later OEM customers need to add other functions (such as anti-tampering, etc.).</p> <p>{phocagallery view=category|alias=t1201c}</p> <p>We also designed a bracelet (watch) style location tag. In order to reduce the size, the MCU uses the VFN package version of the STM32F103RB series. This bracelet is only a prototype and has not been mass-produced.</p> <p>{phocagallery view=category|alias=t1202w}</p> <p>We achieve a minimum power consumption of 13.3uA during sleep mode.</p> <p>{phocagallery view=category|alias=tech-lowpower}</p> <p>Through the oscilloscope, we can clearly see several working stages of the tag: it usually consumes almost no power when sleeping, starts to consume more power when awakened, further increases during the initialization phase, consumes the highest power when transmitting data packets, and then goes to sleep again.</p> <p>The following pictures show several tag PCBs designed during the research and development process.</p> <p>{phocagallery view=category|alias=tag-dev}</p> <p> </p> <h3>Hardware Design for Location Tags</h3> <p>Our mass-produced location tags are name-card style and use DW1000 as the UWB transceiver. In the early stage, the DWM1000 module was used, and in the later stage, the self-designed UWB module was used. Some models also added LNA/PA to increase the location range.</p> <p>Use STM32F103RBT6 as the main control MCU. Our initial purchase price for this chip was about 12 yuan to 14 yuan, and later it rose to 180 yuan per piece. It was really crazy and made us very passive. However, it later fell back.</p> <p>The power supply uses an 800mah lithium battery as the power source, and uses a USB interface for charging, which also serves as the tag configuration interface.</p> <p>There is an MPU6050 three-dimensional accelerometer chip designed on the tag. During mass production, it was found that the effect was not very great, and this chip was not attached in the later production.</p> <p>There are 2 LEDs designed on the tag, one red and one green.</p> <p>There is a button designed on the tag, which can be used for alarm purposes. Specific uses require server-side design. The firmware design can support multiple buttons, and later OEM customers need to add other functions (such as anti-tampering, etc.).</p> <p>{phocagallery view=category|alias=t1201c}</p> <p>We also designed a bracelet (watch) style location tag. In order to reduce the size, the MCU uses the VFN package version of the STM32F103RB series. This bracelet is only a prototype and has not been mass-produced.</p> <p>{phocagallery view=category|alias=t1202w}</p> <p>We achieve a minimum power consumption of 13.3uA during sleep mode.</p> <p>{phocagallery view=category|alias=tech-lowpower}</p> <p>Through the oscilloscope, we can clearly see several working stages of the tag: it usually consumes almost no power when sleeping, starts to consume more power when awakened, further increases during the initialization phase, consumes the highest power when transmitting data packets, and then goes to sleep again.</p> <p>The following pictures show several tag PCBs designed during the research and development process.</p> <p>{phocagallery view=category|alias=tag-dev}</p> <p> </p> Firmware Design of Location Anchor 2023-12-12T09:52:56+08:00 2023-12-12T09:52:56+08:00 https://entest.autoop.net/technology/design-anchor-fw.html zhang <h3>Firmware Design of Location Anchor</h3> <p>The location anchor uses RTOS because the program is relatively complex. If the OS is not used, coordination between various functions will be difficult.</p> <p>For UWB communication between the location anchor and the tag, the location anchor and the location anchor, we have defined several data packets. There are mainly clock synchronization packages (used for clock synchronization between anchors), basic location packages (containing only the most basic location functions), and extended location data packages (including battery voltage, button information, three-dimensional accelerometer information, etc.). Later, we also added TOF auxiliary location data packets and so on.</p> <p>For communication with the location engine, we have also defined several data packets. Basically, the anchor just forwards the received UWB data to the location engine. Of course, some necessary data conversion needs to be done, such as using standard timestamps, etc. Theoretically, it is not necessary to send the clock synchronization packet to the location engine. We also support sending the clock synchronization packet to the location engine, which helps to monitor the clock synchronization situation.</p> <p>An important function of the location anchor is clock synchronization. At least it is necessary to ensure that several anchors within a "location area" have unified clocks. Moreover, because the frequency of the crystal oscillator used by each DW1000 chip will be slightly different, clock synchronization needs to be performed frequently, otherwise the clock differences will accumulate more and more.</p> <p>The DW1000 chip can be configured with some parameters to adapt to different usage environments. We developed a anchor configuration program to configure the anchor. For example, set some functions of the anchor, the UWB channel used, the IP address of the anchor, gateway and other parameters. The anchor configuration program is developed using Delphi7, and uses the network to communicate with the anchor.</p> <p>The anchor configuration program also has built-in new version of anchor firmware, which can upgrade the anchor firmware.</p> <h3>Firmware Design of Location Anchor</h3> <p>The location anchor uses RTOS because the program is relatively complex. If the OS is not used, coordination between various functions will be difficult.</p> <p>For UWB communication between the location anchor and the tag, the location anchor and the location anchor, we have defined several data packets. There are mainly clock synchronization packages (used for clock synchronization between anchors), basic location packages (containing only the most basic location functions), and extended location data packages (including battery voltage, button information, three-dimensional accelerometer information, etc.). Later, we also added TOF auxiliary location data packets and so on.</p> <p>For communication with the location engine, we have also defined several data packets. Basically, the anchor just forwards the received UWB data to the location engine. Of course, some necessary data conversion needs to be done, such as using standard timestamps, etc. Theoretically, it is not necessary to send the clock synchronization packet to the location engine. We also support sending the clock synchronization packet to the location engine, which helps to monitor the clock synchronization situation.</p> <p>An important function of the location anchor is clock synchronization. At least it is necessary to ensure that several anchors within a "location area" have unified clocks. Moreover, because the frequency of the crystal oscillator used by each DW1000 chip will be slightly different, clock synchronization needs to be performed frequently, otherwise the clock differences will accumulate more and more.</p> <p>The DW1000 chip can be configured with some parameters to adapt to different usage environments. We developed a anchor configuration program to configure the anchor. For example, set some functions of the anchor, the UWB channel used, the IP address of the anchor, gateway and other parameters. The anchor configuration program is developed using Delphi7, and uses the network to communicate with the anchor.</p> <p>The anchor configuration program also has built-in new version of anchor firmware, which can upgrade the anchor firmware.</p> Firmware Design for Location Tags 2023-12-12T09:51:45+08:00 2023-12-12T09:51:45+08:00 https://entest.autoop.net/technology/design-tag-fw.html zhang <h3>Firmware Design for Location Tags</h3> <p>The location tag does not use RTOS, and "electricians" describe it as "streaking" :).</p> <p>The location tag can be connected to the computer via USB. We have a tag configuration program that can configure various parameters of the tag. The tag configuration program has a new version of tag firmware built-in, and the tag firmware can be upgraded.</p> <p>The working principle of the tag is relatively simple. It is usually in a sleep state. After the set time is up, it wakes up, sends a UWB location data packet, and then continues to sleep.</p> <p>When the button is pressed, the tag will also wake up and immediately wake up to send a UWB location data packet.</p> <p>The tag is designed with a battery reminder function. When the battery voltage is lower than a certain value, the red LED will flash. This feature can be turned on or off via the configuration program.</p> <p>There are several types of UWB data packets sent by location tags. The most basic UWB data packet only contains location data, has the shortest length, takes the shortest time in the air, and saves the most power.</p> <h3>Firmware Design for Location Tags</h3> <p>The location tag does not use RTOS, and "electricians" describe it as "streaking" :).</p> <p>The location tag can be connected to the computer via USB. We have a tag configuration program that can configure various parameters of the tag. The tag configuration program has a new version of tag firmware built-in, and the tag firmware can be upgraded.</p> <p>The working principle of the tag is relatively simple. It is usually in a sleep state. After the set time is up, it wakes up, sends a UWB location data packet, and then continues to sleep.</p> <p>When the button is pressed, the tag will also wake up and immediately wake up to send a UWB location data packet.</p> <p>The tag is designed with a battery reminder function. When the battery voltage is lower than a certain value, the red LED will flash. This feature can be turned on or off via the configuration program.</p> <p>There are several types of UWB data packets sent by location tags. The most basic UWB data packet only contains location data, has the shortest length, takes the shortest time in the air, and saves the most power.</p>