Forum Menu




 


Log in Problems?
New User? Sign Up!
AVR Freaks Forum Index

Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
mojtaba_led
PostPosted: Oct 17, 2011 - 04:16 AM
Wannabe


Joined: Jun 25, 2011
Posts: 55
Location: IRAN

hi
i try to use the usb of at90usb162 but i don't know i must to have what information to geting start of course i know somewhat things about usb opration .
i search in net and encounter to the LUFA library but when i look at its file more confused! i don't understand for a simple connection to usb i need which file's and how to use them ?

pleas help me

thanks
 
 View user's profile Send private message  
Reply with quote Back to top
clawson
PostPosted: Oct 17, 2011 - 10:04 AM
10k+ Postman


Joined: Jul 18, 2005
Posts: 62281
Location: (using avr-gcc in) Finchingfield, Essex, England

Maybe start by saying what kind of USB device you are trying to implement - there are lots to choose from HID=keyboard/mice/joystick/etc., CDC=UART/comm port, MSD=mass storage (memory stick), MIDI=music etc., app specific, vendor specific.

if it's just to make a UART/comm connection from a PC terminal program to the AVR then see Dean's examples of CDC in LUFA.

Cliff

_________________
 
 View user's profile Send private message  
Reply with quote Back to top
mojtaba_led
PostPosted: Oct 17, 2011 - 06:35 PM
Wannabe


Joined: Jun 25, 2011
Posts: 55
Location: IRAN

thanks alot
well i don't ever know these you say !
can you explain for me ?

are these variety of USB classes?

i just want to connect to usb and for example monitor a tempereture or set point or contrlo speed of a dc motor by chenging the pwm.
 
 View user's profile Send private message  
Reply with quote Back to top
clawson
PostPosted: Oct 17, 2011 - 06:55 PM
10k+ Postman


Joined: Jul 18, 2005
Posts: 62281
Location: (using avr-gcc in) Finchingfield, Essex, England

Quote:

i just want to connect to usb and for example monitor a tempereture or set point or contrlo speed of a dc motor by chenging the pwm.

I'd suggest CDC-ACM is the place to start - that way you don't need "special" USB software on the PC - you can just use any terminal program (like Hyperterminal but preferably not Hyperterminal!) and see the logged temperature or type command to the AVR. This means you aren't developing both AVR and PC software at the same time and you know the PC end will work (with the exception of Hyperterminal!)

_________________
 
 View user's profile Send private message  
Reply with quote Back to top
mojtaba_led
PostPosted: Oct 17, 2011 - 07:38 PM
Wannabe


Joined: Jun 25, 2011
Posts: 55
Location: IRAN

Quote:

I'd suggest CDC-ACM is the place to start - that way you don't need "special" USB software on the PC - you can just use any terminal program

this means i don't need to build a dll file for connect to usb?

Quote:

like Hyperterminal but preferably not Hyperterminal!

can i use the terminal emulator in codvision and can i build a terminal with VB(NOT .NET) ?

AND i want to use the exampel of this address :LUFA-111009_3\LUFA-111009\Projects\USBtoSerial
is it good to start with cdc?
 
 View user's profile Send private message  
Reply with quote Back to top
clawson
PostPosted: Oct 17, 2011 - 09:04 PM
10k+ Postman


Joined: Jul 18, 2005
Posts: 62281
Location: (using avr-gcc in) Finchingfield, Essex, England

Quote:

this means i don't need to build a dll file for connect to usb?


Correct you use any software that can open a COMn port.
Quote:

can i use the terminal emulator in codvision and can i build a terminal with VB(NOT .NET) ?

Almost certainly yes and yes.

Quote:

AND i want to use the exampel of this address :LUFA-111009_3\LUFA-111009\Projects\USBtoSerial

Exactly that USB to serial is the place to start. You can ignore the serial output on the "other side" if you want.

_________________
 
 View user's profile Send private message  
Reply with quote Back to top
mojtaba_led
PostPosted: Oct 17, 2011 - 09:23 PM
Wannabe


Joined: Jun 25, 2011
Posts: 55
Location: IRAN

THANK YOU VERY MUCH!
but i have very question in next!

thanks again
 
 View user's profile Send private message  
Reply with quote Back to top
abcminiuser
PostPosted: Oct 18, 2011 - 12:21 AM
Moderator


Joined: Jan 23, 2004
Posts: 9825
Location: Trondheim, Norway

The USBtoSerial demo is designed to be a full USB to Serial converter IC replacement; i.e. it has internal FIFO buffer for sending and receiving to and from the physical USART.

An easier place to start is LUFA\Demos\Device\ClassDriver\VirtualSerial\, which focuses on virtual serial communications over a USB connection that are generated from within the AVR application itself.

- Dean Twisted Evil

_________________
Atmel Studio 6.1 is now released, grab it here.
Report AS6/ASF bugs here.
 
 View user's profile Send private message Send e-mail Visit poster's website 
Reply with quote Back to top
mojtaba_led
PostPosted: Oct 18, 2011 - 12:50 PM
Wannabe


Joined: Jun 25, 2011
Posts: 55
Location: IRAN

Quote:

An easier place to start is LUFA\Demos\Device\ClassDriver\VirtualSerial\, which focuses on virtual serial communications over a USB connection that are generated from within the AVR application itself.

do this oprate in CDC class?
and how much the rate of send and recive deta in class?

thanks
 
 View user's profile Send private message  
Reply with quote Back to top
abcminiuser
PostPosted: Oct 18, 2011 - 01:04 PM
Moderator


Joined: Jan 23, 2004
Posts: 9825
Location: Trondheim, Norway

Quote:

do this oprate in CDC class?


Yes. The USBtoSerial is essentially just an extended version of the demo I quoted, which means it contains more features and code than you need for your application. Stick to the simpler demo.

Quote:

and how much the rate of send and recive deta in class?


I see varying figures, but with double banked 64KB endpoints I've heard figures as high as 2Mb (256KB/s). Remember that the USB AVR controllers may be USB 2.0 compliant, but they can't actually saturate the USB bus even at USB 1.0 Full Speed.

- Dean Twisted Evil

_________________
Atmel Studio 6.1 is now released, grab it here.
Report AS6/ASF bugs here.
 
 View user's profile Send private message Send e-mail Visit poster's website 
Reply with quote Back to top
mojtaba_led
PostPosted: Oct 18, 2011 - 02:55 PM
Wannabe


Joined: Jun 25, 2011
Posts: 55
Location: IRAN

excuse me i am beginner!
in VirtualSerial folder there are no main.c file this mean that file is exist here are lib for another application?

and what are Doxygen.conf and LUFA VirtualSerial.inf and VirtualSerial.aps files in this folder?

and i want write my code in avrstudio5 so i must copy these file in this folder to my folder application and use the make file that exist here as my make file of project ?

thanks
 
 View user's profile Send private message  
Reply with quote Back to top
isouxer
PostPosted: Oct 18, 2011 - 03:40 PM
Rookie


Joined: Mar 16, 2011
Posts: 22


I am also a beginner, but
mojtaba_led wrote:

in VirtualSerial folder there are no main.c file this mean that file is exist here are lib for another application?

no, the main.c file for VirtualSerial is a same VirtualSerial.c and so in all other projects
mojtaba_led wrote:

and what are Doxygen.conf and LUFA VirtualSerial.inf and VirtualSerial.aps files in this folder?

Doxygen.conf is config file for make indexed documents of the project and help
VirtualSerial.aps is project file which opens the program: AVR Studio 4
mojtaba_led wrote:

and i want write my code in avrstudio5 so i must copy these file in this folder to my folder application and use the make file that exist here as my make file of project ?

When you run an AVR Studio 5, select menu: File->Import->AVR STudio 4 Project... and in folder VirtualSerial file: VirtualSerial.aps
 
 View user's profile Send private message  
Reply with quote Back to top
clawson
PostPosted: Oct 18, 2011 - 03:42 PM
10k+ Postman


Joined: Jul 18, 2005
Posts: 62281
Location: (using avr-gcc in) Finchingfield, Essex, England

Quote:

there are no main.c file

Yes there is:
Code:
E:\LUFA101122\Demos\Device\ClassDriver\VirtualSerial>dir
 Volume in drive E is VBOX_linux
 Volume Serial Number is 0000-0805

 Directory of E:\LUFA101122\Demos\Device\ClassDriver\VirtualSerial

27/04/2011  14:55    <DIR>          .
27/04/2011  14:55    <DIR>          ..
22/11/2010  16:24            10,318 Descriptors.c
28/10/2010  17:09             3,287 Descriptors.h
02/08/2010  19:53            67,579 Doxygen.conf
28/10/2010  17:09             3,306 LUFA VirtualSerial.inf
14/10/2010  01:05            21,688 makefile
13/07/2010  16:38             2,850 VirtualSerial.aps
05/11/2010  16:15             5,455 VirtualSerial.c
05/11/2010  16:15             2,610 VirtualSerial.h
14/10/2010  01:05             2,283 VirtualSerial.txt
               9 File(s)        127,568 bytes
               2 Dir(s)  304,529,379,328 bytes free

E:\LUFA101122\Demos\Device\ClassDriver\VirtualSerial>grep main( *.c
VirtualSerial.c:int main(void)

_________________
 
 View user's profile Send private message  
Reply with quote Back to top
mojtaba_led
PostPosted: Oct 18, 2011 - 04:34 PM
Wannabe


Joined: Jun 25, 2011
Posts: 55
Location: IRAN

oh my god why i don't understand ?

Quote:

When you run an AVR Studio 5, select menu: File->Import->AVR STudio 4 Project... and in folder VirtualSerial file: VirtualSerial.aps

i do this and compile but this project write for Atmega128 this means this project can only use for avr that not usb port but i want the usb port of AT90USB162 !??

Quote:

es there is:
Code:
E:\LUFA101122\Demos\Device\ClassDriver\VirtualSerial>dir
Volume in drive E is VBOX_linux
Volume Serial Number is 0000-0805

Directory of E:\LUFA101122\Demos\Device\ClassDriver\VirtualSerial

27/04/2011 14:55 <DIR> .
27/04/2011 14:55 <DIR> ..
22/11/2010 16:24 10,318 Descriptors.c
28/10/2010 17:09 3,287 Descriptors.h
02/08/2010 19:53 67,579 Doxygen.conf
28/10/2010 17:09 3,306 LUFA VirtualSerial.inf
14/10/2010 01:05 21,688 makefile
13/07/2010 16:38 2,850 VirtualSerial.aps
05/11/2010 16:15 5,455 VirtualSerial.c
05/11/2010 16:15 2,610 VirtualSerial.h
14/10/2010 01:05 2,283 VirtualSerial.txt
9 File(s) 127,568 bytes
2 Dir(s) 304,529,379,328 bytes free

E:\LUFA101122\Demos\Device\ClassDriver\VirtualSerial>grep main( *.c
VirtualSerial.c:int main(void)

i don't see \VirtualSerial>dir and VirtualSerial>grep main( *.c !?
 
 View user's profile Send private message  
Reply with quote Back to top
clawson
PostPosted: Oct 18, 2011 - 04:52 PM
10k+ Postman


Joined: Jul 18, 2005
Posts: 62281
Location: (using avr-gcc in) Finchingfield, Essex, England

grep is a search tool - it searches files for text patterns. I asked it to identify any file that contained "main(" and it said VirtualSerial.c

My point therefore is that the file with the main() function in it here is the one called VirtualSerial.c - there's no law that states that the source file that contains main() must be called main.c

As for using AS5 to build. Start simple and use make at the command prompt.

_________________
 
 View user's profile Send private message  
Reply with quote Back to top
mojtaba_led
PostPosted: Oct 18, 2011 - 05:14 PM
Wannabe


Joined: Jun 25, 2011
Posts: 55
Location: IRAN

i change the target to AT90USB162 and compile VirtualSerial.c and program my at90usb162 with FLIP and click on start application then run hyperterminal now i must which com port 1 or 2 or 3 or ...?

this is my sChematic of board that i use :


do i must use library of usart in my application to send and receive data than hypertermianal ?
 
 View user's profile Send private message  
Reply with quote Back to top
isouxer
PostPosted: Oct 18, 2011 - 05:24 PM
Rookie


Joined: Mar 16, 2011
Posts: 22


Quote:
i do this and compile but this project write for Atmega128 this means this project can only use for avr that not usb port but i want the usb port of AT90USB162 !??

In same folder of project, exist file = makefile.
Find this place and change the code as I did:
MCU = at90usb162
Code:
#
# To rebuild project do "make clean" then "make all".
#----------------------------------------------------------------------------


# MCU name
# MCU = at90usb1287
MCU = at90usb162



# Target board (see library "Board Types" documentation, NONE for projects not requiring

save makefile and rebuild solution. Smile
 
 View user's profile Send private message  
Reply with quote Back to top
mojtaba_led
PostPosted: Oct 18, 2011 - 05:46 PM
Wannabe


Joined: Jun 25, 2011
Posts: 55
Location: IRAN

Quote:

In same folder of project, exist file = makefile.
Find this place and change the code as I did:
MCU = at90usb162
save makefile and rebuild solution.

i do this but yet pc don't detect my board on usb port !
what do i do for exampel display "hello word" on hyper terminal?
 
 View user's profile Send private message  
Reply with quote Back to top
isouxer
PostPosted: Oct 18, 2011 - 05:59 PM
Rookie


Joined: Mar 16, 2011
Posts: 22


All that is about USB things I check my in Linux. I can not help you...
Can you check if the USB is registered successfully on your PC?

Look how I have checked this:
http://www.youtube.com/watch?v=oHvL1u1uOvY
 
 View user's profile Send private message  
Reply with quote Back to top
mojtaba_led
PostPosted: Oct 18, 2011 - 06:00 PM
Wannabe


Joined: Jun 25, 2011
Posts: 55
Location: IRAN

i must to say i use s usb cable and connect the usb port on at90usb162 to usb port oc pc and program with flip adn then start application without any rs232 connection is this correct ?
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT + 1 Hour
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2006 The PNphpBB Group
Credits