| Door locks carry the critical task of safeguarding personal and property safety.The innovation drive centered on the Internet of Things and intelligence gradually shows the trend of serving "safety,peace of mind,and convenience" intelligent life.The door locks based on the Internet of Things technology play a significant role in intelligent life.As the construction scale of public rental housing expands,the number of houses continues to increase,and the number of renters increases as well.At the same time,their management is becoming more complex,fragmented,and difficult.There is an urgent need for equipment to accurately and timely monitor rental housing in areas with a concentrated floating population.Locking is an effective way to solve this complex problem.IoT door locks are the basis for ensuring security and privacy.The threat of foreign chips and software should be eliminated,but the actual situation is not satisfactory.The complex international situation we face today,such as ZTE and Huawei incidents,is a wake-up call for Chinese people.In order to realize the intelligentization of door locks and the independent control of domestic software and hardware,this article combines public rental housing and other application scenarios and uses domestic chip-Loongson 1C101 as the main control chip.Under the condition of bare metal without an embedded operating system,according to the requirements of users in this scenario,the IoT door lock embedded software development was carried out.However,when developing embedded software for IoT door locks based on Loongson microcontrollers,there are some issues as below:(1)Loongson 1C101 is the first MCU developed by Loongson Zhongke based on the MIPS architecture.Its technical reference materials are scarce,and it is difficult to find application development examples that can be used for reference.Everything needs to be explored from scratch,which is extremely challenging to develop the application of embedded systems;(2)In order to ensure the independent control of software and the maximum utilization of resources,and to better realize the optimal coupling of software and hardware in the research and development process,a bare metal development without an embedded operating system is adopted.Although the MIPS architecture itself has interruptions,in order to give full play to the pipeline design ideas,its interrupt priority is equal,and there is no interrupt nesting,and the Loongson MCU itself also lacks hardware interrupt management,which will cause the embedded system to manage various real-time tasks.Moreover,there are significant shortcomings in implementation.In response to the above problems,this article combines the embedded application development experience of the ARM architecture to develop the IoT door lock’s embedded software based on the Loongson microcontroller,which makes up for the deficiencies in the Loongson 1C101 application development process.Besides,we innovatively defined an interrupt management controller based on the MIPS architecture with software and then designed and developed an IoT door lock with domestic chips as the body and independent software as the soul,which formed the characteristics and unique advantages of this article.The research content and related work of this article are as follows:(1)Requirement analysis was conducted for IoT door locks used in public rental housing and other scenarios,including functional requirement analysis and non-functional requirement analysis.The modular design method was adopted to carry out the related program design,including the architecture design of the IoT door lock,the hardware program design and the software program design,and the embedded software development based on the architecture design of the combination of software and hardware.(2)In the embedded bare metal development process,based on "domestic chip" and "interrupt management mechanism," this article draws on the related research of ARM and RISC-V architecture,focusing on the MIPS architecture with interrupts but the equal priority,no interrupt nesting and Loongson MCU.If there is no hardware interrupt management mechanism,the interrupt priority is constructed according to the requirements of the IoT door lock.According to the pre-built interrupt priority is used to preempt the CPU for emergency events,thereby realizing software-defined interrupt nesting.By using the custom shadow array in this article,the embedded software defines the "Tail-Chaining" to ensure that low-priority interrupts are not randomly discarded and execute smoothly.The software defines an interrupt management controller with a complete interrupt management mechanism,thereby improving the stability of embedded software.(3)This article is based on the Loongson 1C101 embedded microcontroller chip resource drive and application development,combined with the specific application characteristics of the IoT door lock,and further extends to other domestic components in this article,such as fingerprint module,swipe chip,NB module,etc.,for the door lock Each functional module carries out functional requirements realization and application development,and forms an embedded application with completely independent intellectual property rights in the way of bare metal development,and develops Loongson’s first MCU IoT door lock embedded software.(4)The embedded software development of the IoT smart door lock was completed,and the software and hardware were combined for joint debugging.Combined with the serial port debugging assistant software,the software-defined interrupt management controller of this article has been tested and verified.At the same time,the test and verification of the essential functions of the IoT smart door lock were realized on the experimental platform jointly built by the PCB board and peripheral function modules and other related hardware.It proves the feasibility and practicality of IoT door lock based on Loongson microcontroller... |