Home

AT91 In-system Programmer (ISP) User Guide

image

Contents

1. int 0x0000 AT91C_BOOT_DLL_OK Standard Error Codes e int 0OxF001 Bad h handle parameter e int OxF002 Address is not correctly aligned E I en e int OxFO05 Communication link broken CAN Error Codes e int 0x8002 CAN Read dll function returned fail e int 0x8003 CAN Write dll function returned fail Return Code void 3 1 6 2 Code Example AT91Boot Write Short h handle OxCAFE 0x200000 amp err code 3 1 7 AT91Boot Write Byte This function writes an 8 bit word into the volatile memory of the connected target 3 1 7 1 Description void AT91Boot Write Byte int h handle char bValue int uAddress int err code Table 3 7 AT91Boot Write Byte Type Name Details Communication handle returned by AT91Boot Open h handle i function input Farameters bValue 8 bit value to write uAddress Address where to write 8 bit value 3 8 AIMEL AT91 In system Programmer ISP User Guide 6224D ATARM 28 Jul 06 AT91Boot DLL Interface Table 3 7 AT91Boot Write Byte Type Name Details Output Parameters none e int 0x0000 AT91C BOOT DLL OK Standard Error Codes e int OxF001 Bad h handle parameter x e int OxF002 Address is not correctly aligned Biror uode or onde e int 0xF005 Communication link broken CAN Error Codes e int 0x8002 CAN Read dl function returned fail e int 0x8003 CAN Write dll function
2. 3 1 1 2 Code Example 3 1 2 AT91Boot_Open 3 1 2 1 Description 3 1 2 2 Code Example 3 1 2 3 JTAG Communication Link 3 2 6224D ATARM 28 Jul 06 CHAR strConnectedDevices 5 for UINT i 0 i lt 5 i strConnectedDevices i CHAR malloc 100 AT91Boot_Scan char strConnectedDevices AT91Boot_Scan may return code similar to that below strConnectedDevices 0 usb ARMO strConnectedDevices 1 usb ARM1 strConnectedDevices 2 jlink ARMO strConnectedDevices 3 can AtCanPeak ARM strConnectedDevices 4 COM1 This function opens the communication link on an AT91SAM device depending on the string given in the argument m USB E JTAG m CAN E Serial COM port Note At this step the Atmel device MUST be connected to either SAM ICE JLink CAN network or COM port if using such a communication link void AT91Boot Open char name int h handle Table 3 2 AT91Boot Open Type Name Details Input Parameters name Pointer to a string returned by AT91Boot Scan function Communication handle Output Parameters h handle NULL if opening connection failed Non NULL if opening connection succeeded Return Code void Note 1 As AT91Boot Scan function detects only CAN dongles and not AT91SAM devices which are connected to it is recommended to add an identifier to the end of string for each device such as for example can AtCanPeak ARMO can AtCanPeak ARMT
3. AT91Boot amp h handle AT91Boot_Open can AtCanPeak ARMO amp h handle When opening a JTAG communication link through a SAM ICE or a JLink by using the following command AT91Boot_Open jlink ARMO amp h handle the following steps are performed 1 Open JLinkARM dlIl and its associated library functions 2 Set JTAG speed to 30 kHz in order to connect to the target even if it is running at 32 kHz 3 Stop the target AIMEL AT91 In system Programmer ISP User Guide 9 able the Watchdog AT91Boot DLL Interface Set a hardware breakpoint at address 0 Send a PROCRST command RSTC CR in the Reset Controller in order to dis Wait for the target to reach the breakpoint Download a monitor into the target internal SRAM that allows communication only through the ARM Debug Communication Channels by using the SAM BA Boot commands Jump to the monitor in internal SRAM If the target was running at 32kHz the monitor switches on the Main Oscillator Set JTAG speed to 3 MHz as it is the lowest allowed crystal frequency Note 1 For further information about DCC visit www arm com 2 For further informations about SAM BA Boot commands see the Boot Program sec tion of the product datasheet 3 It is recommended to configure the PLL when returning from AT91Boot Open func tion in order to speed up monitor execution 3 1 3 AT91Boot Close This function closes the communication link previou
4. Using AT91Boot DLL Project Examples for more information on the following projects m OLE MFC project under Visual C 6 0 m OLE without MFC project under Visual C 6 0 m CAN TCLSH gives an example of a TCL script that can be used to program a SAM7X256 based board over the CAN network This application downloads a binary file into the Flash memory of one or more AT91SAM devices in parallel from a PC or JTAG probe This directory contains binary files for AT91SAM7A3 and AT91SAM7X devices These files must be programmed into internal Flash memory before communicating over a CAN SAM PROG can be used to program these files AT91Boot_DLL needs to be registered in the Windows Base Register in order to be used correctly The Install program will register AT91Boot_DLL automatically AT91Boot_DLL dll uses JLinKARM dll In order for the user to compile a project any where YOUR_INSTALL_DIRECTORY Library path has been added to the PATH user environment variable If it is not the case JLinkARM dlls has to be set in the current directory of your application in order to be found by the AT91Boot_DLL Note It is also possible to copy dll contained in the Library directory into WINNT System32 as this directory is in the PATH environment variable by default Do not forget to register AT91Boot_DLL after moving To register AT91Boot_DLL manually execute the following command from a DOS Win dow or directly through the Windows Start Execute m
5. code m set uValue TCL Read Int h handle wAddress err code m set wValue TCL Read Short h handle wAddress err code E set bValue TCL Read Byte h handle wAddress ert code E set bValue TCL Read Data h handle wAddress size err code m TCL Go h handle wAddress ert code For Read actions E set uValue TCL CAN Configure h handle uAction uParam ert code For other actions AT91 In system Programmer ISP User Guide 4 1 6224D ATARM 28 Jul 06 AT91Boot TCL Interface 4 3 Internal Flash Programming Functions 4 4 TCL Script Example 4 2 6224D ATARM 28 Jul 06 m TCL CAN Configure h handle uAction uParam uValue err code These functions are available only for AT91SAM microcontrollers with Flash m TCL SAM7S832 Send Flash h handle wOffset bValue size err code m TCL SAM7S64 Send Flash h handle wOffset bValue size err code m TCL SAM7S128 Send Flash h handle wOffset bValue size err code m TCL SAM78256 Send Flash h handle wOffset bValue size err code m TCL SAM7S512 Send Flash h handle wOffset bValue size err code m TCL SAM7SA3 Send Flash h handle wOffset bValue size err code m TCL SAM7X128 Send Flash h handle wOffset bValue size err code m TCL SAM7X256 Send Flash h handle wOffset bValue size err code m TCL SAM7X512 Send Flash h handle wOffset bValue size err code m TCL SAM7SE256 Send Flash h handle wOffset bValue size err code m TCL SAM7SE512 Send Flash h handle wOffset bValue size err
6. folder It scans connected devices opens the first one reads DBUG chip ID If an AT91SAM7S256 is detected it programs a small application BasicMouse in the internal Flash To use AT91Boot DLL in such a project the following steps must be performed E Create an AT91Boot DLL class in your project To do this copy both at91boot_dll cpp and at91boot_dll h files into your project directory Note Do not use the ClassWizard Add Class From a type library as there is a bug in Visual C 6 0 The bug prevents any functions containing a char variable as a parameter from being imported E Initialize OLE libraries by calling AfxoleInit function m Create an AT91Boot DLL driver object to manage AT91Boot DLL COM object E Create an AT91Boot DLL COM object instance with the AT91Boot DLL program ID AT91BooOt DLL AT91BOOEDLL 1 by using CreateDispatch function Note 1 Program ID is stored in the base register and is an easier way to retrieve AT91Boot DLL Class ID necessary for CreateDispatch function Once these four steps have been performed DLL functions should be available See their prototypes in at91boot_dll h header file and for details on how to call these functions Note Atthis step if AT91Boot DLL functions are not available it is because the AT91Boot DLL dll has not been registered correctly See Section 1 3 2 for more information AT91 In system Programmer ISP User Guide 5 1 6224D ATARM 28 Jul 06 Using AT91Boot DLL P
7. int 0x0000 AT91C BOOT DLL OK CAN Error Codes e int 0x8001 CAN Open dll function returned fail err code int 0x8002 CAN Read dll function returned fail e int 0x8003 CAN Write d function returned fail e int 0x8004 Target not disconnected e int 0x8005 Target not connected e int Ox8006 uAction parameter is not valid Return Code void AT91 In system Programmer ISP User Guide AMEL 3 5 6224D ATARM 28 Jul 06 AT91Boot DLL Interface 3 1 4 3 Code Example define CAN WRITE CFG 1 define CAN SET BAUDRATE 3 define CAN CONNECT TARGET 4 define CAN DISCONNECT TARGET 5 define CAN NNB 0 int err code First Set CAN Baudrate int baudrate 500 AT91Boot_CAN Configure h handle CAN SET BAUDRATE 0 amp baudrate amp err code Then Connect to target AT91Boot CAN Configure h handle CAN CONNECT TARGET 0 NULL amp err code DO NOT FORGET TO CONFIGURE EFC FMR REGISTER CORRECTLY AT91Boot Write Int h handle OxXXXXXXXX OxFFFFFF60 amp err code Write a new Node Number value for example int new nnb 0x10 AT91Boot CAN Configure h handle CAN WRITE CFG CAN NNB amp new nnb amp err code Disconnect the target AT91Boot CAN Configure h handle CAN DISCONNECT TARGET 0 NULL amp err code 3 6 AIMEL AT91 In system Programmer ISP User Guide 6224D ATARM 28 Jul 06 AT91Boot DLL Interface 3 1 5 A
8. m AT91Boot SAM7S256 Send Flash m AT91Boot SAM7S512 Send Flash m AT91Boot SAM7A3 Send Flash m AT91Boot SAM7X128 Send Flash available for SAM7X128 and SAM7XC128 parts m AT91Boot SAM7X256 Send Flash available for SAM7X256 and SAM7XC256 parts m AT91Boot SAM7X512 Send Flash available for SAM7X512 and SAM7XC512 parts m AT91Boot SAM7SE256 Send Flash m AT91Boot SAM7SE512 Send Flash 3 2 1 1 Prerequisite Embedded Flash Controller Flash Mode Register EFC FMR must be programmed correctly prior using one of these functions Note Two Embedded Flash Controllers are embedded in AT91SAM7S512 AT91SAM7X512 and AT91SAM7SE512 parts Both EFC FMRx registers must be programmed correctly prior using one of these functions 3 2 1 2 Description void AT91Boot SAM7xxx Send Flash int h handle int uOffset char bData int uSize int err code Table 3 14 AT91Boot SAM7xxx Send Flash Type Name Details Communication handle returned by AT91Boot Open h handle function Input Parameters uOffset Internal Flash Offset where to write 8 bit value bData Pointer to 8 bit data buffer to write uSize Buffer size in bytes AT91 In system Programmer ISP User Guide AIMEL 3 15 6224D ATARM 28 Jul 06 AT91Boot DLL Interface 3 2 1 3 Code Example 3 16 6224D ATARM 28 Jul 06 Table 3 14 AT91Boot_SAM7xxx_Send_Flash Type Name Details Output Parameters none e int 0x0000 AT91C_BOOT_DLL_OK Standard Error Code
9. void AT91Boot Read Int int h handle int uValue int uAddress int err_code Table 3 9 AT91Boot Read Int Type Name Details h handle Communication handle returned by AT91Boot Open function Input Parameters uValue Pointer to a 32 bit value uAddress Address where to read 32 bit value Output Parameters uValue 32 bit read value e int 0x0000 AT91C BOOT DLL OK Standard Error Codes e int 0xF001 Bad h handle parameter e int 0xF002 Address is not correctly aligned E I en e int OxFO05 Communication link broken CAN Error Codes e int 0x8002 CAN Read dil function returned fail e int 0x8003 CAN Write dll function returned fail Return Code void int ChipId AT91Boot Read I nt h handle amp ChipId OxFFFFF240 amp err code AT91Boot Read Short This function reads a 16 bit word from the connected target 3 1 10 1 Description 3 10 6224D ATARM 28 Jul 06 void AT91Boot_Read_Short int h handle short wValue int uAddress int err code Table 3 10 AT91Boot Read Short Type Input Parameters Name Details Communication handle returned by AT91Boot Open h handle function wValue Pointer to a 16 bit value uAddress Address where to read 16 bit value AMEL AT91 In system Programmer ISP User Guide AT91Boot DLL Interface Table 3 10 AT91Boot Read Short Type Name Details Output Parameters wValu
10. 1 26 426 5555 BP 70602 High Speed Converters RF Datacom Fax 41 26 426 5500 44306 Nantes Cedex 3 France Avenue de Rochepleine Tel 33 2 40 18 18 18 BP 123 Asia Fax 33 2 40 18 19 60 38521 Saint Egreve Cedex France Room 1219 Tel 33 4 76 58 30 00 Chinachem Golden Plaza ASIC ASSP Smart Cards Fax 33 4 76 58 34 80 77 Mody Road Tsimshatsui Zone Industrielle East Kowloon 13106 Rousset Cedex France Hong Kano Tel 33 4 42 53 60 00 Fax 852 2722 1369 1150 East Cheyenne Min Blvd Japan Colorado Springs CO 80906 USA 9F Tonetsu Shinkawa Bldg Tel 1 719 576 3300 1 24 8 Shinkawa Fax 1 719 540 1759 Chuo ku Tokyo 104 0033 Japan Scottish Enterprise Technology Park Tel 81 3 3523 3551 Maxwell Building Fax 81 3 3523 7581 East Kilbride G75 OQR Scotland Tel 44 1355 803 000 Fax 44 1355 242 743 Literature Requests www atmel com literature RW POWERED ARM Disclaimer The information in this document is provided in connection with Atmel products No license express or implied by estoppel or otherwise to any intellectual property right is granted by this document or in connection with the sale of Atmel products EXCEPT AS SET FORTH IN ATMELS TERMS AND CONDI TIONS OF SALE LOCATED ON ATMELS WEB SITE ATMEL ASSUMES NO LIABILITY WHATSOEVER AND DISCLAIMS ANY EXPRESS IMPLIED OR STATUTORY WARRANTY RELATING TO ITS PRODUCTS INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTY OF MERCHANTABILITY FITNESS FOR A PARTICULAR PU
11. 12 added new information on Error Code Added new code in all sections Code Example In Section 3 2 Internal Flash Programming Functions AT91Boot SAM7xxx Send Flash updated list of available functions Section 3 2 1 1 Prerequisite added Error Code information to Table 3 14 and updated Section 3 2 1 3 Code Example In AT91Boot TCL Interface in Section 4 2 Low level Functions and in Section 4 3 Internal Flash Programming Functions updated list of functions Updated Section 4 4 TCL Script Example AT91 In system Programmer ISP User Guide 6 1 6224D ATARM 28 Jul 06 Revision History 6 2 AIMEL AT91 In system Programmer ISP User Guide 6224D ATARM 28 Jul 06 AIMEL T e Atmel Corporation Atmel Operations 2325 Orchard Parkway Memory RF Automotive San Jose CA 95131 USA 2325 Orchard Parkway Theresienstrasse 2 Tel 1 408 441 0311 San Jose CA 95131 USA Postfach 3535 Fax 1 408 487 2600 Tel 1 408 441 0311 74025 Heilbronn Germany Fax 1 408 436 4314 Tel 49 71 31 67 0 i Fax 49 71 31 67 2340 Regional Headquarters Microcontrollers Europe 2325 Orchard Parkway 1150 East Cheyenne Mtn Blvd Atmel Sarl San Jose CA 95131 USA Colorado Springs CO 80906 USA Route des Arsenaux 41 Tel 1 408 441 0311 Tel 1 719 576 3300 Case Postale 80 Fax 1 408 436 4314 Fax 1 719 540 1759 CH 1705 Fribour i i Switzerland g La Chantrerie Biometrics Imaging Hi Rel MPUI Tel 4
12. AM based Board running CAN Link SAM BA Boot4CAN USB Link AT91SAM based Board running SAM BA Boot Host Debugger Serial Link SAM ICE JLink AT91SAM based Board JTAG Interface running SAM BA Boot AT91SAM based Board JTAG Link Depending on which communication link is selected the target must be in the following state m When using the USB link or the DBGU serial link SAM BA Boot must run onto the target m When using the CAN link SAM BA Boot4CAN must run onto the target m When using JTAG communication through SAM ICE or JLink the target may be in an undefined state In this case it is up to the user to configure the target PLL etc if necessary AT91 In system Programmer ISP User Guide 2 1 6224D ATARM 28 Jul 06 Communicating with AT91SAM Devices 2 2 Starting Communication 2 2 6224D ATARM 28 Jul 06 The AT91Boot_DLL principle is simple It consists of Scanning all devices connected to the PC Opening communication to the selected device Performing all desired actions such as writing into Flash memory 1 2 3 4 Closing communication AMEL AT91 In system Programmer ISP User Guide AMEL 3 1 Low level Functions 3 1 1 AT91Boot_Scan 3 1 1 1 Description Section 3 AT91Boot DLL Interface A description and a code example is given for each function These functions are available for all AT91SAM microcontrollers This function scans connected devices and
13. AT91 In system Programmer ISP User Guide AMEL T Table of Contents Section 1 MOTEN vr 1 1 EE EE REE EN 1 1 1 2 DEL Prereguisites nun 1 2 1 3 Installaton serennu aaa a a TAa aa E AEAEE AAEE EERE 1 3 LOT Content ne 1 3 1 3 2 DLL Registration er en eat 1 3 1 3 3 Updating JLink SAM ICE Gottware nennen nn 1 3 Section 2 Communicating with AT91SAM Devices ssssssssseeessserrrnreserrrerreeerree 2 1 2 1 Communication Links 2 1 2 2 Starting Communjcation ann 2 2 Section 3 AT91Boot DEL Interface svada 3 1 3 1 Low level Functions pisie aa a aaa aser 3 1 83 1 1 AT9IBOOK SOA EEN 3 1 3 1 2 T boot Ope it u a 3 2 3 1 3 AT91Boot Close 3 3 3 1 4 AT91Boot CAN Configure W u u u dsesserererenren ennen nn nerne nn nes 3 4 3 1 5 AT91Boot Write Mitrei ee nn 3 7 3 1 6 ATgo1Boot Write Ghort een 3 8 3 1 7 AT91Boot_Write Byte eneret seen ee 3 8 3 1 8 AT91Boot Write Data 3 9 8 19 AT9TBo0t Read IR rotorer nede ae 3 10 3 1 10 AT91Boot Read Short en 3 10 3 1 11 AT91Boot_Read_Byte unmnnnnnnnnnennnnnennennnnnnnnnennnnnonnennnnnnnnen nen 3 12 3 1 12 AT91B0ot Read Data Lita en 3 12 3 1 13 AT91Boot Go 3 14 3 2 Internal Flash Programming Functions aeee 3 15 3 2 1 AT91Boot SAM7xxx Send Flash 3 15 Section 4 AT91Boot TCL Interface nn 4 1 4 1 Loading AT91Boot_TCL Functions eeeeeseeseeeeeeeereerireerresrireerineerensrns 4 1 AT91 In system Programmer ISP User Guide AIMEL i 6224D ATAR
14. Boot_DLL CAN functions The same principle can be applied in a Visual C project The script communicates with an AT91SAM7X256 based board over CAN and pro grams a USB Mouse application into the internal Flash memory SAM BA Boot4CAN is running It has been previously programmed in the internal Flash memory with AT91SAM PROG application First connect CAN Peak or IXXAT dongle between the PC and the board AMEL AT91 In system Programmer ISP User Guide Using AT91Boot DLL Project Examples Then open a DOS window and execute test tcl script by typing tclsh YOUR INSTALL DIRECTORY Examples CAN TCLSH test tcl After script execution the USB Mouse application must be programmed AT91 In system Programmer ISP User Guide AIMEL 5 3 6224D ATARM 28 Jul 06 Using AT91Boot DLL Project Examples 5 4 AIMEL AT91 In system Programmer ISP User Guide 6224D ATARM 28 Jul 06 AMEL T O Section 6 Revision History Table 6 1 Revision History Document Ref Comments Change Request Ref 6224A First issue 6224B Added Section 1 3 3 Updating JLink SAM ICE Software 6224C Updated document to refer to AT91SAM9 microcontrollers in Section 1 1 2833 Overview 6224D In Section 3 1 2 3 JTAG Communication Link on page 3 2 added steps 4 5 and 6 In AT91Boot CAN Configure Section 3 1 4 2 Description on page 3 5 updated In Section 3 1 Low level Functions in Table 3 4 to Table 3
15. DLL Interface 3 1 13 AT91Boot Go This function allows starting code execution at specified address 3 1 13 1 Description void AT91Boot_Go int h handle int uAddress int err_code Table 3 13 AT91Boot Read Data Type Name Details Communication handle returned by AT91Boot Open h handle function Input Parameters uAddress Address where to start code execution Output Parameters none e int 0x0000 AT91C_BOOT_DLL_OK Standard Error Codes e int OxFO01 Bad h handle parameter Error Code err code int 0xF005 Communication link broken CAN Error Codes e int 0x8002 CAN Read dl function returned fail e int 0x8003 CAN Write dll function returned fail Return Code void 3 1 13 2 Code Example AT91Boot Go h handle 0x200000 amp err code 3 14 AIMEL AT91 In system Programmer ISP User Guide 6224D ATARM 28 Jul 06 AT91Boot DLL Interface 3 2 Internal Flash These functions are available only for AT91SAM microcontrollers with Flash Programming Functions 3 2 1 AT91Boot SAM7xxx Send Flash These functions make it possible to write X bytes into the internal Flash memory of the connected target If some sectors are locked they are unlocked in order to effectively program the internal Flash memory Available functions are E AT91Boot_SAM7S32_Send_Flash available for SAM7S32 and SAM7S321 parts m AT91Boot SAM7S64 Send Flash m AT91Boot SAM7S128 Send Flash
16. EFC FMR must be programmed correctly before using this function Note AT91SAM CAN Bootloader automatically switches on the Main Oscillator when starting AMEL AT91 In system Programmer ISP User Guide 3 1 4 2 Description AT91Boot CAN Configure AT91Boot DLL Interface int h handle int uAction int uParam int uValue int err code Table 3 4 AT91Boot_CAN_Configure Type Name Details Communication handle returned by AT91Boot_Open h handle function Select Read or Write Action e 0x00 corresponds to a Read action i e 0x01 corresponds to a Write action uAction e 0x03 corresponds to a Set Baudrate action e 0x04 corresponds to a Connect Target action e 0x05 corresponds to a Disconnect Target action Select Parameters to Read Write e 0x00 Node Number NNB e 0x01 CAN Re locatable Identifier Segment CRIS e 0x02 AutoBaud Mode ABM uParam e 0x03 Propagation Segment PROPAG_SEG Input Parameters e 0x04 Phase Segment 1 PHASE1 SEG e 0x05 Phase Segment 2 PHASE SEG e 0x06 Baudrate Prescaler BRP Byte to write if uAction corresponds to a Write If uAction corresponds to a Set Baudrate action it is used only as CAN baudrate parameter for CAN baudrate configuration uValue The different configuration values are e 100 k e 125 k e 250 k e 500 k e 1000 k default value if no configuration passed Output Parameters uValue Byte to read if uAction corresponds to a Read e
17. M 28 Jul 06 ii 6224D ATARM 28 Jul 06 4 2 Low level Functions rwuvrarnvvvrnnnvrnnnnevrannenvnnnnernnnnnnrnnnenvnnnnernnnnenrnnnenvnnnsenn 4 1 4 3 Internal Flash Programming Functions srrrnnnnnnvrrnnnnvnnvrrnnnnvrnnrrnnnrennvrnnn 4 2 4 4 TCL Script Example A 4 2 Section 5 Using AT91Boot DLL Project Examples E 5 1 5 1 Visual C 6 0 Projects rrrrrnnnrnnnrnrrnnonnrnrnnnrennnnrnnnnnrenenrrnnnrnrenennnnsnrnrenenen 5 1 5 1 1 Using AT91Boot DLL with ME 5 1 5 1 2 Using AT91Boot DLL without ME 5 2 5 2 Running the TCL Script Exvample 5 2 Section 6 Revision HISTOTY een 6 1 AMEL AT91 In system Programmer ISP User Guide AMEL Section 1 Introduction 1 1 Overview The AT91 In system Programmer ISP provides an open set of tools for programming the AT91SAM7 and AT91SAM9 ARM based microcontrollers They are based on a common dynamic linked library DLL the AT91Boot DLL It is used by SAM BA SAM PROG and all ISP tools AT91Boot_DLL API is in the public domain so that custom GUI ISP solutions can be built It avoids writing low level functions such as Flash memory writing algorithms etc AT91Boot_DLL is an OLE COM component distributed under a DLL AT91Boot_DLL dll allowing automation tools It is also possible to execute the AT91Boot_DLL functions in command lines in a TCL shell An intermediate DLL AT91Boot_TCL dll is used to transform TCL commands into calls to AT91Boot DLL Several communicati
18. RPOSE OR NON INFRINGEMENT IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT INDIRECT CONSEQUENTIAL PUNITIVE SPECIAL OR INCIDEN TAL DAMAGES INCLUDING WITHOUT LIMITATION DAMAGES FOR LOSS OF PROFITS BUSINESS INTERRUPTION OR LOSS OF INFORMATION ARISING OUT OF THE USE OR INABILITY TO USE THIS DOCUMENT EVEN IF ATMEL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES Atmel makes no representations or warranties with respect to the accuracy or completeness of the contents of this document and reserves the right to make changes to specifications and product descriptions at any time without notice Atmel does not make any commitment to update the information contained herein Unless specifically provided otherwise Atmel products are not suitable for and shall not be used in automotive applications Atmel s products are not intended authorized or warranted for use as components in applications intended to support or sustain life 2006 Atmel Corporation All rights reserved Atmel logo and combinations thereof Everywhere You Are and others are registered trade marks SAM BA and others are trademarks of Atmel Corporation or its subsidiaries ARM the ARM Powered logo and others are the regis tered trademarks or trademarks of ARM Ltd Windows and others are the registered trademarks or trademarks of Microsoft Corporation in the US and or other countries Other terms and product names may be trademarks of others Printed on recycled pap
19. T91Boot Write Int This function writes a 32 bit word into the volatile memory of the connected target 3 1 5 1 Description void AT91Boot_Write_Int int h handle int uValue int uAddress int err code Table 3 5 AT91Boot_Write_Int Type Name Details h handle Communication handle returned by AT91Boot Open function Input Parameters uValue 32 bit value to write uAddress Address where to write 32 bit value Output Parameters none e int 0x0000 AT91C_BOOT_DLL_OK Standard Error Codes e int 0xF001 Bad bh handle parameter 7 e int 0xF002 Address is not correctly aligned EIS en e int OxFO05 Communication link broken CAN Error Codes e int 0x8002 CAN Read dil function returned fail e int 0x8003 CAN Write dll function returned fail Return Code void 3 1 5 2 Code Example AT91Boot Write Int h handle OxCAFECAFE 0x200000 amp err code AT91 In system Programmer ISP User Guide AMEL 3 7 6224D ATARM 28 Jul 06 AT91Boot DLL Interface 3 1 6 AT91Boot Write Short This function writes a 16 bit word into the volatile memory of the connected target 3 1 6 1 Description void AT91Boot_Write_Short int h handle short wValue int uAddress int err_code Table 3 6 AT91Boot Write Short Type Name Details Communication handle returned by AT91Boot Open h handle function wValue 16 bit value to write Input Parameters uAddress Address where to write 16 bit value Output Parameters none
20. code The following script gives an example of how to program a binary file into a SAM7 564 internal Flash See Section 5 2 for details on how to run the script load file join Library AT91Boot TCL dll At91boot tel set DevList 0 set err code 0 SCAN connected devices set i 0 foreach name TCL Scan set DevList i name puts DevList i DevList i incr i 1 Open first one in the list set h handle 0 set i 0 set h handle TCL Open DevList i TRY FLASH application bin file into SAM7S64 internal flash variable fileName application bin variable fileAddr 0x0 global valueOfDataForSendFile Open and read binary file set f open fileName r fconfigure f translation binary set size file size fileName set valueOfDataForSendFile read Sf size close Sf AIMEL AT91 In system Programmer ISP User Guide AT91Boot TCL Interface Write file into Flash TCL_SAM7S64 Send Flash h_handle fileAddr valueOfDataForSendFile size err_code set valueOfDataForSendFile 0 Close connection TCL Close h handle AT91 In system Programmer ISP User Guide AIMEL 4 3 6224D ATARM 28 Jul 06 AT91Boot TCL Interface 4 4 AIMEL AT91 In system Programmer ISP User Guide 6224D ATARM 28 Jul 06 AMEL 5 1 5 1 1 Visual C 6 0 Projects Using AT91Boot_DLL with MFC Section 5 Using AT91Boot_DLL Project Examples The project OLE MFC dsw is located in Examples OLE_MFC
21. e 16 bit read value e int 0x0000 AT91C BOOT DLL OK Standard Error Codes e int OxF001 Bad h handle parameter x e int OxF002 Address is not correctly aligned Biror uode or onde e int 0xF005 Communication link broken CAN Error Codes e int 0x8002 CAN Read dl function returned fail e int 0x8003 CAN Write dll function returned fail Return Code void 3 1 10 2 Code Example short wRead AT91Boot Read Short bh handle amp wRead 0x200000 amp err code AT91 In system Programmer ISP User Guide AMEL 3 11 6224D ATARM 28 Jul 06 AT91Boot DLL Interface 3 1 11 3 1 11 1 Description AT91Boot Read Byte This function reads an 8 bit word from the connected target void AT91Boot_Read_Byte int h handle char bValue int uAddress int err code Table 3 11 AT91Boot Read Byte Type Name Details Communication handle returned by AT91Boot Open h handle function Input Parameters bValue Pointer to an 8 bit value uAddress Address where to read 16 bit value Output Parameters bValue 8 bit read value e int 0x0000 AT91C BOOT DLL OK Standard Error Codes e int 0xF001 Bad h handle parameter e int 0xF002 Address is not correctly aligned E I en e int OxFO05 Communication link broken CAN Error Codes e int 0x8002 CAN Read dll function returned fail e int 0x8003 CAN Write dll function returned fail Return C
22. enu regsvr32 s c YOUR_INSTALL_DIRECTORY AT9 1Boot_DLL dI1 Note regsvr32 exe is located in WINNT System32 directory In order to function correctly compatibility between JLink SAM ICE firmware USB driv JLink SAM ICE ers and JLinkARM DLL is necessary Thus it is recommended to update JLink SAM ICE Software software The JLink SAM ICE software update contained in a zip file is available on the www segger com web site in the Downloads then J Link ARM sub areas To pro ceed with update carry out the following steps E Download the Jlink_ARM zip file AT91 In system Programmer ISP User Guide AIMEL 1 3 6224D ATARM 28 Jul 06 Introduction E Unzip this download E Run the exe file contained in it m Check the update in the Doc ReleaseNotes E Run the new J Link exe to update the JLink SAM ICE firmware m Check if your PC driver is up to date with the delivery driver in the USBDriver folder contained in the exe E Copy the JLinkARM dll DLL to YOUR_INSTALL_DIRECTORY Library folder This completes the software update 1 4 AIMEL AT91 In system Programmer ISP User Guide 6224D ATARM 28 Jul 06 AMEL Section 2 Communicating with AT91SAM Devices 2 1 Communication AT91Boot_DLL connects AT91SAM based targets through a USB link a serial link or a Links JTAG using a SAM ICE or JLink JTAG box Figure 2 1 Different Ways of Communicating with AT91SAM based Targets AT91S
23. er 6224D ATARM 28 Jul 06
24. ode void 3 1 11 2 Code Example char bRead AT91Boot Read Byte h handle 3 1 12 3 1 12 1 Description err code amp bRead 0x200000 amp err code AT91Boot Read Data This function reads X bytes from the connected target void AT91Boot Read Data int h handle int uAddress char bValue int uSize int Table 3 12 AT91Boot Read Data Type Input Parameters Name Details Communication handle returned by AT91Boot Open h handle function uAddress Address where to read 8 bit data bValue Pointer to an 8 bit data buffer where to store read data uSize Number of bytes to read 3 12 6224D ATARM 28 Jul 06 AMEL AT91 In system Programmer ISP User Guide Table 3 12 AT91Boot Read Data Type Output Parameters Name bValue Details Pointer to read data AT91Boot DLL Interface Error Code err code Standard Error Codes CAN Error Codes int 0x0000 AT91C BOOT DLL OK int 0xF001 Bad h handle parameter int 0xF004 USART Communication link not opened int 0xF005 Communication link broken int 0x8002 CAN Read dll function returned fail int 0x8003 CAN Write dll function returned fail Return Code void 3 1 12 2 Code Example char bData 10 AT91Boot Read Data h handle AT91 In system Programmer ISP User Guide AMEL 0x200000 bData 10 amp err_code 3 13 6224D ATARM 28 Jul 06 AT91Boot
25. on links are available such as USB serial link CAN or JTAG AT91 In system Programmer ISP User Guide 1 1 6224D ATARM 28 Jul 06 Introduction Figure 1 1 AT91 ISP Framework Architecture Command Line Tool SAM PROG SAM BA GUI Customer ISP TCL SH AT91Boot_DLL dll AT91Boot_TCL dll CAN Dongle dll ATM6124 sys JLinkARM dll COM Port driver Peak IXXAT SAM ICE Driver or JLINK 1 2 DLL m Runs under Windows 2000 XP Prerequisites m A SAM ICE or a JLink JTAG box and its associated USB drivers only necessary to use JTAG communication link m CAN Dongles PCAN USB Peak dongle USB to CAN compact IXXAT dongle m TCL Toolchain including tclsh can be downloaded from the following URL http www activestate com Products ActiveTcl 1 2 AIMEL AT91 In system Programmer ISP User Guide 6224D ATARM 28 Jul 06 1 3 Installation 1 3 1 Contents 1 3 1 1 Library Directory 1 3 1 2 Examples Directory 1 3 1 3 SAM PROG Application 1 3 1 4 SAM BA Boot4CAN Directory 1 3 2 DLL Registration 1 3 3 Updating Introduction Installation is automatic using the AT91 ISP exe install program All files located in the Library directory are necessary for the AT91Boot DLL to run correctly m AT91Boot_DLL dll m AT91Boot DLL tlb type library file E JLinkARM dll m AT91Boot_TCL dll m CAN Dongle dlls This directory contains some example projects using AT91Boot_DLL dll See the sec tion
26. returned fail Return Code void 3 1 7 2 Code Example AT91Boot Write Byte h handle OxFE 0x200000 amp err code 3 1 8 AT91Boot Write Data This function writes X bytes into the volatile memory of the connected target 3 1 8 1 Description void AT91Boot Write Data int h handle int uAddress char bValue int uSize int err code Table 3 8 AT91Boot Write Data Type Name Details h handle Communication handle returned by AT91Boot Open function Input Parameters uAddress Address where to write 8 bit value bValue Pointer to 8 bit data buffer to write uSize Buffer size in bytes Output Parameters none e int 0x0000 AT91C_BOOT_DLL_OK Standard Error Codes e int OxF001 Bad h handle parameter x e int OxF004 USART Communication link not opened Eror Lode ar poda e int 0xF005 Communication link broken CAN Error Codes e int 0x8002 CAN Read dil function returned fail e int 0x8003 CAN Write dll function returned fail Return Code void 3 1 8 2 Code Example char Data 10 0x00 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 AT91Boot Write Data h handle AMEL AT91 In system Programmer ISP User Guide 0x200000 bData 10 amp err_code 3 9 6224D ATARM 28 Jul 06 AT91Boot DLL Interface 3 1 9 3 1 9 1 3 1 9 2 3 1 10 AT91Boot Read Int Description Code Example This function reads a 32 bit word from the connected target
27. returns a list of connected devices Detec tion is performed in the following order 1 USB connected devices using ATM6124 sys driver 2 Connected SAM ICE or JLink devices 3 CAN dongles Peak IXXAT 4 All available serial COM ports Note The AT91Boot Scan function does not verify if an Atmel device is really present so even if there are no Atmel devices connected to SAM ICE JLink devices CAN dongles or COM ports these connections are returned in the con nected devices list This does not concern USB devices void AT91Boot Scan char pDevList Table 3 1 AT91Boot Scan Type Name Details Pointer to a char table Input Parameters char pDevList All table entries must have been allocated prior using the AT91Boot Scan function Strings returned in the table usb ARMX for USB connected devices jlink ARMX for SAM ICE JLink connected devices can AtCanPeak ARM for PCAN USB Peak connected dongle can ixxat ARM for USB to CAN compact IXXAT connected dongle COMX for available COM ports Output Parameters char pDevList Return Code none Note 1 Each string must be allocated from the application and must have a size superior to 80 bytes That string is used to recover in particular CAN dongle USB or JTAG box device name which is then replaced by a reduced symbolic name AT91 In system Programmer ISP User Guide 3 1 6224D ATARM 28 Jul 06 AT91Boot DLL Interface
28. roject Examples 5 1 1 1 Code Example 5 1 2 Using AT91Boot_DLL without MFC 5 1 2 1 Code Example 5 2 Running the TCL Script Example 5 2 6224D ATARM 28 Jul 06 include at9ilboot dll h IAT91BootDLL m_pAT91BootDLL AfxOlelnit m_pAT91BootDLL new IAT91BootDLL m pAT91BootDLL gt CreateDispatch T AT91Boot DLL AT91BOOtDLL 1 This paragraph explains the project OpenRDI OLE dsw located in AT91Boot DLL Example OLE without MFC folder To use AT91Boot_DLL in such a project the following steps must be performed E Initialize COM library by calling CoInitialize NULL Use CoUninitialize to close COM Library at the end of the project E Import AT91Boot DLL COM object from AT91Boot DLL tlb Type Library file Eventually rename namespace if necessary E Add using namespace directive to share the same namespace as AT91Boot DLL library E Create a pointer to AT91Boot DLL COM object In stdafx h header file Himport YOUR INSTALL DIRECTORY AT91Boot DLL tlb rename namespace AT91BOOTDLL Lib In OpenRDI_OLE cpp source file using namespace AT91BOOTDLL Lib CoInitialize NULL COM Object Creation IAT91BootDLLPtr pAT91BOotDLL uuidof AT91BootDLL To run this example TCL Toolchain including tclsh must be downloaded from the URL http www activestate com Products ActiveTcl A TCL script example test tcl is given in the Examples CAN_TCLSH directory It also gives an example on how to use AT91
29. s e int OxF001 Bad h handle parameter e int OxF002 Address is not correctly aligned e int OxF003 uSize is not correct Error Gode pm 0008 e int 0xF004 USART Communication link not opened e int 0xF005 Communication link broken CAN Error Codes e int 0x8002 CAN Read dl function returned fail e int 0x8003 CAN Write dll function returned fail Return Code void char bData 10 0x00 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 Write buffer at offset 0x100 into internal SAM7S64 Flash AT91Boot_SAM7S64_Send_Flash h_handle 0x100 bData 10 amp err_code AIMEL AT91 In system Programmer ISP User Guide AMEL 4 1 Loading AT91Boot_TCL Section 4 AT91Boot TCL Interface Only the prototypes are defined in this chapter A TCL script example called test tcl is given in the Example CAN TCLSH directory AT91Boot_TCL dll must be loaded in order to access its functions The command is Functions load file join AT91Boot TCL dll At91boot tel Note The command is case sensitive 4 2 Low level These functions are available for all AT91SAM microcontrollers Functions E list TCL Scan E set h handle TCL Open name m TCL Close h handle m TCL Write Int h handle uValue wAddress et code m TCL Write Short h handle wValue wAddress et code m TCL Write Byte h handle bValue wAddress err code m TCL Write Data h handle wAddress bValue size err
30. sly opened on an AT91SAM device 3 1 3 1 Description void AT91Boot_Close int h handle Table 3 3 AT91Boot Close Type Name Details Communication handle returned by AT91Boot Open Input Parameters h handle function Output Parameters none Return Code void 3 1 3 2 Code Example AT91 In system Programmer ISP User Guide AT91Boot_Close h_handle AMEL 3 3 6224D ATARM 28 Jul 06 AT91Boot DLL Interface 3 1 4 AT91Boot CAN Configure 3 1 4 1 Prerequisite 3 4 6224D ATARM 28 Jul 06 This function configures the target as well as AT91Boot_DLL initialization It allows E Configuring CAN network baudrate Set Baudrate action It is always the first action to perform after calling AT91Boot Open function It opens CAN dongles dlls with correct baudrate parameter Only baudrate value passed in uValue parameter is necessary for such an action uParam parameter can be null m Connecting Disconnecting Target It is necessary to connect to the target after a Set Baudrate action and before trying to communicate Both uParam and uValue parameters can be null m Reading writing CAN configuration bytes on the target See the document AT91SAM CAN Bootloader Lit No 6220 for more information Note See Examples CAN TCLSH test tcl script for more information on how to use this function As these parameters are stored into internal Flash memory the Embedded Flash Con troller Flash Mode Register

Download Pdf Manuals

image

Related Search

Related Contents

IGS Letreros con Lámparas Fluorescentes  Installing Ocularis Base  Notice de montage (version pdf > 500 Ko)  製品マニュアル - アンブレラカンパニー  SHAKE-33 - Sony Europe  8507 BioFer F  

Copyright © All rights reserved.
Failed to retrieve file