AT89C5131A-L Atmel Corporation, AT89C5131A-L Datasheet

no-image

AT89C5131A-L

Manufacturer Part Number
AT89C5131A-L
Description
Manufacturer
Atmel Corporation
Datasheets

Specifications of AT89C5131A-L

Flash (kbytes)
32 Kbytes
Max. Operating Frequency
48 MHz
Cpu
8051-12C
Max I/o Pins
34
Usb Transceiver
1
Usb Speed
Full Speed
Usb Interface
Device
Spi
1
Twi (i2c)
1
Uart
1
Sram (kbytes)
1.25
Eeprom (bytes)
1024
Self Program Memory
API
Operating Voltage (vcc)
3.0 to 3.6
Timers
4
Isp
UART/USB
Watchdog
Yes
Features
Description
This document describes the USB bootloader functionalities as well as the USB proto-
col to efficiently perform operations on the on-chip Flash (EEPROM) memories.
Additional information on the AT89C5131A product can be found in the AT89C5131A
datasheet and the AT89C5131A errata sheet available on the Atmel web site.
The bootloader software package (binary) currently used for production is available
from the Atmel web site.
Bootloader Revision
Revision 1.0.2
Revision 1.2.0
Protocol
In-System Programming
In-Application Programming/Self Programming (IAP)
– USB Used as Physical Layer
– Device Firmware Upgrade Class Compliant
– USB Clock Auto-Configuration
– Read/Write Flash and EEPROM Memories
– Read Device ID
– Full-chip Erase
– Read/Write Configuration Bytes
– Security Setting from ISP Command
– Remote Application Start Command
– Read/Write Flash and EEPROM Memories
– Read Device ID
– Block Erase
– Read/Write Configuration Bytes
– Bootloader Start
Purpose of Modifications
First release
Bootloader improvement
Date
25/03/2003
20/03/2007
USB
Microcontrollers
AT89C5131A
USB Bootloader
4287E–USB–04/08

Related parts for AT89C5131A-L

AT89C5131A-L Summary of contents

Page 1

... This document describes the USB bootloader functionalities as well as the USB proto- col to efficiently perform operations on the on-chip Flash (EEPROM) memories. Additional information on the AT89C5131A product can be found in the AT89C5131A datasheet and the AT89C5131A errata sheet available on the Atmel web site. The bootloader software package (binary) currently used for production is available from the Atmel web site ...

Page 2

... Functional The AT89C5131A bootloader facilitates In-System Programming and In-Application Programming. Description In-System In-System Programming allows the user to program or reprogram a microcontroller on-chip Flash memory without removing it from the system and without the need of a pre-programmed Programming application. Capability (IAP) The USB bootloader can manage a communication with a host through the USB bus. It can also access and perform requested operations on the on-chip Flash memory ...

Page 3

... SSB EB P1_CF P3_CF P4_CF Manufacturer Id1: Family code Id2: Product Name Id3: Product Revision 4287E–USB–04/08 AT89C5131A USB Bootloader Description Boot Status Byte Software Boot Vector Software Security Byte Extra Byte Port 1 Configuration Port 3 Configuration Port 4 Configuration Default Value FFh ...

Page 4

... Only a full chip erase command can reset the software security bits. Flash/EEPROM Fuse bit BSB & SBV & EB Any access allowed SSB Manufacturer info Read only access allowed Bootloader info Erase block Full chip erase Blank Check AT89C5131A USB Bootloader 4 Mnemonic Default Value 7 X2B U 6 BLJB P ...

Page 5

... The default factory Hardware Condition is assigned to port P1. • P1 must be equal to FEh In order to offer the best flexibility, the user can define its own Hardware Condition on one of the following Ports: • Port1 4287E–USB–04/08 AT89C5131A USB Bootloader VCC VCC VCC EA ALE RST XTAL2 ...

Page 6

... There is a priority between P1_CF, P3_CF and P4_CF (see Figure 4 on page 9). Note: AT89C5131A USB Bootloader 6 The BLJB must (programmed able to restart the bootloader. If the BLJB is equal to 1 (unprogrammed) only the hardware parallel programmer can change this bit (see AT89C5131A datasheet for more details). 4287E–USB–04/08 ...

Page 7

... ISP mode and which supports all Atmel C51 Flash microcontroller and USB protocol Program communication media. The FLIP software program is free and is available from the Atmel web site. 4287E–USB–04/08 AT89C5131A USB Bootloader User Bootloader [SBV]00h FM0 USB Bootloader ...

Page 8

... Figure 3. High-pin Count Regular Boot Process lica tio n AT89C5131A USB Bootloader ardw are C ondition 0000h 00h < tlo ...

Page 9

... Figure 4. Low-pin Count Regular Boot Process Yes Start Application 4287E–USB–04/08 AT89C5131A USB Bootloader RESET ENBOOT = 0 Yes PC = 0000h BLJB = 1 No P1_CF = FFh No P1_CF = P1 Yes No P3_CF = P3 BSB = SBV < 7Fh Yes Start User Bootloader Bit ENBOOT in AUXR1 Register is Initialized with BLJB Inverted ...

Page 10

... The bootloader includes a function which will automatically setup the PLL frequency (48MHz) Auto-Configuration versus the different XTAL configuration used on the application. The table below shows the allowed frequencies compatible with the USB bootloader 48 MHz auto-generation Clock Modes AT89C5131A USB Bootloader 10 Downstream Transfer: OUT Upstream Transfer Driver PC Application PC (Host) 6 MHz ...

Page 11

... Figure 6. 48 MHz Frequency Auto-Configuration 4287E–USB–04/08 AT89C5131A USB Bootloader No No Resume Detected? Yes Yes USB Scheduler MAIN USB Connected? Suspend/Resume Yes Configure PLL for Frequency X Configure Timer 0 SOF Detected Timer 0 Overflow? Yes Change Frequency 11 ...

Page 12

... Interface (4) wBlock Interface (4) Zero Interface (4) Zero Interface (4) Zero Interface (4) Zero Interface (4) Parameter Vendor ID Product ID Release Number wLength Data Zero none Length Firmware Length Firmware 6 Status Zero none 1 State Zero none Atmel – AT89C5131A Bootloader 0x03EB 0x2FFD 0x0000 4287E–USB–04/08 ...

Page 13

... However, their use is intentionally not restricted because the authors anticipate that implementers will devise additional creative uses for alternate settings. 4287E–USB–04/08 AT89C5131A USB Bootloader Size Value Description ...

Page 14

... Read the Flash or EEPROM Data • Program Configuration Information • Read Configuration and Manufacturer Information • Erase the Flash • Start the application Overview of the protocol is detailed in Appendix-A. AT89C5131A USB Bootloader 14 Size Value 1 07h Size of this descriptor, in bytes 1 21h DFU FUNCTIONAL descriptor type DFU Attributes: bit 7 ...

Page 15

... AT89C5131A USB Bootloader wValue Zero Zero Offset Field 0 bStatus 1 bwPollTimeOut 4 bState 5 iString Description No error condition is present File is not targeted for use by this device ...

Page 16

... DFU_CLRSTATUS request. Upon receipt of DFU_CLRSTATUS, the device sets a status of OK and transitions to the dfuIDLE state. Only then is it able to transition to other states. AT89C5131A USB Bootloader 16 Description Device detected unexpected USB reset signaling ...

Page 17

... The X number is calculated to align the beginning of the firmware with the flash page start_address [32]. For example, if the start address is 00AFh (175d 175 [32] = 15. • The firmware • The DFU Suffix on 16 Bytes. Table 9. DFU File Suffix 4287E–USB–04/08 AT89C5131A USB Bootloader bmRequestType bRequest 1010 0001b DFU_GETSTATE (5) bmRequestType bRequest 1010 0001b DFU_ABORT (6) ...

Page 18

... Flash page start_address [32]. For example, if the start address is 00AFh (175d 175 [32] = 15. DFU Suffix The DFU suffix of 16 bytes are added just after the last byte to program. This suffix is reserved for future use. AT89C5131A USB Bootloader 18 Offset Field Size ...

Page 19

... After each program request, the Host can request the device state and status by sending a Bootloader DFU_GETSTATUS message. If the device status indicates an error, the host can send a DFU_CLRSTATUS request to the device. 4287E–USB–04/08 AT89C5131A USB Bootloader DFU_DNLOAD Prog_Start + (EP0 fifo length - 6) x 00h X offset bytes + Firmware Packet 1 Firmware Packet 2 Firmware Packet n + DFU suffix ...

Page 20

... Second Request from The Host sends a DFU Upload request. Host Answers from the The device send to the Host the firmware from the specified start address to the end address. Device SETUP OUT AT89C5131A USB Bootloader 20 SETUP OUT IN Command Identifier data[0] data[1] 00h Id_display_data ...

Page 21

... If the chip is protected from program access, a “err_WRITE” status is returned to the Host. • Otherwise, the device status is “OK“. 4287E–USB–04/08 AT89C5131A USB Bootloader BSB SBV P1_CF, P3_CF and P4_CF Fuse bits (BLJB, X2 and OSCON bits) (see section “Mapping and Default Value of Hardware Security Byte” ...

Page 22

... The flow described below allows the user to read the configuration or manufacturer information. Information or Manufacturer Information Requests From Host To start the programming operation, the Host sends DFU_DNLOAD request with the Read com- mand in the data field (2 bytes). AT89C5131A USB Bootloader 22 SETUP OUT IN Command Identifier ...

Page 23

... BSB = FFh • SBV = FFh • SSB = FFh (NO_SECURITY) The Block erase command erases only a part of the Flash. Three Blocks are defined in the AT89C5131A: • block0 (From 0000h to 1FFFh) • block1 (From 2000h to 3FFFh) • block2 (From 4000h to 7FFFh) Request from Host To start the erasing operation, the Host sends a DFU_DNLOAD request with a Write Command in the data field (2 bytes) ...

Page 24

... This request is immediately followed by a second DFU_DNLOAD request with no data field to start the application with one of the 2 options. Request From Host Answer from Bootloader No answer is returned by the device. AT89C5131A USB Bootloader 24 SETUP IN OUT SETUP ...

Page 25

... Interrupts must also be disabled before accessing EEPROM data then re-enabled after. The user must take care of hardware watchdog before launching a Flash operation. For more information regarding the Flash writing time see the AT89C5131A datasheet. 4287E–USB–04/08 AT89C5131A USB Bootloader ® ...

Page 26

... EEPROM Data bootloader resources. Memory To read the Flash memory the bootloader is not involved. For more details on these routines see the AT89C5131A datasheet sections “Program/Code Memory” and “EEPROM Data Memory” Two routines are available to program the Flash: – – ...

Page 27

... Instruction: LCALL FFC0h. • At the complete API execution by the bootloader, the value to read is in the api_value variable. Note: 4287E–USB–04/08 AT89C5131A USB Bootloader api_command 08h 05h 05h 05h 05h 05h 05h 05h 05h 05h ...

Page 28

... No special resources are used by the bootloader during these operations. api_command 00h 00h 00h 1. See the AT89C5131A datasheet for the time that a write operation takes and this time must multiply by the number of pages special resources are used by the bootloader during these operations. api_dph api_dpl api_value (HSB & ...

Page 29

... This routine allows to start at the beginning of the bootloader as after a reset. After calling this Bootloader routine the regular boot process is performed and the communication must be opened before any action. • No special parameter setting • Set bit ENBOOT in AUXR1 register • instruction: LJUMP or LCALL at address F400h 4287E–USB–04/08 AT89C5131A USB Bootloader 29 ...

Page 30

... Table 10. Summary of Frames from Host Command Identifier data[0] 00h Id_prog_start 01h 01h 00h Id_display_data 01h 03h 02h 00h Id_write_command 04h 01h 02h 03h AT89C5131A USB Bootloader 30 data[1] data[2] data[3] start_address end_address start_address end_address 00h 20h 40h FFh 00h 01h 02h 03h Value ...

Page 31

... Table 10. Summary of Frames from Host (Continued) Command Identifier data[0] 00h Id_read_command 05h 01h 02h Table 11. DFU Class-specific Requests Table 12. USB Parameters Table 13. Hardware Security Byte (HSB) 4287E–USB–04/08 AT89C5131A USB Bootloader data[1] data[2] data[3] 00h 01h 02h 00h 01h 02h 03h 04h ...

Page 32

... AT89C5131A USB Bootloader 32 Bootloader Execution api_command no yes 0Dh yes 0Dh yes 00h yes 00h yes 00h yes 08h yes 07h yes ...

Page 33

... Table 14. API Summary (Continued) Function Name __api_wr_code_page __api_rd_device_id2 __api_rd_device_id3 __api_rd_bootloader_version __api_eeprom_busy __api_rd_eeprom_byte __api_wr_eeprom_byte __api_start_bootloader __api_start_isp 4287E–USB–04/08 AT89C5131A USB Bootloader Bootloader Execution api_command yes 01h yes 05h yes 05h yes 0Eh api_dph api_dpl api_value 60h return value 61h ...

Page 34

... 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. © 2008 Atmel Corporation. All rights reserved. Atmel Atmel Corporation or its subsidiaries. Other terms and product names may be trademarks of others. International Atmel Asia ...

Related keywords