您好,欢迎光临本网站![请登录][注册会员]  
文件名称: STM32的IAP固件升级
  所属分类: 其它
  开发工具:
  文件大小: 381kb
  下载次数: 0
  上传时间: 2019-04-21
  提 供 者: weixin_********
 详细说明:NULL 博文链接:https://lanxinyuchs.iteye.com/blog/1912248AN3226 lAP overview 1 lAP overview Theory of operation In-Application Programming(IAP)is a means of upgrading firmware in the field using the MCU communication interfaces like Uart. USB. can. ethernetetc When you boot the microcontroller, you can choose to put it in IAP mode in order to execute the lAP code or else, in normal mode, start to execute the application code. both the IAP code and the application code are reside in the embedded Flash memory of the microcontroller. Usually the laP code is stored in the first pages of the McU Flash, and the user application code occupies the remaining Flash area The lAP operation flow is described in the following figure Figure 1. lAP operation flow MCU reset Enter lAP Execute application code mode? lAP initializatio lAP No Request Ye Receive bina age and program it into user Flash area 12 lAP using the mcus ethernet interface When it is available, Ethernet is often the preferred interface for implementing lAP capability in an embedded application. The advantages are o High speed communication interface(10/100Mbit/s) Remote programming through the network (LAN or Wan) Standardized application protocols on top of the TCP/IP stack that can be used for implementing the laP like Ftp Tftp, Http, Doc ID 17570 Rev 1 3/18 AP。 vervet AN3226 1.3 Implementing lAP over Ethernet on the STM32F107 This application note describes two solutions that implement lAP for the STM32F107 using the ethernet communication peripheral lAP using TFTP (Trivial File Transfer Protocol) laP using Http(HypeRtexT Transfer Protocol Both solutions run on top of the LwIP stack(v1.3. 1) which is a light-weight implementation of the tCP/iP protocol suite 1.3.1 lAP method using TFTP The lAP method using TFTP is widely used in embedded applications that require a firmware upgrade capability(for example in embedded Linux bootloaders TFTP is a simple file transfer protocol working on top of the UdP transport layer and it is mainly intended to be used on a LAN environment. It is based on a client/server architecture, where a client will request a file transfer (read or write operation) from a file server In our case, a simple TFTP server is implemented on top of the LwlP stack, this server only processes write requests coming from a Pc tFTP client 132 lapmethodusinghttp Firmware upgrade through Http protocol is less common than with Tftp but it can be an useful solution, when remote programming over the Internet is needed. In this case TCP transport protocol is needed to ensure optimum operation Http which works on top of Tcp, offers a way of sending a binary file from a web client (example: Mozilla Firefox or Microsoft Internet Explorer) using HTML Forms, it is called Http File-upload(rfc 1867) The next sections of this document, give more details about the implementation of both IAP methods and an explanation of how to use the software 4/18 Doc ID 17570 Rev 1 AN3226 MAP using TFTP lAP using TFTP 2.1 TETP overview Trivial File Transfer Protocol (TFTP) is a simple file transfer protocol, working on top of UDP. A file transfer is initiated from a TFTP client which sends a Read or Write request to a TFTP server When the server acknowledges the request, file data transfers start. The data is sent in fixed size blocks( for example in blocks of 512 bytes) Each transferred data block must be acknowledged by the recepient, before the next block can be sent. The acknowledge mechanism is based on the block number sent with each data block a data block with less than the fixed block size indicates the termination of the file transfer Figure 2 describes the format of the various TFTP packets Figure 2. TFTP packets 2 bytes String 1 byte RRQ/RQ packet Opcode File name Mode 2 bytes 2 byte Data packet 2 bytes ACK packet Opcode Block+# 2 bytes 2 b String 1 byte Error packet Opcode Error code 0 message The TFTP opcodes are listed in Table 1. Table 1. TFTP opcodes Opcode Operation OX1 Read request (RRQ) 0x2 Write request (WRQ) 0X3 Data 0X4 Acknowledgment(ACK 0x5 Error Doc ID 17570 Rev 1 5/18 lAP using TFTP AN3226 22 Implementing lAP for the STM32F107 using TFTP This IAP implementation consists of a basic TFTP server on top of the LwlP TCP/P stack This server responds to file WrITE requests received from a remote TFTP client(PC) TFTP READ requests are ignored Instead of writing received files to a filesystem which is normally what tFtP is used for, the server writes the received data blocks into the MCu Flash(in the user Flash area) Note In this implementation the data block size is fixed to 512 bytes The following flowchart gives an overview of the IAP operation using TFTP. 6/18 Doc ID 17570 Rev 1 AN3226 MAP using TFTP Figure 3. Flowchart of lAP using TFTP Enter laP mode TFTP server initialization TFTP Write No quest? Erase the total user flash area Send Ack Data packet No Received Write data block to flash Send ack Last data packet End of file transfe Doc ID 17570 Rev 1 7/18 lAP using TFTP AN3226 2.3 Using the software In order to test the lAP through TF TP, please ensure you follow these steps 1. Be sure of the correct jumper settings in the STM3210C_EVAL board(see Table 2) 2. In the main. h file uncomment the option "USE_lAP_ TFTP. Also, depending on your needs, you can uncomment/comment other options like " USE_ DHCP"or"USE_LCD" 3. Recompile the software. Using the generated map file, be sure that there is no overlap between the iAP code area(starting from address OXO)and the user Flash area starting from address: USER_FLASH_FIRST_PAGE_ ADDRESS (defined in main h 4. Program the software in the STM32 Flash and run it 5. To enter IAP mode, press and then release the Reset button while keeping the Key button pressed 6. If"USE_LCD"is defined in main. h file then, the LCD screen displays a message indicating that IAP mode has been entered. Also if dHCP is used (USE_DHCP defined in main. h), a message is displayed on the LCD screen indicating the success or failure of dhcp ip address allocation 7. After iP address assignment (either static or dynamic address), the user can start the IAP process 8. On the PC side open the TFTP client(for example TFTPD32), and configure the TFTP server address(host address in TFTPD32 9. Browse for a binary image to load in the STM32 Flash(two binary images are provided as examples in the /project/binary folder 10. Start a file write request by clicking the"Put" button in the tFTPD32 utility 11. When USE_LCD is enabled, the progress of the lAP operation is shown on the LCD 12. At the end of lAP operation, you can reset the evaluation board and run the application that you have just programmed in the STM32 Flash Figure 4. TFTPD32 dialog box TItpd32 by Ph Jounin Current Directory c: Server interf aces 192.168.0.1 T p Server Ttp Client DHCP server Syslog ser Hast192.1680.11 ort Local file Remate file 512 block +98 jet Pu Er 囗■■■■■■■ 8/18 Doc ID 17570 Rev 1 AN3226 lapusinghttp 3 IaP using Http Http file upload overview File upload using Http is defined in Rfc1867. thIs method of uploading files is based on HTML forms. To send raw binary data, the HTML POST method is used instead of the gET The following is an example of HTML code for implementing form-based file upload < form action ="/upload. cgi" enctype="multipart/ form-data"method="post">

Please specify a binary file to upload into sTM32F107 flash:

(系统自动生成,下载前可以参看下载内容)

下载文件列表

相关说明

  • 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
  • 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度
  • 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
  • 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
  • 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
  • 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.
 相关搜索: STM32的IAP固件升级
 输入关键字,在本站1000多万海量源码库中尽情搜索: