at91rm9200啟動過程教程 系統上電,檢測BMS,選擇系統的啟動方式,如果BMS為高電平,則系統從片內ROM啟動。AT91RM9200的ROM上電后被映射到了0x0和0x100000處,在這兩個地址處都可以訪問到ROM。由于9200的ROM中固化了一個BOOTLOAER程序。所以PC從0X0處開始執行這個BOOTLOAER(準確的說應該是一級BOOTLOADER)。這個BOOTLOER依次完成以下步驟: 1、PLL SETUP,設置PLLB產生48M時鐘頻率提供給USB DEVICE。同時DEBUG USART也被初始化為48M的時鐘頻率; 2、相應模式下的堆棧設置; 3、檢測主時鐘源(Main oscillator); 4、中斷控制器(AIC)的設置; 5、C 變量的初始化; 6、跳到主函數。 完成以上步驟后,我們可以認為BOOT過程結束,接下來的就是LOADER的過程,或者也可以認為是裝載二級BOOTLOER。AT91RM9200按照DATAFLASH、EEPROM、連接在外部總線上的8位并行FLASH的順序依次來找合法的BOOT程序。所謂合法的指的是在這些存儲設備的開始地址處連續的存放的32個字節,也就是8條指令必須是跳轉指令或者裝載PC的指令,其實這樣規定就是把這8條指令當作是異常向量表來處理。必須注意的是第6條指令要包含將要裝載的映像的大小。關于如何計算和寫這條指令可以參考用戶手冊。一旦合法的映像找到之后,則BOOT程序會把找到的映像搬到SRAM中去,所以映像的大小是非常有限的,不能超過16K-3K的大小。當BOOT程序完成了把合法的映像搬到SRAM的任務以后,接下來就進行存儲器的REMAP,經過REMAP之后,SRAM從映設前的0X200000地址處被映設到了0X0地址并且程序從0X0處開始執行。而ROM這時只能在0X100000這個地址處看到了。至此9200就算完成了一種形式的啟動過程。如果BOOT程序在以上所列的幾種存儲設備中找到合法的映像,則自動初始化DEBUG USART口和USB DEVICE口以準備從外部載入映像。對DEBUG口的初始化包括設置參數115200 8 N 1以及運行XMODEM協議。對USB DEVICE進行初始化以及運行DFU協議?,F在用戶可以從外部(假定為PC平臺)載入你的映像了。在PC平臺下,以WIN2000為例,你可以用超級終端來完成這個功能,但是還是要注意你的映像的大小不能超過13K。一旦正確從外部裝載了映像,接下來的過程就是和前面一樣重映設然后執行映像了。我們上面講了BMS為高電平,AT91RM9200選擇從片內的ROM啟動的一個過程。如果BMS為低電平,則AT91RM9200會從片外的FLASH啟動,這時片外的FLASH的起始地址就是0X0了,接下來的過程和片內啟動的過程是一樣的,只不過這時就需要自己寫啟動代碼了,至于怎么寫,大致的內容和ROM的BOOT差不多,不同的硬件設計可能有不一樣的地方,但基本的都是一樣的。由于片外FLASH可以設計的大,所以這里編寫的BOOTLOADER可以一步到位,也就是說不用像片內啟動可能需要BOOT好幾級了,目前AT91RM9200上使用較多的bootloer是u-boot,這是一個開放源代碼的軟件,用戶可以自由下載并根據自己的應用配置??偟恼f來,筆者以為AT91RM9200的啟動過程比較簡單,ATMEL的服務也不錯,不但提供了片內啟動的功能,還提供了UBOOT可供下載。筆者寫了一個BOOTLODER從片外的FLASHA啟動,效果還可以。 uboot結構與使用uboot是一個龐大的公開源碼的軟件。他支持一些系列的arm體系,包含常見的外設的驅動,是一個功能強大的板極支持包。其代碼可以 http://sourceforge.net/projects/u-boot下載 在9200上,為了啟動uboot,還有兩個boot軟件包,分別是loader和boot。分別完成從sram和flash中的一級boot。其源碼可以從atmel的官方網站下載。 我們知道,當9200系統上電后,如果bms為高電平,則系統從片內rom啟動,這時rom中固化的boot程序初始化了debug口并向其發送'c',這時我們打開超級終端會看到ccccc...。這說明系統已經啟動,同時xmodem協議已經啟動,用戶可以通過超級終端下載用戶的bootloader。作為第一步,我們下載loader.bin.loader.bin將被下載到片內的sram中。這個loder完成的功能主要是初始化時鐘,sdram和xmodem協議,為下載和啟動uboot做準備。當下載了loader.bin后,超級終端會繼續打?。篶cccc....。這時我們就可以下在uboot了。uboot將被下載到sdram中的一個地址后并把pc指針調到此處開始執行uboot。接著我們就可以在終端上看到uboot的shell啟動了,提示符uboot>,用戶可以uboot>help 看到命令列表和大概的功能。uboot的命令包含了對內存、flash、網絡、系統啟動等一些命令。 如果系統上電時bms為低電平,則系統從片外的flash啟動。為了從片外的flash啟動uboot,我們必須把boot.bin放到0x0地址出,使得從flash啟動后首先執行boot.bin,而要少些boot.bin,就要先完成上面我們講的那些步驟,首先開始從片內rom啟動uboot。然后再利用uboot的功能完成把boot.bin和uboot.gz燒寫到flash中的目的,假如我們已經啟動了uboot,可以這樣操作: uboot>protect off all uboot>erase all uboot>loadb 20000000 uboot>cp.b 20000000 10000000 5fff uboot>loadb 21000000 uboot>cp.b 210000000 10010000 ffff 然后系統復位,就可以看到系統先啟動boot,然后解壓縮uboot.gz,然后啟動uboot。注意,這里uboot必須壓縮成.gz文件,否則會出錯。 怎么編譯這三個源碼包呢,首先要建立一個arm的交叉編譯環境,關于如何建立,此處不予說明。建立好了以后,分別解壓源碼包,然后修改Makefile中的編譯器項目,正確填寫你的編譯器的所在路徑。 對loader和boot,直接make。對uboot,第一步:make_at91rm9200dk,第二步:make。這樣就會在當前目錄下分別生成*.bin文件,對于uboot.bin,我們還要壓縮成.gz文件。 也許有的人對loader和boot搞不清楚為什么要兩個,有什么區別嗎?首先有區別,boot主要完成從flash中啟動uboot的功能,他要對uboot的壓縮文件進行解壓,除此之外,他和loader并無大的區別,你可以把boot理解為在loader的基礎上加入了解壓縮.gz的功能而已。所以這兩個并無多大的本質不同,只是他們的使命不同而已。 特別說名的是這三個軟件包都是開放源碼的,所以用戶可以根據自己的系統的情況修改和配置以及裁減,打造屬于自己系統的bootloder。
上傳時間: 2013-10-27
上傳用戶:wsf950131
Keil C51使用詳解Keil C51 是美國Keil Software 公司出品的51 系列兼容單片機C 語言軟件開發系統,與匯編相比,C 語言在功能上、結構性、可讀性、可維護性上有明顯的優勢,因而易學易用。用過匯編語言后再使用C 來開發,體會更加深刻。Keil C51 軟件提供豐富的庫函數和功能強大的集成開發調試工具,全Windows界面。另外重要的一點,只要看一下編譯后生成的匯編代碼,就能體會到Keil C51生成的目標代碼效率非常之高,多數語句生成的匯編代碼很緊湊,容易理解。在開發大型軟件時更能體現高級語言的優勢。下面詳細介紹 Keil C51 開發系統各部分功能和使用。第二節 Keil C51 單片機軟件開發系統的整體結構C51 工具包的整體結構,如圖(1)所示,其中uVision 與Ishell 分別是C51 forWindows 和for Dos 的集成開發環境(IDE),可以完成編輯、編譯、連接、調試、仿真等整個開發流程。開發人員可用IDE 本身或其它編輯器編輯C 或匯編源文件。然后分別由C51 及A51 編譯器編譯生成目標文件(.OBJ)。目標文件可由LIB51 創建生成庫文件,也可以與庫文件一起經L51 連接定位生成絕對目標文件(.ABS)。ABS 文件由OH51 轉換成標準的Hex 文件,以供調試器dScope51 或tScope51 使用進行源代碼級調試,也可由仿真器使用直接對目標板進行調試,也可以直接寫入程序存貯器如EPROM 中。圖(1) C51 工具包整體結構圖第三節 Keil C51 工具包的安裝81. C51 for Dos在 Windows 下直接運行軟件包中DOS\C51DOS.exe 然后選擇安裝目錄即可。完畢后欲使系統正常工作須進行以下操作(設C:\C51 為安裝目錄):修改 Autoexec.bat,加入path=C:\C51\BinSet C51LIB=C:\C51\LIBSet C51INC=C:\C51\INC然后運行Autoexec.bat2. C51 for Windows 的安裝及注意事項:在 Windows 下運行軟件包中WIN\Setup.exe,最好選擇安裝目錄與C51 for Dos相同,這樣設置最簡單(設安裝于C:\C51 目錄下)。然后將軟件包中crack 目錄中的文件拷入C:\C51\Bin 目錄下。第四節 Keil C51 工具包各部分功能及使用簡介1. C51 與A51(1) C51C51 是C 語言編譯器,其使用方法為:C51 sourcefile[編譯控制指令]或者 C51 @ commandfile其中 sourcefile 為C 源文件(.C)。大量的編譯控制指令完成C51 編譯器的全部功能。包控C51 輸出文件C.LST,.OBJ,.I 和.SRC 文件的控制。源文件(.C)的控制等,詳見第五部分的具體介紹。而 Commandfile 為一個連接控制文件其內容包括:.C 源文件及各編譯控制指令,它沒有固定的名字,開發人員可根據自己的習慣指定,它適于用控制指令較多的場合。(2) A51A51 是匯編語言編譯器,使用方法為:9A51 sourcefile[編譯控制指令]或 A51 @ commandfile其中sourcefile 為匯編源文件(.asm或.a51),而編譯控制指令的使用與其它匯編如ASM語言類似,可參考其他匯編語言材料。Commandfile 同C51 中的Commandfile 類似,它使A51 使用和修改方便。2. L51 和BL51(1) L51L51 是Keil C51 軟件包提供的連接/定位器,其功能是將編譯生成的OBJ 文件與庫文件連接定位生成絕對目標文件(.ABS),其使用方法為:L51 目標文件列表[庫文件列表] [to outputfile] [連接控制指令]或 L51 @Commandfile源程序的多個模塊分別經 C51 與A51 編譯后生成多個OBJ 文件,連接時,這些文件全列于目標文件列表中,作為輸入文件,如果還需與庫文件(.LiB)相連接,則庫文件也必須列在其后。outputfile 為輸文件名,缺少時為第一模塊名,后綴為.ABS。連接控制指令提供了連接定位時的所有控制功能。Commandfile 為連接控制文件,其具體內容是包括了目標文件列表,庫文件列表及輸出文件、連接控制命令,以取代第一種繁瑣的格式,由于目標模塊庫文件大多不止1 個,因而第2 種方法較多見,這個文件名字也可由使用者隨意指定。(2) Bl51BL51 也是C51 軟件包的連接/定位器,其具有L51 的所有功能,此外它還具有以下3 點特別之處:a. 可以連接定位大于64kBytes 的程序。b. 具有代碼域及域切換功能(CodeBanking & Bank Switching)c. 可用于RTX51 操作系統RTX51 是一個實時多任務操作系統,它改變了傳統的編程模式,甚至不必用main( )函數,單片機系統軟件向RTOS 發展是一種趨勢,這種趨勢對于186 和38610及68K 系列CPU 更為明顯和必須,對8051 因CPU 較為簡單,程序結構等都不太復雜,RTX51 作用顯得不太突出,其專業版軟件PK51 軟件包甚至不包括RTX51Full,而只有一個RTX51TINY 版本的RTOS。RTX51 TINY 適用于無外部RAM 的單片機系統,因而可用面很窄,在本文中不作介紹。Bank switching 技術因使用很少也不作介紹。3. DScope51,Tscope51 及Monitor51(1) dScope51dScope51 是一個源級調試器和模擬器,它可以調試由C51 編譯器、A51 匯編器、PL/M-51 編譯器及ASM-51 匯編器產生的程序。它不需目標板(for windows 也可通過mon51 接目標板),只能進行軟件模擬,但其功能強大,可模擬CPU 及其外圍器件,如內部串口,外部I/O 及定時器等,能對嵌入式軟件功能進行有效測試。
上傳時間: 2013-11-01
上傳用戶:zhouxuepeng1
1.The C Programming Language is a powerful, flexible andpotentially portable high-level programming language. 2.The C language may be used successfully to create a programfor an 8-bit MCU, but to produce the most efficient machinecode, the programmer must carefully construct the C Languageprogram.3.The programmer must not only create an efficient high leveldesign, but also pay attention to the detailed implementation.
上傳時間: 2013-12-27
上傳用戶:huanglang
AT89C2051驅動步進電機的電路和源碼:AT89C2051驅動步進電機的電路和源碼 程序:stepper.c stepper.hex/* * STEPPER.C * sweeping stepper's rotor cw and cww 400 steps * Copyright (c) 1999 by W.Sirichote */#i nclude c:\mc5151io.h /* include i/o header file */ #i nclude c:\mc5151reg.hregister unsigned char j,flag1,temp; register unsigned int cw_n,ccw_n;unsigned char step[8]={0x80,0xc0,0x40,0x60,0x20,0x30,0x10,0x90} #define n 400/* flag1 mask byte 0x01 run cw() 0x02 run ccw() */main(){ flag1=0; serinit(9600); disable(); /* no need timer interrupt */ cw_n = n; /* initial step number for cw */ flag1 |=0x01; /* initial enable cw() */while(1){ { tick_wait(); /* wait for 10ms elapsed */energize(); /* round-robin execution the following tasks every 10ms */ cw(); ccw(); } }}cw(){ if((flag1&0x01)!=0) { cw_n--; /* decrement cw step number */ if (cw_n !=0) j++; /* if not zero increment index j */ else {flag1&=~0x01; /* disable cw() execution */ ccw_n = n; /* reload step number to ccw counter */ flag1 |=0x02; /* enable cww() execution */ } }
上傳時間: 2013-11-21
上傳用戶:boyaboy
The PCA9541 is a 2-to-1 I2C-bus master selector designed for high reliability dual masterI2C-bus applications where system operation is required, even when one master fails orthe controller card is removed for maintenance. The two masters (for example, primaryand back-up) are located on separate I2C-buses that connect to the same downstreamI2C-bus slave devices. I2C-bus commands are sent by either I2C-bus master and are usedto select one master at a time. Either master at any time can gain control of the slavedevices if the other master is disabled or removed from the system. The failed master isisolated from the system and will not affect communication between the on-line masterand the slave devices on the downstream I2C-bus.
上傳時間: 2013-10-09
上傳用戶:3294322651
The PCA9544A provides 4 interrupt inputs, one for each channeland one open drain interrupt output. When an interrupt is generated byany device, it will be detected by the PCA9544A and the interruptoutput will be driven LOW. The channel need not be active fordetection of the interrupt. A bit is also set in the control byte.Bits 4 – 7 of the control byte correspond to channels 0 – 3 of thePCA9544A, respectively. Therefore, if an interrupt is generated byany device connected to channel 2, the state of the interrupt inputs isloaded into the control register when a read is accomplished.Likewise, an interrupt on any device connected to channel 0 wouldcause bit 4 of the control register to be set on the read. The mastercan then address the PCA9544A and read the contents of thecontrol byte to determine which channel contains the devicegenerating the interrupt. The master can then reconfigure thePCA9544A to select this channel, and locate the device generatingthe interrupt and clear it. The interrupt clears when the deviceoriginating the interrupt clears.
標簽: 4channel multiple 9544A 9544
上傳時間: 2014-12-28
上傳用戶:潛水的三貢
Although Stellaris microcontrollers have generous internal SRAM capabilities, certain applicationsmay have data storage requirements that exceed the 8 KB limit of the Stellaris LM3S8xx seriesdevices. Since microcontrollers do not have an external parallel data-bus, serial memory optionsmust be considered. Until recently, the ubiquitous serial EEPROM/flash device was the only serialmemory solution. The major limitations of EEPROM and flash technology are slow write speed, slowerase times, and limited write/erase endurance.Recently, serial SRAM devices have become available as a solution for high-speed dataapplications. The N256S08xxHDA series of devices, from AMI Semiconductor, offer 32 K x 8 bits oflow-power data storage, a fast Serial Peripheral Interface (SPI) serial bus, and unlimited write cycles.The parts are available in 8-pin SOIC and compact TSSOP packages.
上傳時間: 2013-10-14
上傳用戶:cxl274287265
The C500 microcontroller family usually provides only one on-chip synchronous serialchannel (SSC). If a second SSC is required, an emulation of the missing interface mayhelp to avoid an external hardware solution with additional electronic components.The solution presented in this paper and in the attached source files emulates the mostimportant SSC functions by using optimized SW routines with a performance up to 25KBaud in Slave Mode with half duplex transmission and an overhead less than 60% atSAB C513 with 12 MHz. Due to the implementation in C this performance is not the limitof the chip. A pure implementation in assembler will result in a strong reduction of theCPU load and therefore increase the maximum speed of the interface. In addition,microcontrollers like the SAB C505 will speed up the interface by a factor of two becauseof an optimized architecture compared with the SAB C513.Moreover, this solution lays stress on using as few on-chip hardware resources aspossible. A more excessive consumption of those resources will result in a highermaximum speed of the emulated interface.Due to the restricted performance of an 8 bit microcontroller a pin compatible solution isprovided only; the internal register based programming interface is replaced by a set ofsubroutine calls.The attached source files also contain a test shell, which demonstrates how to exchangeinformation between an on-chip HW-SSC and the emulated SW-SSC via 5 external wiresin different operation modes. It is based on the SAB C513 (Siemens 8 bit microcontroller).A table with load measurements is presented to give an indication for the fraction of CPUperformance required by software for emulating the SSC.
標簽: synchronous Emulating serial
上傳時間: 2014-01-31
上傳用戶:z1191176801
In this document, the term Ô60xÕ is used to denote a 32-bit microprocessor from the PowerPC architecture family that conforms to the bus interface of the PowerPC 601ª, PowerPC 603ª, or PowerPC 604 microprocessors. Note that this does not include the PowerPC 602ª microprocessor which has a multiplexed address/data bus. 60x processors implement the PowerPC architecture as it is speciÞed for 32-bit addressing, which provides 32-bit effective (logical) addresses, integer data types of 8, 16, and 32 bits,and ßoating-point data types of 32 and 64 bits (single-precision and double-precision).1.1 Overview The MPC106 provides an integrated high-bandwidth, high-performance, TTL-compatible interface between a 60x processor, a secondary (L2) cache or additional (up to four total) 60x processors, the PCI bus,and main memory. This section provides a block diagram showing the major functional units of the 106 and describes brießy how those units interact.Figure 1 shows the major functional units within the 106. Note that this is a conceptual block diagram intended to show the basic features rather than an attempt to show how these features are physically implemented on the device.
上傳時間: 2013-10-08
上傳用戶:18711024007
The μPSD32xx family, from ST, consists of Flash programmable system devices with a 8032 MicrocontrollerCore. Of these, the μPSD3234A and μPSD3254A are notable for having a complete implementationof the USB hardware directly on the chip, complying with the Universal Serial Bus Specification, Revision1.1.This application note describes a demonstration program that has been written for the DK3200 hardwaredemonstration kit (incorporating a μPSD3234A device). It gives the user an idea of how simple it is to workwith the device, using the HID class as a ready-made device driver for the USB connection.IN-APPLICATION-PROGRAMMING (IAP) AND IN-SYSTEM-PROGRAMMING (ISP)Since the μPSD contains two independent Flash memory arrays, the Micro Controller Unit (MCU) can executecode from one memory while erasing and programming the other. Product firmware updates in thefield can be reliably performed over any communication channel (such as CAN, Ethernet, UART, J1850)using this unique architecture. For In-Application-Programming (IAP), all code is updated through theMCU. The main advantage for the user is that the firmware can be updated remotely. The target applicationruns and takes care on its own program code and data memory.IAP is not the only method to program the firmware in μPSD devices. They can also be programmed usingIn-System-Programming (ISP). A IEEE1149.1-compliant JTAG interface is included on the μPSD. Withthis, the entire device can be rapidly programmed while soldered to the circuit board (Main Flash memory,Secondary Boot Flash memory, the PLD, and all configuration areas). This requires no MCU participation.The MCU is completely bypassed. So, the μPSD can be programmed or reprogrammed any time, anywhere, even when completely uncommitted.Both methods take place with the device in its normal hardware environment, soldered to a printed circuitboard. The IAP method cannot be used without previous use of ISP, because IAP utilizes a small amountof resident code to receive the service commands, and to perform the desired operations.
標簽: Demonstration 3200 USB for
上傳時間: 2014-02-27
上傳用戶:zhangzhenyu