Atxmega128A4 USB implementation

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

I have to implement usb communication that will send out data. I have researched a lot of material, but i am still lost. 

 

So I seek for your advice and your help. 

 

thank you for you help.

 

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

You're going to have to provide some more detail before anyone here can even consider where and/ or how to help you...

 

  • What USB class are you trying to implement?
  • Are you trying to use a library such as Lufa?
  • Do you really need to implement true native USB or will a UART-to-USB converter such as an FT232 do the trick?
  • What have you actually tried yourself so far?
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
  • As far i understand i will need USB CDC class.
  • i tried with ASF in atmel studio, but i dont understand the procedure.
  • I will send data from sensor (I2C) communication to computer for further analysis
  • Read documentation ASF USB, and reading usb documentation (basics), and now i will dig in lufa   

 

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

Howard_Smith wrote:
Do you really need to implement true native USB or will a UART-to-USB converter such as an FT232 do the trick?

jeroncic wrote:
I will send data from sensor (I2C) communication to computer for further analysis

 

That to me does not say you absolutely must use native USB, and that you could indeed utilize a UART-to-USB conversion IC which would be far simpler. Is this one of your first embedded projects? I'm assuming it is going off the fact that

jeroncic wrote:
i tried with ASF in atmel studio, but i dont understand the procedure
doesn't point to anything in particular about what you don't understand. Many beginners attempt to take on a USB project far too soon, with the false expectation that, since USB is so widely supported and easy to use (most USB devices simply plug in and do their thing) from the consumer side of things, that it will also be easy from a developers point of view - this is absolutely not the case. If you truly want to continue down this path of using native USB, then you've got a lot of reading up to do. For one thing read up on the USB spec as a whole, and get a basic grasp for the concept of endpoints and the various different types of device class there are, then look into the class you wish to implement. My two cents though? Forget USB for now (if you are indeed just starting out in the world of AVR and/ or embedded systems) and just use some form of UART-to-USB device (or better yet just use an Arduino - already has a UART to USB bridge!)

 

Edit: typo

Last Edited: Sun. Jul 30, 2017 - 05:59 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I designed hardware for my application and my mentor at the faculty advised me to take atxmega128A4U, because it is easy to implement USB and i belived. So i am stuck with that and i am struggling to do my project. 

 

So for any advice or direction, example, reading material i will be grateful. 

 

And i am sorry for my ignorance.

 

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

jeroncic wrote:
I designed hardware for my application and my mentor at the faculty advised me to take atxmega128A4U, because it is easy to implement USB and i belived(sic). So i am stuck with that and i am struggling to do my project.
 

Okay then, well that, does suggest that you absolutely must use native USB. In truth, I've never used an AVR for native USB (tend to use STM32's these days for professional and/ or commercial projects, but still a fan of AVR's at heart) but I would recommend that, on top of getting to grips with the USB and CDC specs, you decide between using ASF or Lufa (according to the Lufa documentation it's development within the Xmega series is 'experimental' however from what I gather/ noise on 'Freaks it does work, plus you have the advantage that Dean Camera, the developer who wrote Lufa, actually has an account on 'Freaks so if you're lucky he may chime in at some point, on the other hand ASF will work however it's not well liked since it's convoluted and comes with a lot of 'bloat' since it's designed to support many different AVRs - long and the short of it? Your decision, you may want to have a bit of a 'play' with both and see what you're most comfortable with and what works for you), then simply get one of their example projects working - ensure your hardware successfully enumerates and works as expected in this manner. From here you can begin to 'hack' the example and experiment, get it to do different things - convert upper case chars to lower case and vice versa for example, or take an ASCII string forming a number and double it before returning it back to the host. Essentially get a feel for the library and how to use it. From here you can pull it into the rest of your own project.

A few things you may want to confirm first are that your hardware is correct (AVR1017 may be of use), and how you expect to send and receive data to your microcontroller (I personally would recommend Termite since it features a few handy plug-ins such as HexView that lets you transmit raw bytes as well as ASCII data.)

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

i tried with ASF in atmel studio, but i dont understand the procedure.

How did you try?  There is an ASF Example project STDIO USB EXAMPLE that sets everything up for you.  The example is for the 256A3BU, but should work with the 128A4U with a little tweaking.  

Greg Muth

Portland, OR, US

Atmel Studio 7.0 on Windows 10

Xplained/Pro/Mini Boards mostly

 

 

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

Maybe you could use my USB code.  I presume you want C.  Mine is C++ but I think I can give you a C to C++ interface.

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

I would appreciate if you can send me your code.

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

I imported ASF usb, clock,... to my project and follow the quick start guide.

Thank you for your suggestion i will try to tweak it.

And thank you all for you support and advice, i really appropriate it.

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

Here's my USB.  the project contains a simple demo USB echo function that will echo key presses from a PC terminal emulator.

 

I'd be interested to know if your PC hooks up with it okay.

 

 

Attachment(s):