AT89STK-06 CAN Starter Kit Software

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
2.2
2.3
Hardware Requirements ...........................................................................2-3
Software Requirements.............................................................................2-3
FLIP Software ...........................................................................................2-3
Section 3
Software Demonstrations ..................................................................... 3-5
3.1
3.2
3.3
3.4
3.5
UART Bootloader Demonstration Setup ...................................................3-5
Using FLIP ................................................................................................3-6
CAN Bootloader Demonstration Setup ...................................................3-11
CAN Bootloader Demonstration Program ...............................................3-13
ADC Demonstration ................................................................................3-15
Section 4
Conclusion .......................................................................................... 4-17
4.1
AT89STK-06 Software Demonstration Guide
Conclusion ..............................................................................................4-17
1
4356C–CAN–07/05
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. 4356C–CAN–07/05
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
Requirements
„ CAN Demo board plus either a Second AT89STK-06 (1) and/or a CAN Dongle(1)
(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
Notes: 1. Not included in CAN Demo Board kit.
2. The AT89STK-06 can also be used with T89C51CC01 and T89C51CC02
CAN controllers (requires optional adapter for T89C51CC02)
3. The AT89STK-06 can be used with AT89C51AC3, T89C51AC2, T89C5115
controllers with ADC (requires optional adapter for T89C5115).
2.2
Software
Requirements
Several demonstration programs can be found in the accompanying CD-ROM
„ 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)
„ ADC demonstration program (HEX file)(1)
„ A self training package is also available on the CAN CD-ROM. It introduces CAN bit
timing as welll as the CAN Software Library.
Note: 1. The ADC demo is the only demonstration program that can be used with nonCAN products.
AT89STK-06 Software Demonstration Guide
2-3
Rev. 4356C–CAN–07/05
Getting Started
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. The following figures were assembled
with Flip 2.2.4.
A Linux version of FLIP is also available.
2-4
4356C–CAN–07/05
AT89STK-06 Software Demonstration Guide
Section 3
Software Demonstrations
3.1
UART
Bootloader
Demonstration
Setup
The first demonstration (UART Bootloader) will use a PC running FLIP software to program a CAN Demo board through an RS-232 cable as illustrated in Figure 3-1.
Figure 3-1. PC to CAN Demoboard Through RS-232
RS-232
Serial Cable
8~15V DC
Power Supply
PC running FLIP
AT89STK-06 Software Demonstration Guide
3-5
Rev. 4356C–CAN–07/05
Software Demonstrations
3.1.1
Hardware
Connection
1. Connect a 9 volts DC power supply.
2. Connect the AT89STK-06 to the PC through the RS-232 cable.
3. Ensure a AT89C51CC03U-SLSIM is connected to the AT89STK-06.
3.1.2
Setting the
Hardware Condition
CAN microcontrollers come pre-programmed to start in Bootloader mode at first powerup. In the first ISP demonstration, the user will need to program the sample microcontroller 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
4356C–CAN–07/05
AT89STK-06 Software Demonstration Guide
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 popup 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
4356C–CAN–07/05
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
4356C–CAN–07/05
AT89STK-06 Software Demonstration Guide
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
4356C–CAN–07/05
Software Demonstrations
The following messages will appear on the RS232 terminal
Figure 3-7. CAN Generator RS232 output
3-10
4356C–CAN–07/05
AT89STK-06 Software Demonstration Guide
Software Demonstrations
3.2.1
CAN Monitor
Demonstration
Program
Using a method similar to that discussed in the demonstration program above, it is possible to program the Monitor Demonstration ‘can_mon.hex’. The Monitor Demonstration
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 demonstration ‘can_gen.hex’ on one board and the CAN Monitor demonstration
‘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
Demonstration
Setup
In this section, 2 demonstration programs will be explained.
First we will program the Atmel Dongle via the UART. Second we will run the demonstration 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 Bootloader Demonstration Program”.
AT89STK-06 Software Demonstration Guide
3-11
4356C–CAN–07/05
Software Demonstrations
Figure 3-9. CAN Dongle for CAN Demo
RS-232
Serial Cable
8~15V DC
Power Supply
PC running FLIP
CAN BUS
6~15V DC
Power Supply
ATMEL Dongle
3.3.1
Hardware
Connections
AT89C51CC03 with CAN Bootloader
1. Connect a C51 Demo board and a CAN Demo board.
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
4356C–CAN–07/05
AT89STK-06 Software Demonstration Guide
Software Demonstrations
3.3.2
Programming Using
FLIP
This section allows you to program the AT89C51CC03 microcontroller using 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 bottom 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
Demonstration
Program
The following procedure will guide you through the execution of the demonstration
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
4356C–CAN–07/05
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
4356C–CAN–07/05
AT89STK-06 Software Demonstration Guide
Software Demonstrations
Figure 3-11. CAN Node Configuration dialog
7. Change the Node setting to ‘0F’ and CRIS to ‘08’. The BTC (Bit Timing Registers) 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 Identifier 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
Demonstration
The purpose of this section is to demonstrate the basic funtionnality of the ADC module
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 (2400 bauds for XTAL frequency at 12MHz).
The ADC demonstration program can be used with AT89C51CC03, T89C51CC01,
T89C51CC02, and AT89C51AC3, T89C51AC2, T89C5115.
AT89STK-06 Software Demonstration Guide
3-15
4356C–CAN–07/05
Software Demonstrations
Figure 3-12. ADC Demonstration RS232 output
3-16
4356C–CAN–07/05
AT89STK-06 Software Demonstration Guide
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 bootloader, 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. 4356C–CAN–07/05
Atmel Headquarters
Atmel Operations
Corporate Headquarters
Memory
2325 Orchard Parkway
San Jose, CA 95131
TEL 1(408) 441-0311
FAX 1(408) 487-2600
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 Tsimhatsui
East Kowloon
Hong Kong
TEL (852) 2721-9778
FAX (852) 2722-1369
Japan
9F, Tonetsu Shinkawa Bldg.
1-24-8 Shinkawa
Chuo-ku, Tokyo 104-0033
Japan
TEL (81) 3-3523-3551
FAX (81) 3-3523-7581
2325 Orchard Parkway
San Jose, CA 95131
TEL 1(408) 441-0311
FAX 1(408) 436-4314
RF/Automotive
Theresienstrasse 2
Postfach 3535
74025 Heilbronn, Germany
TEL (49) 71-31-67-0
FAX (49) 71-31-67-2340
Microcontrollers
2325 Orchard Parkway
San Jose, CA 95131
TEL 1(408) 441-0311
FAX 1(408) 436-4314
La Chantrerie
BP 70602
44306 Nantes Cedex 3, France
TEL (33) 2-40-18-18-18
FAX (33) 2-40-18-19-60
ASIC/ASSP/Smart Cards
Zone Industrielle
13106 Rousset Cedex, France
TEL (33) 4-42-53-60-00
FAX (33) 4-42-53-60-01
1150 East Cheyenne Mtn. Blvd.
Colorado Springs, CO 80906
TEL 1(719) 576-3300
FAX 1(719) 540-1759
Biometrics/Imaging/Hi-Rel MPU/
High Speed Converters/RF Datacom
Avenue de Rochepleine
BP 123
38521 Saint-Egreve Cedex, France
TEL (33) 4-76-58-30-00
FAX (33) 4-76-58-34-80
1150 East Cheyenne Mtn. Blvd.
Colorado Springs, CO 80906
TEL 1(719) 576-3300
FAX 1(719) 540-1759
Scottish Enterprise Technology Park
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: 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 ATMEL’S TERMS AND CONDITIONS OF SALE LOCATED ON ATMEL’S 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
PURPOSE, OR NON-INFRINGEMENT. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, CONSEQUENTIAL, PUNITIVE, SPECIAL OR INCIDENTAL 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.
© Atmel Corporation 2005. All rights reserved. Atmel ®, logo and combinations thereof, Everywhere You Are ®
and others, are registered trademarks or trademarks of Atmel Corporation or its subsidiaries. Other terms and
product names may be trademarks of others.
Printed on recycled paper.
4356C–CAN–07/05
/xM