all of andyQ

what you get is what you share……….

USB Led Demo using ADB20 V1.0

Posted by Andik on August 4, 2008

Introduction

This project is based on AVR309: USB to UART Protocol Converter, the ATMEL application note written by Ing. Igor Cesco from Slovakia. This document implement the functions of Direct I/O control, USB to RS232 Converter and EEPROM scratch register, and it can be develop by user to implement other function like USB A/D Converter in other way we can build a Small USB Thermometer (I’ll build soon…).

Hardware

The project I’ve build using ADB20 V1.0 as implementation board. The ADB20 board is compatible for AVR309 hardware implementation. The USB data lines, DATA- and DATA+, are connected to pins PB0 and PB1 on the AVR trough 3×2 pin headers for optional use. This connection cannot be change consider to the firmware.

We have to set the jumper configuration on the ADB20 V1.0 Board to connect the board to PC USB port. The configuration should be like the figure shown below. We used to remove JP1 jumper pin (LED_en) because it can make D+ data lines voltage drop and make the connection lost. To powering the board we used to configure JP2 as figure which connecting the board to USB V+ and Ground Port lines of PC. And of course to connect the board to the PC USB port we used to apply J5 jumper pin as figure.

The led connected to Port C, but we can connect it to another pin of port except PB0, PB1 and PD2 because it’s already used for USB data lines pin.

Software

As stated on the application note, In order to communicate with the device we will need some software support on the PC side. This software is divided into 3 levels:

1. Device driver: Used for low-level communication with the device and for installation into operating system (Windows98/ME/NT/XP).

2. DLL library: Used for encapsulation of device functions and communication with the device driver. The DLL simplifies the device function access from the user’s application. It includes some device and operating system related functions (threads, buffers, etc.).

3. User application: Makes user interface for friendly communication between user and device. Uses function calls from DLL library only.

The application program is build using Delphi7 because the end user application example written in Delphi too, so I can modify the source code to find which part is the direct I/O control function is and how to use it. The functions to control the I/O port of board are DoSetDataPortDirection, DoGetDataPortDirection, DoSetOutDataPort, DoGetOutDataPort, DoGetInDataPort. These functions are in AVR309.dll library, so we have to define the function in order to communicate to the board.

The application allow you to choose which one the port you want to access, control the data port direction, control each pin of port, and you can see the Demo led and of course the status label that show you whether device is connected or not.

References

Igor Cesko Web – You can get the open source USB to UART application.

Download

usb-led.rar– The user application I’ve build (extract with winrar first).

source-usb-led1.rar – Delphi sourcecode

AVR309 _doc2556.pdf – AVR309: USB to UART Protocol Converter application note.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: