LPC21XX系列ARM微处理器ISP升级程序设计

用函数判断系统是Big Endian还是Little Endian

#include ; union { long Long; char Char[sizeof(long)]; }u; int main(void) { u.Long = 1; if (u.Char[0] == 1) printf("addressing is right-to-left/n"); else if (u.Char[sizeof(long) - 1] == 1) printf("addressing is left-to-right/n"); else printf("addressing is strange/n"); return 0; }

 

LPC21XX系列ARM微处理器ISP升级程序设计
 
 
在系统中编程,英文简称ISP,即In System Programming,是Lattice半导体公司首先提出来的一种让我们能在产品设计、制造过程中的每个环节,甚至在产品卖给最终用户以后,具有对其器件、电路板或整个电子系统的逻辑和功能随时进行重组或重新编程的技术。
ISP使得MCU、CPLD等不必从目标板中拔出,通过串口或专用下载电缆就可实现本地或远程下载来实现程序升级。
  飞利浦的LPC2000系列片内含FLASH的ARM7微处理器支持ISP和IAP(In ApplIcation Programming——在应用编程)。
  LPC2000系列微处理器通过其UART0与PC(或其他设备)的COM口联机实现ISP。
  复位时,P0.14为低电平会使LPC2000系列微处理器进入ISP功能模式,否则进入正常工作模式。
  P0.14在复位后默认初始化为高阻模式,用户需要提供外部硬件条件——上拉或接地,使引脚处于一个确定的状态,否则可能导致功能紊乱——非预期的ISP模式或正常工作模式。
  飞利浦提供公用的ISP下载程序,但是在某些情况下,例如为了程序统一性,个性化或固件的保密性,我们有必要设计自己的ISP下载程序。

ISP处理过程
  ISP的整个过程如下图所示:

1. ISP模式的进入
  复位时P0.14的3ms以上持续的低电平是LPC2000系列微处理器进入ISP功能模式的必要条件。PC的串口应设定为8个数据位、1个停止位和无奇偶校验,波特率建议设置为9600bps,由于受ISP处理速度的影响,过高的波特率并不见得会提高ISP处理速度,反而容易导致ISP处理没有响应。
2. 自动波特率检测
  LPC2000系列微处理器在进入ISP模式之后,会自动进行“自动波特率检测”,因为微处理器并不清楚自己所连接的晶振频率和PC程序所设置的串口波特率。在“自动波特率检测”通过之后,微处理器就进入处理PC程序所发送的ISP命令的状态。

自动波特率检测的流程如下图所示:

  PC机先发送一个同步字“?”,若微处理器因为在复位时检测到P0.14为低电平而进入了ISP模式,则微处理器会发送“Synchronized/r/n”给PC,PC在接收到“Synchronized/r/n”之后,回发“Synchronized/r/n”给微处理器,微处理器在收到“Synchronized/r/n”之后,发送“Synchronized/r/nOK/r/n”给PC,PC在收到“Syn

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Portable command line ISP for NXP LPC2000 family and Analog Devices ADUC 70xx Version 1.79 compiled for Windows: Aug 4 2010, 10:55:56 Copyright (c) by Martin Maurer, 2003-2009, Email: Martin.Maurer@clibb.de Portions Copyright (c) by Aeolus Development 2004, www.aeolusdevelopment.com Syntax: lpc21isp [Options] file[ file[ ...]] comport baudrate Oscillator_in_kHz Example: lpc21isp test.hex com1 115200 14746 Options: -bin for uploading binary file -hex for uploading file in intel hex format (default) -term for starting terminal after upload -termonly for starting terminal without an upload -localecho for local echo in terminal -detectonly detect only used LPC chiptype (PHILIPSARM only) -debug0 for no debug -debug3 for progress info only -debug5 for full debug -donotstart do not start MCU after download -try try n times to synchronise -wipe Erase entire device before upload -control for controlling RS232 lines for easier booting (Reset = DTR, EnableBootLoader = RTS) -controlswap swap RS232 control lines (Reset = RTS, EnableBootLoader = DTR) -controlinv Invert state of RTS & DTR (0=true/assert/set, 1=false/deassert/clear). -verify Verify the data in Flash after every writes to sector. To detect errors in writing to Flash ROM -logfile for enabling logging of terminal output to lpc21isp.log -halfduplex use halfduplex serial communication (i.e. with K-Line) -ADARM for downloading to an Analog Devices ARM microcontroller ADUC70xx -PHILIPSARM for downloading to a microcontroller from NXP(Philips) LPC13xx/LPC17xx/LPC2000 family (default) 请按任意键继续. . .
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值