Design Guide for Atmel’s C51 Standard Devices C51 MCU’s Introduction The aim of this document is to help customers to avoid errors that are frequently done in order save efforts and time during hardware debugging sessions. This document relates only to Atmel’s C51 standard devices. It is the responsability of the user to read the datasheet of his own device and check if the features and procedures described here are applicable.
1. Basics of ATMEL’s C51 Standard devices 1.1 Program memory configurations 1.1.1 Scope Figure 1-1. Code fetched from external program memory External program memory Standard C51 A15:8 P2 EA A15:8 ALE GND AD7:0 Latch A7:0 P0 A7:0 D7:0 /PSEN Figure 1-2. OE Code fetched from internal program memory VCC Standard C51 EA VCC VCC P2 ALE 10K P0 /PSEN Table 1-1.
1.1.2 Type of package In most of the products, two kind of packages are proposed: the HPC (High Pin Count) and the LPC (Low Pin Count). The HPC packages support the external code and therefore provide the appropriate pins (EA, ALE, PSEN, P0, P2), while the LPC packages do not support the external code and do not provide any of the dedicated pins. 1.1.3 Hardware Security Byte (HSB) WARNING Parts are delivered by default with HSB set to maximum security (see product datasheet for further information).
Figure 1-3. Reset bock diagram Microcontroller Vcc POR PFD C51 Core Watch Dog Timer Internal Reset RST Table 1-2. Features descriptions Feature Description Impact on RST pin PFD The role of the PFD is to monitor the power supply drops during a steady state condition in order to suspend the microcontroller’s activity. When the PFD is active, it holds the MCU under a reset state to prevent the MCU from having unpredictable behaviour. While the PFD is active, the reset pin is driven by the PFD.
Figure 1-4.
1.2.2 1.2.2.1 How to drive the RST pin according to the features implemented on the device This procedure is only applicable to Active High reset pins. However, this procedure can be easily adapted for microcontrollers with Active Low Reset pins. POR not implemented When the POR is not implemented, it is necessary to implement external components to assure a correct reset of the MCU.
b) Using an external Brown-out device Read application note “External Brown-out Protection for C51 microcontrollers with Active High Reset Input“ (doc 4183). Sometimes the RST pin may be internally forced by the WDT so that the external peripherals if any are reset at the same time as the MCU. While the WDT is active the RST pin operates as an output. Therefore the RST pin cannot be externally forced to a permanent level.
1.2.2.2 POR implemented When the POR is implemented, the use of external components is optional. The RST pin may be left unconnected.
c) Using an external Brown-out device Read application note “External Brown-out Protection for C51 microcontrollers with Active High Reset Input“ (doc 4183). Sometimes the RST pin may be internally forced by the POR or the PFD or the WDTso that the external peripherals if any are reset at the same time as the MCU. While the POR or the PFD or the WDT are active the RST pin operates as an output. Therefore the RST pin cannot be externally forced to a permanent level.
1.3 Oscillator circuit The on-chip oscillator is composed of a single-stage inverter and a parallel feedback resistor. The XTAL1 and XTAL2 pins are respectively the input and the output of the inverter, which can be configured with off-chip components as a Pierce oscillator. Figure 1-5.
1.3.1 Test conditions It is recommended to monitor the clock on XTAL2 pin. Special care must be taken when measuring XTAL1 signal. A high impedance probe must be used to avoid any distorsion of the signal. Microcontroller XTAL1 XTAL2 High impedance probe Test condition: probe’s impedance > 1 MOhm This means that oscilloscope’s active probes are prohibited due to their weak impedance (usually around 100KOhm) 1.3.
1.3.3 Overtone crystals Problem: Sometimes overtone crystals are used with a standard oscillator circuit where a specific one is required to make the crystal to oscillate on its third overtone. Consequence: an overtone crystal used with a standard oscillator circuit, oscillates on its fundamental frequency instead of oscillating on its third overtone frequency. The clock frequency seen by the MCU is 1/3 of the expected frequency. Action: check the type of the crystal you are using.
1.4 Microcontroller status During hardware or firmware debugging, it is sometimes interesting to know what the state of the microcontroller is. See table below for details.
2. In-System Programming (ISP) The In-System Programming feature will be referenced as ISP in the rest of the document. Most of Atmel’s C51 devices support the ISP mode. This feature enables the user to program the device directly on his application without having to unsolder the device or using an external programmer. This feature is made by means of a bootloader firmware embedded in the device itself.
Figure 2-1. HPC hardware condition VCC VCC VCC Standard C51 VCC EA ALE Unconnected PC running FLIP RST C2 GND XTAL2 UART / USB / CAN interfaces Bootloader Crystal XTAL1 /PSEN 1K VSS GND 2.2 GND C1 GND LPC package 2.2.1 Hardware settings There are no specific hardware settings to apply. 2.2.2 Starting the ISP mode Software condition: WARNING For LPC packages the BLJB bit is activated at manufacturing level and MUST NEVER be changed by the user.
Figure 1.
Figure 2-2. LPC hardware condition VCC VCC Standard C51 VCC PC running FLIP RST C2 GND XTAL2 Bootloader UART / USB / CAN interfaces Crystal XTAL1 GND C1 P1.0 VSS GND 2.3 2.3.1 GND Using the ISP mode over RS232 interface Baudrate The maximum baudrate supported by the device depends on the crystal value or signal frequency injected on XTAL1 pin. Refer to product datasheet for further information. 2.3.2 Hardware The schematics of the interface are given here after.
7764A–8051–11/07 1 6 2 7 3 8 4 9 5 DSR Rx_PC RTS Tx_PC CTS DTR SUB-D9 FEMALE RS232 P1 1 J13 2 1 1 DTR J12 RTS J11 2 2 AUTO ISP FEATURE C23 100n C21 100n C18 100n C16 100n RS232 INTERFACE 1 3 4 5 13 8 14 7 1 3 4 5 13 8 14 7 Vcc C1+ C1C2+ C2- R1IN R2IN T1IN T2IN 6 2 6 2 12 9 11 10 SIPEX-SP3232ECA U8 V- V+ R1OUT R2OUT T1IN T2IN C17 100n Vcc C24 100n Vcc C22 100n C19 100n Vcc C20 100n Vcc C25 100n 2 C26 100n 5 Rx_MCU 12 9 Vcc Tx_MCU 11 10 SIPEX-SP323
3. Troubleshooting 3.1 MCU not starting or operating in a reliable way Possible root cause I/O External Code Internal Code - Must be stables POWERS and GND delivered to the device Input XTA2 pin Output - Monitor XTAL2 to see if the oscillator has started and is working properly. Check if your crystal is not an overtone part.
3.2 In-System Programming does not work Possible root cause External Code Apply the hardware condition. See “In-System Programming (ISP)” on page 14. and read the device’s bootloader datasheet. MCU is not working in ISP mode MCU does not work properly Device is damaged Internal Code NOT APPLICABLE Monitor power supplies, XTAL2, RST, EA, ALE, PSEN ( See “MCU not starting or operating in a reliable way” on page 19.
Atmel Corporation 2325 Orchard Parkway San Jose, CA 95131, USA Tel: 1(408) 441-0311 Fax: 1(408) 487-2600 Regional Headquarters Europe Atmel Sarl Route des Arsenaux 41 Case Postale 80 CH-1705 Fribourg Switzerland Tel: (41) 26-426-5555 Fax: (41) 26-426-5500 Asia Room 1219 Chinachem Golden Plaza 77 Mody Road Tsimshatsui East Kowloon Hong Kong Tel: (852) 2721-9778 Fax: (852) 2722-1369 Japan 9F, Tonetsu Shinkawa Bldg.