Introduction: How to Use the Dragon Rider 500 With Your AVR Dragon

This instructable is a crash course in how to use some of the features of the Dragon Rider 500 from Ecros Technologies. Please be aware that there is a very detailed User's Guide available on the Ecros website.

The Dragon Rider is a interface board for use with an AVR microcontroller programmer called the AVR Dragon by Atmel.

For more information:

Atmel's Wesite:
http://www.atmel.com/

AVR Dragon link:
http://www.atmel.com/dyn/products/tools_card.asp?tool_id=3891

Dragon Rider 500 by Ecros Technology:
http://www.ecrostech.com/AtmelAvr/DragonRider/index.htm

Dragon Rider 500 assembly Instructable:
https://www.instructables.com/id/Assembling-the-Dragon-Rider-500-for-use-with-the-A/

Learn all about the AVR microcontrollers:
http://www.avrfreaks.net

This instructable may grow with time so check back now and again!

Step 1: AVR Dude

You need some programming software in order to use the AVR Dragon for programming. I use AVRdude with the Ubuntu operating system (linux) and I'm very happy with the results.

This instructable will not deal with the intricacies of programming software. If you do not know how to set-up or use programming software, check this instructable out to bring you up to speed:
https://www.instructables.com/id/Getting-started-with-ubuntu-and-the-AVR-dragon/

My guess is that if you have purchased and assembled a Dragon Rider 500 you already know how to program a chip with the AVR Dragon..... onward!

Step 2: ATtiny2313 - Blink the LEDs

Let's program an ATtiny2313 which is a 20-pin microcontroller.

The Dragon Rider 500 has sockets for several different sized AVR microcontrollers. These include: 8, 20, 28, and 40 pin sockets. Depending on which socket you use, jumpers on the Dragon Rider board must be set differently.

Jumper Settings


Set the jumpers on the Dragon Rider so that the shunts connect the following pins. (pin4 is the center pin for J22-J-24)

Pins:
J5 - 23
J6 - 23
J7 - 12
J16 - 23
J22 - 41
J23 - 41
J24 - 41

This is a basic setup that allows for ISP (In System Programming).

Blinky Blinky


Programming does no good unless you have something to program. I have written a very short code example to blink the Dragon Rider's LED's one at a time.

Use a ribbon cable to connect the LED header (J29) to the PortB header (J2).

Programming

I've included the C file as well as a makefile and the hex file. Like I mentioned in the intro, I cannot cover the software side of programming in the Instructable. Program like you would for the AVR Dragon, as the Dragon Rider doesn't alter the software side of things at all.

Step 3: Using the LCD Add-on

Here's a simple way to use the LCD Add-on. This will write "Dragon Rider" to the LCD screen.

Hardware:

  • ATtiny2313
  • R/W Jumper: R/W should be connected to "BIT1" on the Dragon Rider Board (See explaination in the Assembly Instructable)
  • J23: This jumper must be installed for ISP programming but then removed for the LCD to function properly.
  • Connect LCD to PORT B using ribbon cable (J31 to J2)

Software

I am using Peter Fleury's LCD library to drive the LCD in 4-bit mode. Check out Peter's Homepage to download the library.

You will need to make sure that lcd.c is compiled with your code and that you make the following changes to lcd.h:
  • We are using the internal RC oscillator so XTAL needs to be set for 1MHz:
  •   #define XTAL 1000000
  • Port settings need to be adjusted to PORTB:
  •   #define LCD_PORT         PORTB
  • Pinout for 4 data lines needs to be adapted:
  •   #define LCD_DATA0_PIN    4  #define LCD_DATA1_PIN    5  #define LCD_DATA2_PIN    6  #define LCD_DATA3_PIN    7
  • Pinout for RS, RW, and E needs to be adapted:
  •   #define LCD_RS_PIN      3  #define LCD_RW_PIN      1  #define LCD_E_PIN       2

The main program is very simple thanks to the work Peter Fleury did in his LCD library.

CODE:
#include <avr/io.h>#include "lcd.h"int main(void){  lcd_init(LCD_DISP_ON);  //Initialize LCD with the cursor off  lcd_clrscr();           //Clear the LCD screen  lcd_gotoxy(5,0);        //Move cursor to this location  lcd_puts("Dragon");     //Put this string on the LCD  lcd_gotoxy(6,1);        //Move cursor to this location  lcd_puts("Rider");      //Put this string on the LCD  for (;;)  {    // Do nothing forever (Message already displayed on LCD)  }}

Code Attached

The code attached includes Peter Fleury's LCD library (lcd.c and lcd.h) with his permission. Thank you Peter! The only alteration I have made to it is to set the proper pins in the Defines. Please visit his site to download the package: http://www.jump.to/fleury

I have also included a makefile that I use written by Eric B. Weddington and, Jorg Wunsch. I sent a PM to Jorg over at avrfreaks.net but never received a response from him. There are a few changes in the makefile to tailor to using Linux and the Dragon. Thank you to you both, please set me know your preferences on me sharing your work.

Step 4: 28-pin UC ISP Programming (ATmega8)

The next project demontration will utilize an ATmega8 which is a 28-pin avr. Here is the the basic jumper set for ISP programming the 28-pin microcontrollers.

Jumper Settings


Set the jumpers on the Dragon Rider so that the shunts connect the following pins. (pin4 is the center pin for J22-J-24)

Pins:
J11 - 23
J12 - 23
J13 - 12
J16 - 23
J22 - 42
J23 - 42
J24 - 42

Technical Information

  • Connecting J11 and J12 in this fashion allows you to use those pins as I/O pins. The alternative would be to route these pins to make a connection with the external crystal.
  • Connecting J13 in this fashion allows us to use it as the reset pin. The alternative would route this pin to the PORTC header for use as an I/O pin. (this would have many drawbacks, including the inability to program this chip using ISP).
  • J16 & J22-J24 are connected in this fashion to route the appropriate pins (Reset, MISO, MOSI, and SCK) to the ISP header of the AVR Dragon.

Step 5: Advanced LCD and Button Usage: the Big Clock

This is a fun project that makes use of the LCD screen and buttons. We will be dealing with Real Time Clock functions and custom characters on the LCD.

In the picture at the bottom you can see the time 7:26:07pm displayed in large numbers on the LCD screen. Each number is using a 2x2 grid of the characters display to show the large number. This utilizes a font originally written by Xtinus for the XBMC project.

The buttons are used to set the clock. Left increments the hours, Up increments the minutes, Right toggles between 12 and 24-hour time, and Enter resets the seconds to zero.

The clock doesn't keep very good time as we are using the very inaccurate internal oscillator, but this program can easily be altered to use a much more accurate external crystal. See this in action in the video below.


An explaination of how this code works is in order, but I don't have the time right now.

For now, connect the LCD header (J31) to PORTD (J4) and the button header (J30) to PORTB (J2). Make sure you have both SW1 and SW2 in the off position. Connect the AVR Dragon to a usb cable and plug the other end of that cable into your computer. Turn on SW2 and program the ATmega8 with the programming software of your choice (hex file below; fuses burnt to factory settings).

NOTE: In order to utilize the Left and Up buttons you will need to remove the shunts from J22 and J24, do this while the power is off.

Step 6: High Voltage Programming

I have used the High Voltage Parallel Programming to resurrect an ATtiny2313 that I set the wrong fuse settings on. I needed it a second time when working on this instructable because I accidentally wrote the lfuse setting I wanted to the hfuse register..... ooops. High Voltage parallel programming is a handy tool to have at your disposal!

Below are a lists of my jumper settings:

USE AT YOUR OWN RISK, THIS TYPE OF PROGRAMMING CAN DAMAGE YOUR HARDWARE IF YOU DON'T KNOW WHAT YOU'RE DOING!!

High Voltage Parallel Programming:

ATtiny2313 in socket U3:
SW1 - OFF
SW2 - ON
J5, J6, J7 - connect pin1 and pin2
XTAL1 - connect pin1 and pin2
J16 - Connect pin1 and pin2
2x5 IDC Cables: PROG_CTRL to PORT D, PROG_DATA to PORT B
All other jumpers unconnected (J8-J13, J18, J19, J20, J22-J28, J24)

For other chips you should be able to figure out the settings you need from Atmel's user guide for their STK500.

Step 7: Expanding Beyond the Board

I find it quite easy to interface with a breadboard. This allows for a lot more flexibility in prototyping and developing code at the same time.

Below you will see a couple of breadboards connected to the Dragon Rider. I connect up the ribbon cables to the appropriate ports at one end. At the other I use jumper wires to connected the proper ICD conductor with the breadboards.

Step 8: Conclusion

There is much more that could be involved in this Instructable. Just tonight I complete an adapter that allows you to use the 6-pin programming header without removing the dragon from the Dragon Rider. I'll be putting information on how to construct one yourself... coming soon.

If you have other things you think need to be added leave a comment.

Step 9: Adding a 6-Pin ISP

I usually build in a 6-pin ISP header to all of my projects so I can reprogram the chip if necessary and not have to take it off of the project board. The dragon rider sadly doesn't have a 6-pin ISP header available but I did figure out how to make one available.

Warning!!!

This is a hack. If you don't know exactly how this works, don't do it

You've been warned.

I've created my own adapter board and 3-pin jumper in order to supply the 6-pin isp header. What you do is set the Dragon Rider up to program and 8-pin microcontroller. Using a 3-pin socket I am jumpering J8 to connect pins 1 and 3. This routes the clock signal to the PortB connector. I then run a jumper cable from the PortB header to my adapter board and voila!

There are pictures below.... please, please, please, don't do this unless you truely understand what you are doing as you could damage your AVR Dragon or worse if you do this wrong.

Pinout: PortB    ISP1        42        13        34        NC5        NC6        57        NC8        NC9        610       2

Step 10: RSS Reader Using Serial Connection and LCD

I'm continuing to play around with this development board. This time I spent part of an afternoon developing an RSS readion (mostly on the python side of things). I don't think it warrants its own instructable so I'm adding it on here.



Hardware


We are using the Dragon Rider 500 as a development board. This provides all of the hardware you need (assuming you have all of the add-on kits). That being said you certainly can do this with your own hardware setup:
  • ATmega8 microcontroller (or any that has a USART and enough pins for all connections
  • A way to program the microcontroller (I use the AVR Dragon)
  • MAX232 chip for the serial communications
  • DB9 connector
  • HD44780 LCD screen
  • Crystal (I used an 8MHz crystal)
  • Assorted capacitors and resistors

A schematic is provided below.

On the Dragon Rider we will need to use some creativity to Route the connections. Normally Port D could be connected directly to the LCD header. This is not the case here because the USART needed for the serial connection uses PD0 and PD1. Furthermore, Port B cannot be used because PB6 and PB7 are in use for the external crystal.

Pictured below is my solution to this problem. I plug in a ribbon cable to the headers for the LCD, Port B and Port D, then use jumper wires to make the proper routes. Don't forget to hook up voltage and ground to the LCD header.

Software


The software for this project comes in two parts, the firmware for the microcontroller and the python script for scraping the RSS feeds and sending them over the serial connection.

AVR Firmware
I'm using Peter Fleury's LCD library again (http://jump.to/fleury). It's powerful and concise, versatile, and easy to alter for your hardware setup. If you look at the header file attached (lcd.h) you will see that I'm running in 4-bit mode with Port D as the data bits, and Port B as the control bits.

The concept of this firmware is pretty simple:
  • Once powered up the microcontroller displays "RSS Reader" and then waits for serial data.
  • Each byte of serial data received causes a buffer of 16 chars to shift left and add the byte to the buffer, then display the buffer.
  • Three special commands are accepted by the microcontroller: 0x00, 0x01, and 0x02. These are clear screen, move to line 0, and move to line 1 respectively.

Python Scrypt
I wrote a pyton script to scrape the RSS data and send it over the serial connection. This requires the python module "pyserial" which you will probably have to install on your system to get this to work.

The RSS feed can be configured at the top of the pyton file. Notice that you need to enter a name for the feed as well as the feed url. There are three examples there, I'm certain you can follow those for the proper syntx.

Making it all work
  • Assemble the hardware
  • Program the microcontroller (dragon_rss.hex can be used if you don't want to compile this yourself). Fuse settings for ATmega8 using an 8 MHz crystal: lfuse= 0xEF hfuse=0xD9
  • Power up the Dragon Rider and make sure the serial cable is plugged in (LCD should read: "RSS Reader")
  • Execute the python program (python serial_rss.py)
  • Enjoy