GettingStarted with USB

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

Hi freaks, I need to write a driver for a USB keyboard.  I however have not a clue on how to do this.  I' not familiar with USB.  Could anyone recommend a good book on USB?  The target device is a SAMA5D44 AR processor.

 

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

e

Doing magic with a USD 7 Logic Analyser: https://www.avrfreaks.net/comment/2421756#comment-2421756

Bunch of old projects with AVR's: http://www.hoevendesign.com

Last Edited: Mon. Jun 24, 2019 - 09:05 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello,    The SAMA5D44 ARM is about the most powerful and complex embedded-systems processor made by MicroChip.  If you don't have a clue about USB, then it is not likely that you will be able to write a driver for a USB ke-yboard for this CPU in the amount of time that your boss/team leader/professor has allotted for its design.  By the way, is this driver supposed to run on the PC and link the SAMA5D44 to the PC, or is it supposed to run on the SAMA5D44 and allow you to plug keyboards and mice into it?  Which begs the question: Are you just connecting keyboards and mice, or flash-drive memory sticks, or even streaming high-speed devices like cameras?

 

Are you using the SAMA5D44 on an XPLAINED demo board from Microchip?  If so, then this board has three USB ports: one that connects the XPLAINED to the PC [USB as a device], and two that let you plug in standard USB peripherals into the XPLAINED board [USB as a host].

 

Generally when you ask for elementary-level help on USB, you get told by the helpful experts to 'just' read 3000 pages of advanced electronic-engineering level technical reference pages, and all your questions will be answered for you.  They even so kindly give you a URL reference that takes you directly to a private little corner of technical reference hell.   The good news is that if the person who assigned you to create a USB driver knows that you don't know anything about USB and still gave you the assignment, then they don't know anything about USB either.  You can stall them until you can find someone who actually does know something about USB. 

  

  By the way, did they give you any budget (meaning money that you can spend) for the development of the USB interface for this uncommon CPU?  So that you could pay someone who does know USB to teach you exactly what you need to know?  Or, most likely, do they expect YOU to just read the 3000 pages of advanced techno-babble for FREE, and deliver a working solution by tea-time as if this were no more complicated than figuring out the TX and RX of a UART?

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

Hello Simonetta,

 

I want to learn USB, Its not for work or Uni but my own personal endeavours. So basically I want a good Embedded Book on USB, I'm looking at a couple but I'm not sure if they go down to the hardware, unlikely.

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

Click Link: Get Free Stock: Retire early! PM for strategy

share.robinhood.com/jamesc3274
get $5 free gold/silver https://www.onegold.com/join/713...

 

 

 

 

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

While attending USC in the USA, I bought a USB
keyboard for $15 USD but I only know how to USE it.

 

--Mike

 

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

This is the reference I use: https://www.bookdepository.com/Universal-Serial-Bus-System-Architecture-Don-Anderson/9780201309751

You might be able to find it floating around the interwebs.

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

I am in no way a usb expert, but maybe you could look for a code example for the processor you are using that HOSTs USB HID?  I am assuming this processor you are using will be the USB host, and not a device, so your USB controller will have to handle the device type during enumeration etc.

 

Not a simple task by any means.

 

Simonetta wrote:
Generally when you ask for elementary-level help on USB, you get told by the helpful experts to 'just' read 3000 pages of advanced electronic-engineering level technical reference pages, and all your questions will be answered for you. 

Well, I would not go that far, BUT I would suggest the the OP read the section of the 3000 page datasheet on how the USB section of the processor works, THEN start looking at the creation of the driver(s) needed.  This should narrow down teh amount of reading from 3000 pages to about....say.....1000? cheekydevil

 

Seriously though I would look at what the section in the datasheet says about the USB controller.  I would also search Github and see if someone has already done this and shared their work.  Even though the OP may want to roll her own driver, it does not hurt to take someone elses code out for a test drive to see how things work.

 

JIm

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

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

There’s already an open source driver for this peripheral as well as most of the peripherals in this chip.

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

cheers guys

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

d

 

Doing magic with a USD 7 Logic Analyser: https://www.avrfreaks.net/comment/2421756#comment-2421756

Bunch of old projects with AVR's: http://www.hoevendesign.com

Last Edited: Mon. Jun 24, 2019 - 09:05 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

GitHub - atmelcorp/atmel-software-package: Atmel Software Package that might be on a BSD 2-clause license.

Couldn't locate the USB HID host though did locate its USB HID keyboard emulator (USB device-side)

 

"Dare to be naïve." - Buckminster Fuller

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

Fianawarrior wrote:
So basically I want a good Embedded Book on USB
The Jan Axelson bible. For example Dean Camera wrote the most excellent "LUFA" based mainly on a knowledge of the Axelson book(s).

 

Having said all that, in this day and age when you buy silicon you usually expect (for USB and other complex peripherals) the silicon vendor to supply support code. Atmel/Microchip have both ASF3 and Start. I would be utterly astonished if that did not already include a USB HID driver.

 

This is kind of the point in the modern software engineering age (as also typified by "Arduino" in the AVR8 world) that more and more the chips come with "software building blocks" so that the system integrator doesn't have to worry themselves about learning timers or UARTs or USBs or whatever. They are free to concentrate on the implementation of their system design as the components already have software support.

 

if you like you now spend you time learning APIs not silicon registers. It's about the same amount of effort but you arrive at a higher level.

 

The ultimate form of this perhaps (in embedded) is Linux. The silicon vendor almost certainly supplies a BSP for Linux capable silicon so you don't actually get anywhere near the hardware or anything in the Ring0 code. All your work is isolated into application space.

 

This is 2019 not 1979 remember!

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

Out of curiosity, how difficult is it to build a USB Stack compared to a TCP/IP stack?

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

Depends what level you want to take that "stack" to. Also are you talking about just device or host. Linux for example has EHCI etc. but these things are host support. (which is quite a lot more complex than device).

 

Ultimately, in an OS, applications are going to want things at the level of something like libusb

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

Depends on your experience! USB is probably easier in that the host runs the show whereas in tcp you have to negotiate comms between masters.
With usb host, it has to manage the connect/disconnect lifecycle of each connected device. The host hardware does a fair amount of the work. I’d suggest the challenge might be more in understanding the operation of the hardware and its quirks - the linux kernel driver for the sama5 comes from Atmel so there’s probably a lot of inside knowlege used. Regardless of the operating system, the code required will be much the same, so i’d be looking at the Atmel code rather than starting from scratch. Along with the reference i mentioned earlier, that should give you enough info to make a start.

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

Thanks lads, the SAMA5D44 comes with a software frame work that should help get me started.