AT89STK 06 Software Demonstration CAN

Download as pdf or txt
Download as pdf or txt
You are on page 1of 18

AT89STK-06 CAN Starter Kit

.............................................................................................

Software Demonstration Guide


Section 1
Introduction ........................................................................................... 1-1
1.1 Abbreviations ............................................................................................1-1

Section 2
Getting Started...................................................................................... 2-3
2.1 Hardware Requirements ...........................................................................2-3
2.2 Software Requirements.............................................................................2-3
2.3 FLIP Software ...........................................................................................2-3

Section 3
Software Demonstrations ..................................................................... 3-5
3.1 UART Bootloader Demonstration Setup ...................................................3-5
3.2 Using FLIP ................................................................................................3-6
3.3 CAN Bootloader Demonstration Setup ...................................................3-11
3.4 CAN Bootloader Demonstration Program ...............................................3-13
3.5 ADC Demonstration ................................................................................3-15

Section 4
Conclusion .......................................................................................... 4-17
4.1 Conclusion ..............................................................................................4-17

AT89STK-06 Software Software Demonstration Guide 1


4356A–CAN–09/04
Section 1
Introduction

The purpose of this section is to acquaint the user with the Atmel CAN Demo Board, the
In-System Programming tool (FLIP), the 2 demonstration programs: CAN Generator
and CAN Monitor, and finally with the 2 bootloaders (CAN and UART).

1.1 Abbreviations FLIP: Flexible In-System Programmer


ISP: In-System Programming

AT89STK-06 Software Demonstration Guide 1-1


Rev. 4356A–CAN–09/04
Section 2
Getting Started

The purpose of this section is to acquaint the user with the Atmel CAN Demo Board, the
In-System Programming tool (FLIP), the 2 demonstration programs: CAN Generator
and CAN Monitor, and finally with the 2 bootloaders (CAN and UART).

2.1 Hardware CAN Demo board plus either a Second AT89STK-06 (1) and/or a CAN Dongle(1)
Requirements (IXXAT, PCAN, CANCARDX, CANPARI, or RMCANVIEW)
RS-232 Serial Cable (DB9/DB9 Male/Female)
Serial Cable DB9/DB9 Female/Female(1)
AT89C51CC03U-SLIM or AT89C51CC03U-SLSIM
AT89C51CC03C-S3SIM
Note: 1. Not included in CAN Demo Board kit.

2.2 Software Several demonstration programs can be found in the accompanying CD-ROM
Requirements CAN generator UART bootloader demonstration program (HEX file)
CAN monitor UART bootloader demonstration program (HEX file)
CAN generator CAN bootloader demonstration program (HEX file)
CAN monitor CAN bootloader demonstration program (HEX file)
CAN Dongle program (HEX file)
A self training package is also available on the CAN CD-ROM. It introduces CAN bit
timing as welll as the CAN Software Library.

2.3 FLIP Software FLIP software runs on Windows 98®, ME®, XP ®, Windows NT® and Windows 2000 ®.
FLIP supports In-system programming of Flash C51 devices through RS-232 and CAN
(with a dongle). The latest version of FLIP software can be found on the Atmel web site.
The CAN CD-ROM includes a copy of FLIP 2.2.4. The following figures were assembled
with Flip 2.2.4.
A Linux version of FLIP is also available.

AT89STK-06 Software Demonstration Guide 2-3


Rev. 4356A–CAN–09/04
Section 3
Software Demonstrations

3.1 UART The first demonstration (UART Bootloader) will use a PC running FLIP software to pro-
Bootloader gram a CAN Demo board through an RS-232 cable as illustrated in Figure 3-1.
Demonstration
Setup

Figure 3-1. PC to CAN Demoboard Through RS-232

RS-232 6~15V DC
Serial Cable Power Supply

PC running FLIP

3.1.1 Hardware 1. Connect a 9 volts DC power supply.


Connection 2. Connect the AT89STK-06 to the PC through the RS-232 cable.
3. Ensure a AT89C51CC03U-SLSIM is connected to the AT89STK-06.

AT89STK-06 Software Demonstration Guide 3-5


Rev. 4356A–CAN–09/04
Software Demonstrations

3.1.2 Setting the CAN microcontrollers come pre-programmed to start in Bootloader mode at first power-
Hardware Condition up. In the first ISP demonstration, the user will need to program the sample microcon-
troller set to boot in bootloader mode.
To enter in ISP mode with hardware conditions, press both the RESET (SW5) and ISP
(SW4) buttons simultaneously. First release the RESET button and then the ISP button.

3.2 Using FLIP In this section the user will program the AT89C51CC03UA-SLSIM microcontroller
through the UART Bootloader using FLIP software. The following procedure will guide
you through the programming of the demonstration program.
1. Run FLIP software.

Figure 3-2. Flip default window

3-6 AT89STK-06 Software Demonstration Guide


4356A–CAN–09/04
Software Demonstrations

2. From the Device Menu, choose Select and select the device (AT89C51CC03)
that is connected on the AT89STK-06.

Figure 3-3. FLIP Window With Device Selected

3. From the “Settings” menu, select “Communication” and “RS232”. The following
pop-up window appears and allows to select the COM port settings and Baud
Rate.

Figure 3-4. COM Port Settings

4. Initialize the communication by selecting the ‘Connect’ button in the RS-232 pop-
up window.
If the connection is successful, the FLIP window should look like Figure 3-5.
Detailed explanations of the significance of the fields can be found in the product
datasheet on the Atmel site www.atmel.com

AT89STK-06 Software Demonstration Guide 3-7


4356A–CAN–09/04
Software Demonstrations

Note: On certain laptops, it is necessary to perform the following procedure. Click


‘Connect’, reset the AT89STK-06, then click ‘Sync’ (For detail information, see
FLIP user’s manual).

Figure 3-5. Succesful Connection on FLIP

5. In the File menu, select ‘Load HEX’ and choose the demonstration program
‘can_gen.hex’. This is the program that performs the demonstration data
exchange.
The message ‘HEX file can_gen.hex loading done’ is displayed at the bottom of
the FLIP window.
6. Ensure the following check boxes are selected in the Operations Flow section of
FLIP:
- Erase
- Blank Check
- Program
- Verify
These are the operations that will be performed on the microcontroller.
7. Press the ‘Run’ button. Programming is executed.
The “Memory Verify Pass” message confirms programming is successful and
that the microcontroller has been programmed.
8. Unchecked the BLJB box in order to execute the demonstration program after
the next reset.
9. Ensure the ‘Reset’ box is checked, then press the ‘Start Application’ button.
It is possible to connect a CAN monitoring device such as a CANALYZER or equivalent
on the CAN DB9 connector to verify that the messages are transmitted on the CAN Bus.

3-8 AT89STK-06 Software Demonstration Guide


4356A–CAN–09/04
Software Demonstrations

To view the CAN messages transmission, the AT89STK-06 can also be connected to a
standard RS232 terminal (like Hyperterminal).
The Hyperterminal should be configured as presented in the following figure.

Figure 3-6. RS232 Configuration

AT89STK-06 Software Demonstration Guide 3-9


4356A–CAN–09/04
Software Demonstrations

The following messages will appear on the RS232 terminal

Figure 3-7. CAN Generator RS232 output

3-10 AT89STK-06 Software Demonstration Guide


4356A–CAN–09/04
Software Demonstrations

3.2.1 CAN Monitor Using a method similar to that discussed in the demonstration program above, it is pos-
Demonstration sible to program the Monitor Demonstration ‘can_mon.hex’. The Monitor Demonstration
Program displays the content of any incoming messages on a RS232 Terminal (9600 bauds).
For users with two CAN Demo boards, it is possible to program the CAN generator dem-
o nstra tion ‘ca n_ge n.hex’ o n one b oard a nd the CAN Monitor demon stratio n
‘mon_boot_can.hex’ on the other. The connection is made using a CAN DB9/DB9
Male/Male cable.

Figure 3-8. CAN Monitor RS232 Output

3.3 CAN Bootloader In this section, 2 demonstration programs will be explained.


Demonstration First we will program the Atmel Dongle via the UART. Second we will run the demon-
Setup stration program from the AT89C51CC03CA-SLSIM microcontroller through a CAN bus
to a second demoboard that will display the results on the UART.
If you use a CAN Dongle other than Atmel CAN go directly to Section 3.4 “CAN Boot-
loader Demonstration Program”.

AT89STK-06 Software Demonstration Guide 3-11


4356A–CAN–09/04
Software Demonstrations

Figure 3-9. CAN Dongle for CAN Demo

RS-232
Serial Cable

6~15V DC
PC running FLIP Power Supply
CAN BUS

6~15V DC
Power Supply

ATMEL Dongle AT89C51CC03 with CAN Bootloader

3.3.1 Hardware 1. Connect a C51 Demo board and a CAN Demo board.
Connections 2. Connect a 9 volts DC power supply.
3. Ensure a AT89C51CC03CA-SLSIM microcontroller is connected to the CAN
board.
4. Connect the RS-232 cable to your PC and to the DB9 female port on the C51
demo board.
5. Connect the CAN bus to the Atmel Dongle on both CAN boards. See Figure 3-9.

3-12 AT89STK-06 Software Demonstration Guide


4356A–CAN–09/04
Software Demonstrations

3.3.2 Programming Using This section allows you to program the AT89C51CC03 microcontroller using FLIP
FLIP software.
1. Run FLIP.
2. From the Device Menu, choose ‘Select’ and select the device (AT89C51CC03)
that is connected on your demo board.
3. From the ‘Settings’ menu, select ‘Communications’ then ‘RS-232’. Click
‘Connect’.
4. In the File menu, select ‘Load HEX’ and choose the demonstration program
‘Atmel_dongle.hex’.
The message ‘HEX file Atmel_dongle.hex loading done’ is displayed at the bot-
tom of the FLIP window.
5. Ensure the following check boxes are selected in the Operations Flow section of
FLIP:
- Erase
- Blank Check
- Program
- Verify
These are the operations that will be performed on the microcontroller.
6. Ensure the BLJB box is unchecked, in order to boot the demonstration program
after the next reset.
7. Ensure the ‘Reset’ box is checked, then press the ‘Start Application’ button.
The UART displays the CAN messages that the program generates.

3.4 CAN Bootloader The following procedure will guide you through the execution of the demonstration
Demonstration program.
Program 1. From the FLIP window, click ‘Device’ and select ‘AT89C51CC03’.
2. From the ‘Settings’ menu select ‘Communication’ –> ‘CAN’ and choose the type
of Dongle you are using. (See FLIP user’s manual)

AT89STK-06 Software Demonstration Guide 3-13


4356A–CAN–09/04
Software Demonstrations

Figure 3-10. Dongle Configuration

3. Click ‘Init’, then select ‘Node Connect’.


The dongle sends a node connect message with the Node Number Byte (NNB).
‘NNB = FF’ is the default NNB to which all CAN bootloaders will respond. If NNB
is different than FF, the CAN microcontroller will respond only if its NNB matches
the one specified in FLIP.

The CAN bootloader starts autobaud, and once it is ready, acknowledges the
message to FLIP to indicate that the communication is established.

The default CRIS is 00. It is possible to set a different area for the 7 consecutive
CAN message identifiers. FLIP and the CAN microcontroller must use the same
CRIS to communicate.
4. From the ‘File’ menu, select ‘Load HEX’ and select the ‘can_gen.hex’ file.
5. Click ‘Run’ on the FLIP window. The CAN Generator program is successfully
programmed. We will now program NNB and CRIS to different values.
6. Click the ‘’Set CAN Node’ tab. The CAN Node Configuration dialog is displayed.

3-14 AT89STK-06 Software Demonstration Guide


4356A–CAN–09/04
Software Demonstrations

Figure 3-11. CAN Node Configuration dialog

7. Change the Node setting to ‘0F’ and CRIS to ‘08’. The BTC (Bit Timing Regis-
ters) settings remain unchanged. The NNB and CRIS settings are changed in
order to give a unique number to the controller and to adapt it to Message Identi-
fier mapping.
8. Click ‘Set’ to program the settings, then click ‘Read’ to verify that programming
was successful.
9. Ensure the ‘Reset’ check box is selected.
10. Click ’Start Application’.
The microcontroller has been successfully programmed. The generaor program
will run (send CAN messages and display on the UART). The chip will now
accept In-System Programming when ‘NNB = FF’ (default) or ‘0F’, and only with
‘CRIS = 08’.

3.5 ADC The purpose of this section is to demonstrate the basic funtionnality of the ADC module
Demonstration of the CAN microcontrollers.
Using the method similar to that discussed in the section above, it is possible to program
the ADC Demonstration ‘adc.hex’.
The demonstration software acquires an analog input voltage from the potentiometer
and displays the converted value to the The UART displays the content of any incoming
messages on a RS232 Terminal (9600 bauds for XTAL frequency at 12MHz).

AT89STK-06 Software Demonstration Guide 3-15


4356A–CAN–09/04
Software Demonstrations

Figure 3-12. ADC Demonstration RS232 output

3-16 AT89STK-06 Software Demonstration Guide


4356A–CAN–09/04
Section 4
Conclusion

4.1 Conclusion We have successfully run 2 demonstration programs on the AT89C51CC03U with
UART bootloader and 2 demonstration programs on the AT89C51CC03C with CAN
bootloader. In the CAN bootloader demonstrations we also modified the NNB and CRIS
in order to assign a unique number to the controller and adapt it to a Message Identifier
mapping.
Using AT89C51CC03U with UART bootloader and AT89C51CC03C with CAN boot-
loader, the same demonstration programs can be run on T89C51CC01. This illustrates
the full compatibility between AT89C51CC03 and T89C51CC01.

AT89STK-06 Software Demonstration Guide 4-17


Rev. 4356A–CAN–09/04
Atmel Headquarters Atmel Operations
Corporate Headquarters Memory RF/Automotive
2325 Orchard Parkway 2325 Orchard Parkway Theresienstrasse 2
San Jose, CA 95131 San Jose, CA 95131 Postfach 3535
TEL 1(408) 441-0311 TEL 1(408) 441-0311 74025 Heilbronn, Germany
FAX 1(408) 487-2600 FAX 1(408) 436-4314 TEL (49) 71-31-67-0
FAX (49) 71-31-67-2340
Europe Microcontrollers
Atmel Sarl 2325 Orchard Parkway 1150 East Cheyenne Mtn. Blvd.
Route des Arsenaux 41 San Jose, CA 95131 Colorado Springs, CO 80906
Case Postale 80 TEL 1(408) 441-0311 TEL 1(719) 576-3300
CH-1705 Fribourg FAX 1(408) 436-4314 FAX 1(719) 540-1759
Switzerland
TEL (41) 26-426-5555 La Chantrerie Biometrics/Imaging/Hi-Rel MPU/
FAX (41) 26-426-5500 BP 70602 High Speed Converters/RF Data-
44306 Nantes Cedex 3, France com
Asia TEL (33) 2-40-18-18-18 Avenue de Rochepleine
Room 1219 FAX (33) 2-40-18-19-60 BP 123
Chinachem Golden Plaza 38521 Saint-Egreve Cedex, France
77 Mody Road Tsimhatsui ASIC/ASSP/Smart Cards TEL (33) 4-76-58-30-00
East Kowloon Zone Industrielle FAX (33) 4-76-58-34-80
Hong Kong 13106 Rousset Cedex, France
TEL (852) 2721-9778 TEL (33) 4-42-53-60-00
FAX (852) 2722-1369 FAX (33) 4-42-53-60-01

Japan 1150 East Cheyenne Mtn. Blvd.


9F, Tonetsu Shinkawa Bldg. Colorado Springs, CO 80906
1-24-8 Shinkawa TEL 1(719) 576-3300
Chuo-ku, Tokyo 104-0033 FAX 1(719) 540-1759
Japan
TEL (81) 3-3523-3551 Scottish Enterprise Technology Park
FAX (81) 3-3523-7581 Maxwell Building
East Kilbride G75 0QR, Scotland
TEL (44) 1355-803-000
FAX (44) 1355-242-743

e-mail
[email protected]

Web Site
http://www.atmel.com

Disclaimer: Atmel Corporation makes no warranty for the use of its products, other than those expressly contained in the Company’s standard
warranty which is detailed in Atmel’s Terms and Conditions located on the Company’s web site. The Company assumes no responsibility for any
errors which may appear in this document, reserves the right to change devices or specifications detailed herein at any time without notice, and
does not make any commitment to update the information contained herein. No licenses to patents or other intellectual property of Atmel are
granted by the Company in connection with the sale of Atmel products, expressly or by implication. Atmel’s products are not authorized for use
as critical components in life support devices or systems.

© Atmel Corporation 2004. All rights reserved. ATMEL ®, logo and combinations thereof, are registered trademarks, and Everywhere You
Are sm are the trademarks of Atmel Corporation or it subsidiaries. Other terms and product names may be the trademarks of others.

Printed on recycled paper.

4356A–CAN–09/04 /xM

You might also like