OneNET Communication Development Platform (IX)

This blog post describes how to port the code to the STM32 microcontroller, and final article on the blog of OneNET. Hardware STM32F103RCT6 and ESP8266, system FreeRTOS example. AT command set USART1, ESP8266 use USART2, and you have configured FreeRTOS. If not how can Baidu search transplantation. Following is a brief description of the content of what needs to be modified or transplanted to note:

  1. AT command to be modified to receive USART1 command of Task;
  2. Socket to be modified to receive and process data ESP8266 and Socket correlation function with the AT command through the analog transmission module ESP8266 interactive data transmission network;
  3. Task needs two or more message queue, the message queue implemented mimic OneNET portion;
  4. OneNET portion need to modify the C ++ std :: queue is FreeRTOS message queue. Note that FreeRTOS Tick count for a queue and the system there are two different versions of the function, a call interrupt (FromISR), called a Task, the need to pay attention to modification;
  5. These when creating a new Task Priority should be set to the same, I found that if you do not make the same system abnormalities, it seems a low priority task can not be scheduled;
  6. OneNET need to stack a larger space, I set to 4KB of stack transplantation, while the other is set to 1KB. 24 message queue capacity is provided;
  7. Timer timer to modify FreeRTOS offer, and start it in OneNET mission, which ensures that only after the OneNET task running up to send a message with a timer;
  8. Replace function malloc and free memory allocation function FreeRTOS provided. I set the time of transplantation heap size of 25KB (this microcontroller has 40KB of the RAM);
  9. String \ n need to be modified to \ r \ n, or when the serial debugging tools display does not wrap;
  10. To change the log output related to the serial output;
  11. Finally, we need to set Keil C99 mode to compile.

The following is an example of the effect of transplantation (where + the beginning of the IPD is receiving data ESP8266 output module can be ignored. Diagram can be found in some IPD + output and AT + CIPSEND command will echo even in one, do not know why, and Taobao store representations she did not know why. I just blocked this error condition that such data is not valid in the program. However, sometimes resulting in reply after the reported data server and the aT echo even one, leading to a server module that did not respond and timeout error has occurred. However, the module will not cause an exception). FIG respectively order login process; FOTA issued transactions; north and performs a write operation; north Fiddler screenshot write operation:

After simple test Notify reported data, reported in the continuous nearly an hour, once per second reporting process does not appear abnormal. This shows that the program does not leak memory in this regard. In fact, VS has been tested at least enter the code in the AT normal circumstances would not have a memory leak. The following are the reported data record screenshots OneNET platform aspects:

Finally, explain the existing problems in the code and imperfections. Only recording, these codes will no longer be updated.

  1. Not recovered and closed state OneNET Socket thread after BSREG and REG failure;
  2. BS may switch to another server after the BS, rather than LwM2M server. Unrealized;
  3. Observe a conditional command, i.e., command processing Write-Attribute. Unrealized;
  4. After successful registration or the update is successful, start the timer, automatic updates to keep the equipment is not dropped at the end of the life cycle. Unrealized;
  5. FOTA start timeout timer After downloading the data is received before the timer expires not issued the next data packet is considered FOTA flow interruption. This is the agreement, but China Mobile SDK do not have this feature;
  6. AT does not support variable portion of the code data types, i.e., a location parameter may be a number or a string or other type;
  7. Other such DTLS encryption, SOTA and the like.

Guess you like

Origin www.cnblogs.com/mengxiangdu/p/11279751.html
Recommended