usb project

Go To Last Post
8 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello
Are all Avr processors capable of being connected to a computer via usb?

m&m

Last Edited: Thu. Jun 10, 2021 - 01:04 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

monir7000 wrote:

Are all Avr processors capable of being connected to a computer via usb?

 

Yes. Either by using an on-chip peripheral, a separate USB chip, or a USB to serial cable.

#1 Hardware Problem? https://www.avrfreaks.net/forum/...

#2 Hardware Problem? Read AVR042.

#3 All grounds are not created equal

#4 Have you proved your chip is running at xxMHz?

#5 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand."

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
 Thank you! Brian Fairchild 
I want to design a project to control a motor step by step through the computer
- Is atmel avr studio enough to accomplish a project like this?

m&m

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

A stepper motor? Yes, absolutely.

#1 Hardware Problem? https://www.avrfreaks.net/forum/...

#2 Hardware Problem? Read AVR042.

#3 All grounds are not created equal

#4 Have you proved your chip is running at xxMHz?

#5 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand."

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

monir7000 wrote:
atmel avr studio

Did you mean Microchip Studio: https://www.microchip.com/en-us/development-tools-tools-and-software/microchip-studio-for-avr-and-sam-devices ?

 

Note the 'Getting Started' videos and hands-on training at the bottom of that page ...

 

ADDENDUM

 

It is the current name for the IDE formerly known as "Atmel Studio":

 

https://www.avrfreaks.net/forum/release-microchip-studio-702542

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
Last Edited: Thu. Jun 10, 2021 - 10:38 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

monir7000 wrote:
Are all Avr processors capable of being connected to a computer via usb?

The answer applies to all microcontrollers - not just AVR:

Brian Fairchild wrote:
Yes. Either by using an on-chip peripheral

Like this:

                           PCB
                          ...............................................
                          :                                             :
                          :     USB Converter        Microcontroller    :
+------+                  :                         +---------------+   :
|      |       USB        :                         |               |   :
|  PC  +<==========================================>+USB            |   :
|      |                  :                         |               |   :
+------+                  :                         +---------------+   :
                          :                                             :
                          ...............................................

This is the only case where you actually have a USB project

 

 

a separate USB chip

Like this:

                           PCB
                          ...............................................
                          :                                             :
                          :     USB Converter        Microcontroller    :
+------+                  :    +-------------+      +---------------+   :
|      |       USB        :    |             |      |               |   :
|  PC  +<=====================>+USB      UART+<====>+UART           |   :
|      |                  :    |             |      |               |   :
+------+                  :    +-------------+      +---------------+   :
                          :                                             :
                          ...............................................

 

 

or a USB to serial cable

Like this:

                           PCB
                          ...............................................
                          :                                             :
                          :                          Microcontroller    :
+------+                  :                         +---------------+   :
|      |   USB-to-UART    :                         |               |   :
|  PC  +<==========================================>+UART           |   :
|      |                  :                         |               |   :
+------+                  :                         +---------------+   :
                          :                                             :
                          ...............................................

 

In the last 2 cases, your project is entirely oblivious to the USB - it's just a UART project.

 

(USB-to-SPI and other converters are also available)

 

#USBtoPC

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
Last Edited: Thu. Jun 10, 2021 - 10:58 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Just to say that Andy's pictures 1 and 2 (and maybe even 3 in the case of "Tiny"?) are effectively what an Arduino is.

 

So if you want a board with an AVR that has an easy USB connection to a PC then just buy an Arduino. A $3-$5 "Uno" is probably the easy place to start. Note that just because the board is an "Arduino" it does not tie you to doing all your development in the Arduino IDE, in C++, using the Arduino libraries. You can pick whatever language you like.

 

Of course Andy's pictures (and Arduinos) are ONLY about adding a CDC-ACM Class device to the micro. If you wanted some other USB class then only his first picture can make that possible. In that (picking an AVR that has USB "inside") allows you to emulate any USB device class like HID, MIDI, MSD, Audio, Printer, etc etc. [EDIT: in fact anything on this list: https://www.usb.org/defined-clas... ]

 

But for motor control I guess CDC-ACM (ie "UART") will be just fine.

 

Last Edited: Thu. Jun 10, 2021 - 11:17 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:
So if you want a board with an AVR that has an easy USB connection to a PC then just buy an Arduino. A $3-$5 "Uno" is probably the easy place to start.

+1

 

And that also gives you access to the vast wealth of Arduino examples, tutorials, shields, etc available on the interwebs.

 

An alternative might be an Xplained-Pro/Mini/Nano or a Curiosity Nano - which gives you the added benefit of a debugger:

                           PCB
                          ...............................................
                          :                                             :
                          :     Debug Adapter        Microcontroller    :
+------+                  :    +-------------+      +---------------+   :
|      |       USB        :    |             |      |               |   :
|  PC  +<=====================>+USB      UART+<====>+UART           |   :
|      |                  :    |             |      |               |   :
+------+                  :    |        Debug+<====>+Debug          |   :
                          :    |             |      |               |   :
                          :    +-------------+      +---------------+   :
                          :                                             :
                          ...............................................

See: https://www.avrfreaks.net/commen...

 

Example: https://www.avrfreaks.net/forum/xplained-mini-mega328pb

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...