ASR research log-log 3

This log will mostly talk about my STM32 programming and the control systembuilding. Our rocket electronic system is divided into two parts: the rocket controllerand the data collector. We use STM32F103RE as our rocket main rocket controllerand ATmega328 as the data collector. STM32 and ATmega328 are based on thedifferent construction and use different IDE---STM32 is based on the ARMconstruction and ATmega328 is based on the AVR construction. I use KEIL MDK U4as the programming IDE and complier of STM32 chip while I use Arduino IDE asthose of ATmega328 chip. STMf10x series chips need JLINK to burn the code onthe flash, where the chip could read and run the code when it is reset. JLINK is a necessary tool for the STM32 programming because it offers the simulationdebugger which could control and minister the running progress and the real-time memory state of the chip which we are debugging on. Technically, whatthe JLINK do is the following things: burning the HEX code into the flash through the JTAG port, leading the chip to reset and controlling the flashpointer of the chip. Such functions could also be completed by the IAP (In Application Programming). I will talk about how it works and how to realize it later. Thesensors we used are BMP8050, MPU6050 and HMC 5335, which could give us the three-axis acceleration, three-axis angular velocity, three-axis magneticdeclination and temperature. Each sensor will keep sending the real-time datathrough the IIC port to the MCU. We use ATmaga328 to be the sensor data collector while the ATmaga328 sends the data to the STM32F103 at the same time.The system is divided into two parts since I want to ensure that the reliability and the security of the main controller, which controls the parachute openingand the wireless data transmission, are not despaired by the “heavy bombardment”from various sensors. To be honest, the sensor and its collector are very easy to go “crazy”. (Maybe because one data from the sensor is mistakenly out of the setting range or the collector is missing one of the important signals, likethe ending signal, which could let it fail to packet the data.) In addition tothe data from the sensors, we also get the GPS signal as I mentioned in theprevious log. So, generously speaking, the whole system’s structure is like below.


Aswe have mentioned before, the sensors are transmitting data through the IICport. The most interesting part of the IIC port is that it can support the datatransmission of several masters and several slave devices with only one port. Eachsensor is connected to the ATmega328’s IIC port. Each slave device has oneunique address. Sensors will continue making data, but it will not send thedata to the IIC port until it got the data require that includes its ownaddress. For the master device, it will recorded a form of the address of theslave devices and it will send the data require to the slave devices one by oneso that the transmission of different slave devices will not be conflicted and influenced.After the ATmega328 collects the data and organizes them following the rule ofcertain communication agreement, it will send the data packet to STM32F103through the Serial port 2. For the STM32F103, it will use three of its serialports: the Serial port 1 for the GPS data receiving, the Serial port 2 forsensors-ATmega data receiving and the serial port 3 for wireless datatransmission to the ground station. It will also record the sensors data intothe SD card through its SPI port. Generously speaking, the STM32 chip needs todo the following things at the same time: receiving the sensor data, recordingthe sensor data, receiving the GPS data, sending the GPS data to the ground andkeeping monitoring whether the time is for the parachute opening. We shouldnotice that our chip could only do one thing at one moment, so how to make ithandle these simultaneous tasks becomes a serious problem. At first, I thoughtto so these tasks in a fixed order, which means that the chip finishes thetasks one by one. But this will cause the chip can’t run at its highest efficientsince the data “wave” of each data source is not at the same frequency or thesame rate. For instance, the inactive-and –active-time diagram of two events islike below. The active period means that during this period the data is keptsending to the MCU or the MCU is sending data to the other devices. We shouldnotice that the active periods of different data sources are overlapping. 


Ifwe used the one-by-one way to collect the data, we inevitably would sometimeslose some data, may be some important data like clock timing signal that usedto control the opening of the parachute, while sometimes there is no work forthe MCU to do. At last, I got one solution. I used to treat each event with thesame weight. But soon I realize that some event is not as important as theother. For instance, sending the GPS signal back is less necessary than readingthe data transmitted from the sensor since our main purpose is to collectsensor data while GPS signal is only for the final locating of the rocket. Sowe could combine it with the interrupt mechanism in order to build a systemthat could make the important data loss become as less as possible. Morespecifically, I gave each interrupt two parts of level or priority. The firstpriority determines which to do the when two of the interrupt-active-time is overlapping.  For instance, I gave the sensor reading thehigher first priority than the writing data. So when the MCU is recording theold data, if it got the sensor-reading-interrupt, it will suspend the datarecording and turn to do the data receiving. When it is done with the datareceiving, it will continue the job of data recording. The most interestingpart is that if during the time of receiving the sensor data the clock alarminginterrupt arrive, it will suspend the present interrupt and do the moreimportant work. In the other hand, if the MCU has not get any high levelinterrupts, it will not waste its time but it will do the low level interruptswhich are suspended before. And the second priority is also very important. Itworks when several same low first priority interrupts are waiting for the onehigh first priority interrupt to finish. The second priority will decide which suspendedinterrupt will begin at first. The general priority setting is like below.


This makes sure that theimportant thing is done while the calculating power of the MCU is not wasted. Anda point to notice is that the speed of recording data to the SD card or sendingdata to the ground station through the wireless device is much slower than thatof receiving data from the sensor or the GPS. So it is necessary to build someCaches which could temporally record some data that is important but has notbeen recorded or sent yet in the RAM of the STM32 chip. The code below is theexact code of the sensor data receiving interrupt. 


I read something about the mechanism of the multi-task operation system and themain idea in it is also the priority. In the other word, I have realized asimple multi-task operation system. That is very exciting.



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
摘 要 伴随着人才教学的关注度越来越高,对于人才的培养也是当今社会发展的最为重要的问题之一。为了进一步的进行人才的培养关工作,许多的学校或者是教育的机构逐步的开展了网络信息化的教学和和管理工作,通过信息化的手段和技术实现网络信息化的教育及管理模式,通过网络信息化的手段实现在线答题在线考试和学生信息在线的管理等操作。这样更加的快捷解决了人才培养之中的问题,也在进一步的促进了网络信息化教学方式的快速的发展工作。相较于之前的人才教育和培养工作之中,存在这许多的问题和局限性。在学生信息管理方面通过线下管理的形式进行学生信息的管理工作,在此过程之中存在着一定的局限性和低效性,往往一些突发的问题导致其中工作出现错误。导致相关的教育工作受到了一定的阻碍。在学生信息和学生成绩的管理方面,往常的教育模式之下都是采用的是人工线下的进行管理和整理工作,在这一过程之中存在这一定的不安全和低效性,面对与学生基数的越来越大,学生的信息管理也在面领着巨大的挑战,管理人员面领着巨大的学生信息的信息量,运用之前的信息管理方式往往会在统计和登记上出现错误的情况的产生,为后续的管理工作造成了一定的困难。然而通过信息化的管理方式进行对学生信息的管理不仅可以避免这些错误情况的产生还可以进一步的简化学生信息管理工作的流程,节约了大量的人力和物力的之处。在线答题系统的实现不仅给学生的信息管理工作和在线考试带来了方便也进一步的促进了教育事业信息化的发展,从而实现高效化的教学工作。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值