Upgrade ESA2GJK1DH1K articles: STM32 pong remote upgrade, based on Wi-Fi module TCP transparent transmission AT command, the communication control upgrade the MQTT (containing parity data) user-APP program production process

 

 

 

Foreword

  This section and is on a mix of

  For everyone to fish, but also must give the rod!

  I look forward to their own code package, no matter how many years have application value!

  This section explains about the process of making the user program APP

  AWESOME upgrade with MQTT communication control module, the first of its program to achieve MQTT Kazakhstan.

The following files into your own project

  stmflash files on a direct copy of the

  IAP and on a different, do a lot of cutting.

  

 

 

 

The main function configuration

  1. Include the file nod

    

  // Get the information updates; 2. Call a function IAPGetUpdateInfo ()

    

 

 

  This function does work

    Gets cloud version: this is the time to upgrade inside BootLoader deposit into the

    Get Device Version: The current version of this or the previous version of the program, not to switch it back will say where switching

    Get updates status: those which set the update status BootLoader

 

    

 

 

  

 

 

 

  You can come to know through the last update IAPStructValue.UpdateStatusValue value in the user program inside state

 

  For more intuitive, we can directly call printf ( "% s", IAPStructValue.UpdateStatusStr); string corresponding to printing

 

  The state can also be considered when the program is not the problem, these states sent to the host computer, so that you know intuitively updated

 

 

 

 

 

 

Process updates (Why deal with update)

  Let me talk about Kazakhstan, the update process is the function

  IAPUpdateDispose();

  The main function is to update the status is cleared, and then determine if you are running a new program, the switch version.

  

 

 

 

 

   Then talk about the beauty of the above functions

  If you download the file successfully inside BootLoader

 

    

 

  BootLoader download a good program after it, write status is: 0x01 then restart

  After the restart of course, to run BootLoader

  BootLoader is then determined after writing 0xFF 0x01

  Then run the new user program

  假设用户程序有问题 没有执行函数  IAPUpdateDispose();

  那么就没有把升级状态清零

  那么单片机重启以后又运行 BootLoader,此时BootLoader里面一判断还是0xFF

  便会认为没有正确执行用户程序,就会切换上一份用户程序执行

  

  然后总的来说就一句话:

  你认为APP用户程序运行没有问题了以后再调用 IAPUpdateDispose();

 

这节建议这样处理

  在连接上MQTT以后,咱调用下 IAPUpdateDispose();

  然后把升级状态通过MQTT发出去

  

 

 

 

  

 

 

  

  

 

 

 

    

 

Guess you like

Origin www.cnblogs.com/yangfengwu/p/12075412.html