New to AVRFreaks; USB Controller Project

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

Hello,

 This is m y first post here; i think that this forum is a great place! I was directed here from a friend of mine that freqents this place regularly. My project falls into another category than what he is used to working on and so he said i should contact some of you great people.

 

I am hoping that i can get some help with a project that i would like to complete. I am trying to build a usb game controller that does not involve the "Arduino". I have made many projects with the Arduino and am looking to be a little more professional with this project. I think the Arduino is a great tool; but i would like to become a little more professional with my work. I have programmed a few projects with PIC's before; but nothing very complex. 

 

If anyone has any tips on where to start or anything i would be greatly appreciative. Below is my project outline and thoughts so far:

 

Demands: 17 Buttons, 2 analog Joysticks, USB connect to computer, Have device recognized by the computer when plugged in, Possibly develop a driver to go with it.

 

1. Determine what will be the most suitable microcontroller for this. 

  • i have made the controller with arduino micro. Should i try the ATMega chip on there without the arduino bootloader?
  • What do i need to take into account for this?

 

2. Figure out what i need to get started programming this thing

  • I think that i can find this info easily enough. Any recommendations on the best ISP to use?
  • Just use the free software?

 

3. Help With the Coding

  • I would like to learn as much as possible while completing the project but need some help. I haven't the slightest clue where to start with this one.
  • I can figure the simple things out like blinking and buttons but i have no idea where to start with the USB talking and making sure everything will work smoothly.

 

Any thoughts would be welcome. Sorry if this is already posted somewhere. I tried to search game controller on here but found nothing.

 

thanks!

Jeff

Last Edited: Tue. Jan 7, 2020 - 02:48 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Who says Arduino is not "professional" ?

 

You have posted in the AVR UC3 forum;  that's the 32-bit "AVR" - not the 8-bit Mega, Tiny, or XMega.

 

Did you mean to do that?

 

[moderator: for the time being I've move this to "General Programming" but it could move again when the implementation details are more specific]

 

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: Tue. Jan 7, 2020 - 02:49 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Welcome to AVRFreaks!

MrSasquatch wrote:
I think the Arduino is a great tool; but i would like to become a little more professional with my work.

In my professional work, I use Arduino all the time, nothing wrong with a bootloader as it is cheap and provides one means to USB comms.

Look at the M32Un devices with built in USB as a start, i.e. Arduino leonardo or in dip form Arduino Pro-Micro! 

Also look at LUFA as a start to USB for AVR as well.

Good luck with your project.

Jim

 

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

At Andy's request I have moved this as it's not really about "UC3". I would suggest that you might want to look at using one of the "simple" USB micros in the AVR8 range - you basically have two choices - one of the AT90USB range of devices (meags with USB device) or maybe one of the USB enabled Xmegas. Personally I'd favour AT90USB combined with LUFA. I assume it's going to be HID class and that's very easy to do in LUFA.

 

If you do go with LUFA there are then two approaches to that - one is "standalone" that involves building with makefile's but perhaps easier is to download the LUFA extension into AS7 then use it's project wizard to create a project from the example templates.

 

As for which device, the following grep gives an idea of the models you might want to look at (see model numbers in ioXXX.h name):

C:\One\SysGCC\avr\avr\include\avr>grep -w USB_COM_vect *
iom16u2.h:#define USB_COM_vect      _VECTOR(12)  /* USB Endpoint/Pipe Interrupt Communication Request */
iom16u4.h:#define USB_COM_vect      _VECTOR(11)  /* USB Endpoint/Pipe Interrupt Communication Request */
iom32u2.h:#define USB_COM_vect      _VECTOR(12)  /* USB Endpoint/Pipe Interrupt Communication Request */
iom32u4.h:#define USB_COM_vect        _VECTOR(11)  /* USB Endpoint/Pipe Interrupt Communication Request */
iom32u6.h:#define USB_COM_vect      _VECTOR(11)  /* USB Endpoint/Pipe Interrupt Communication Request */
iom8u2.h:#define USB_COM_vect      _VECTOR(12)  /* USB Endpoint/Pipe Interrupt Communication Request */
iousbxx2.h:#define USB_COM_vect                 _VECTOR(12)
iousbxx6_7.h:#define USB_COM_vect                       _VECTOR(11)

The last two are generic headers used in the following:

C:\One\SysGCC\avr\avr\include\avr>grep iousbxx * | grep include
iousb1286.h:#include <avr/iousbxx6_7.h>
iousb1287.h:#include <avr/iousbxx6_7.h>
iousb162.h:#include <avr/iousbxx2.h>
iousb646.h:#include <avr/iousbxx6_7.h>
iousb647.h:#include <avr/iousbxx6_7.h>
iousb82.h:#include <avr/iousbxx2.h>

 

Last Edited: Tue. Jan 7, 2020 - 02:58 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello. I did not intend that the arduino is "Un-Professional". I am sorry to all that interpreted it that way. It is an amazing tool.

 

ki0bk wrote:
look at LUFA as a start to USB for AVR as well.

Thanks! i will look into this. I appreciate the tip

 

awneil wrote:
You have posted in the AVR UC3 forum;  that's the 32-bit "AVR" - not the 8-bit Mega, Tiny, or XMega.

I was looking for the ATmega32U4 since it is used on the micro and works well. I just thought it a good place to start. Is this the right place?

 

Thanks,

 

 

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


MrSasquatch wrote:
I was looking for the ATmega32U4

So that's a 'mega'  - therefore it should go in the 'mega' forum:

 

 

However, you still seem to be on "general" questions - so it might as well stay where it's been moved.

 

Once you have specific questions about a particular device, be sure to use the appropriate forum.

 

Note the summary descriptions for each forum on the forums list (as shown above),

 

Also, once you're in a particular forum, pay attention to the "sticky" posts at the top - there you will find guidance as to what's appropriate in that forum; eg,

 

 

 

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...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yup, 32U4 (especially because of the Arduino connection/support) is a good chip to choose in the AT90USB range as it has pretty much "one of everything" that you might find in the USB range of chips. It also has plenty of other resources (flash, RAM, EEPROM) to cover most development needs - you may be able to later "scale back" to one of the smaller/cheaper devices if necessary.

 

Actually a lot of people (and especially Dean when he developed LUFA) just used the AT90USBKEY which actually has an AT90USB1287 as it's the "top end" of all the AVR8 USB processors (that is non-Xmega) and has the most of everything (even USB-OTG mode) but comes in a highly featured (and cheap!) dev board in the form of AT90USBKEY:

 

https://www.microchip.com/DevelopmentTools/ProductDetails/PartNO/AT90USBKEY2

 

(having said that an Arduino with 32U4 is probably as good a place as any to start these days).

Last Edited: Tue. Jan 7, 2020 - 03:19 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

MrSasquatch wrote:
Demands: 17 Buttons, 2 analog Joysticks, USB connect to computer, Have device recognized by the computer when plugged in, ...
3 buttons on a mega16U2 :

Weeks 11-12: AVR USB Devices and Programming

MrSasquatch wrote:
Possibly develop a driver to go with it.
Which operating system(s)?

 

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

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

Thank you very much. I also noted some very good links in your signature as well.

 

I appreciate the help.

 

 

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

gchapman wrote:

Which operating system(s)?

I was starting with windows. The Arduino micro that the controller has been prototyped to shows up on the computer as "Arduino" and i am able to configure the controller from there. I was hoping for the same style of ease after a prospective user plugs the new controller in to their pc.

 

clawson wrote:
AT90USB combined with LUFA

clawson wrote:
Actually a lot of people (and especially Dean when he developed LUFA) just used the AT90USBKEY which actually has an AT90USB1287 as it's the "top end" of all the AVR8 USB processors (that is non-Xmega) and has the most of everything (even USB-OTG mode) but comes in a highly featured (and cheap!) dev board in the form of AT90USBKEY:

 

Thanks for the two hits above. Is it difficult to move from one product to the other once the code is established? Ex. Design it on an AVR8 and move to Xmega once everything is complete if needed; Or vise versa?

 

I looked up the AT90USBKEY and it looks nice. Would i just be able to program this the same as if i were pretending to program from scratch on the AT90USB1287? I mean, Other than the fact that all of the circuitry is already there, would this be a good place to start working on a program for a production style project? I am finding it difficult to articulate what i mean by this but for example with the micro i was able to create a wonderful working product but i need to do a lot to move to a production part. In you guys opinion, how close would programming this move me towards understanding and programming a standalone chip with just my controllers circuitry?

 

thanks for the help and sorry for all the NOOB questions. I have worked with microcontrollers a bit and have always been in awe of those that are handy with them.

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

MrSasquatch wrote:
Is it difficult to move from one product to the other once the code is established? Ex. Design it on an AVR8 and move to Xmega

The USB Engines are likely to be completely different - so that part is unlikely to be portable.

 

However, if you have a suitable library which supports both targets (I don't know about LUFA), it would hopefully provide a consistent interface - so that you could easily separate your "portable" part from the target-specific part.

 

It is always good to design systems that way - for that reason!

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...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

MrSasquatch wrote:
program for a production style project?
Depends what "Production" means. If you were looking to make 10, 20, 50 of the things then the $30 (is it?) cost of an AT90USBKEY per unit might be OK. If you plan to make 10,000 you probably want to find a $2..$3 micro and design your own PCB around it. You might be able to hit a BOM cost of $5 if you were lucky.

 

Of course the stupidly low silicon prices in the Far East might mean it's tempting to base a design around $5 32U4 based Arudino's in fact - you probably get most of the electronics, connectors and so on for the price.

 

Actually possibly a lot less than $5 ...  https://www.ebay.co.uk/itm/ATMEGA32U4-Pro-Micro-3-3V-5V-8-16MHz-USB-Controller-Board-Bootloader-for-Arduino/283427456652?hash=item41fd97c68c:m:mfVpD1EdHknGYw62NeClrJg

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


clawson wrote:
AT90USBKEY

Didn't this come up in another thread recently, and it seemed that nobody had stock?

 

Farnell think it's no longer made:

 

 

@ MrSasquatch : You should also check the documentation - some manufacturers prohibit using their dev kits in products ...

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...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

awneil wrote:
Didn't this come up in another thread recently

Here:  https://www.avrfreaks.net/forum/breakout-board-at90usb1286?skey=AT90USBKEY

 

Worth reading that whole thread as there's more tips about "doing USB" there ...

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...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It's a real shame if the AT90USBKEY is no longer made but I guess, like ATButterfly all things have their day and current "flavour of the month" would now appear to have "Arduino" in the name ;-)

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

MrSasquatch wrote:
I was starting with windows.
Which Windows?

Reason : WinUSB underwent a major rework for Windows 10 first RTM.

MrSasquatch wrote:
The Arduino micro that the controller has been prototyped to shows up on the computer as "Arduino" and i am able to configure the controller from there.
Arduino is USB CDC ACM for bootloader and its stack.

MrSasquatch wrote:
I looked up the AT90USBKEY and it looks nice.
So is Teensy++ 2.0

HalfKay USB HID bootloader; Arduino IDE with USB HID and USB CDC source code.

 


RTM - Release To Media (or Manufacturing)

What is new with Serial in Windows 10 - Microsoft Tech Community - 270855

by George Roussos [Microsoft]

Jul 29, 2015

...

In Windows 10, we added inbox support for USB CDC Abstract Control Model (ACM) compliant hardware. Usbser.sys is now installed as a compatible ID match for USB CDC compliant hardware, without requiring a 3 rd party driver or inclusion via modem INFs.

...

Teensy Technical Specifications

 

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

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

awneil wrote:

awneil wrote:

Worth reading that whole thread as there's more tips about "doing USB" there ...

 

Thanks for the tips and more great links. Every post from you has been valuable so far. I appreciate you taking the time to answer me.

 

I wish to quote multiple people in the same post but it is not working this time. Last post i did i was able to highlight the users text and click "quote". this time it seems that i have to respond individually. Am i doing something wrong?

 

thanks

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

clawson wrote:

It's a real shame if the AT90USBKEY is no longer made but I guess, like ATButterfly all things have their day and current "flavour of the month" would now appear to have "Arduino" in the name ;-)

 

I did have trouble finding it when i searched. I figured that i would just jump on ebay to find one. Do you think i should look for something more up to date then instead of this product?

 

It is also crazy how cheap the arduino boards are from the link. 99 cents. I couldn't even buy the blank chip here for that probably. 

 

Thank you for your help and input.

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

I suppose i will be making it for windows 10. This is what my computer is currently. That is an interesting point however. When you plug something like a Arduino micro into a windows 7 cpu does it not register?

 

I will definately look at the teensy; thanks for the links.  

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

MrSasquatch wrote:
When you plug something like a Arduino micro into a windows 7 cpu does it not register?
Usually yes though can have an intermittent defect (doesn't automatically read the Arduino Micro .INF)

 

Installing drivers | Arduino - ArduinoLeonardoMicro

Arduino Micro | Arduino Official Store

Troubleshooting common problems with the Teensy USB development board (PJRC)

[after mid-page]

Windows: Serial Driver Installed But Not Used

...

 

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

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

MrSasquatch wrote:
I wish to quote multiple people in the same post but it is not working this time. Last post i did i was able to highlight the users text and click "quote". this time it seems that i have to respond individually. Am i doing something wrong?

It's a known flaw in the forum software.

 

angry

 

I wrote a tutorial on making replies: https://www.avrfreaks.net/forum/...

 

 

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...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello;

I just wanted to add a quick update in case anybody was curious.

 

I think that from the sounds of everyone the AT90USB1286 seems to be where i could start off most effectively. 

 

We are ordering the Atmel ICE programmer

https://www.digikey.com/product-detail/en/microchip-technology/ATATMEL-ICE/ATATMEL-ICE-ND/4753379

 

Two teensy++2.0 boards. (one is a backup!). This will hopefully allow me unrestricted access to the AT90USB1286 controller that i will be focusing on. I am hoping that this can be used just as if i were to use a smd to thru-hole adapter board. If this is not the case please somebody warn me, and i will just use these adapters instead and solder my own chips.

https://www.alliedelec.com/product/adafruit-industries/1162/70460927/?gclid=CjwKCAiA3uDwBRBFEiwA1VsajPOmRkymBTZrEGpk9Vfp44m0k4vSUVrqxZ-zPWXhVockBWiLn4J4RhoCBtQQAvD_BwE&gclsrc=aw.ds

 

i also was going after a few other micro-controller chips since there were a lot of tutorials over them just to tinker around with. EX.

https://www.digikey.com/product-...

 

The future for the project will be Bluetooth to a USB dongle. How screwed will i be six months from now when i am preparing to make it Bluetooth with this setup? Is there any good Bluetooth setups to train on?

 

Thanks again everyone!

Jeff

 

 

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

You might want to search "HC-05. It seems a common choice for adding BlueTooth to AVRs

 

EDIT: for example:  https://circuitdigest.com/microcontroller-projects/hc-05-bluetooth-module-interfacing-with-atmega8-avr

Last Edited: Fri. Jan 10, 2020 - 01:32 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks! I will check it out.

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

MrSasquatch wrote:
... and i will just use these adapters instead and solder my own chips.
AT90USB1286 is TQFP64 (body 14mm-sq, 1mm thick, 0.8mm pitch) or QFN64 (9mm-sq body, 1mm max thick, 0.5mm pitch)

Schmartboard adapters would be easier to solder with pads for bypass capacitors and such.

MrSasquatch wrote:
How screwed will i be six months from now when i am preparing to make it Bluetooth with this setup?
Not, as "transparent UART" is common in Bluetooth stacks (therefore : SoC, modules)

Choose the set of operator interfaces as some aren't dual-mode (Bluetooth Classic and Bluetooth Low Energy) (my flip phone couldn't Bluetooth link to the Chromebook)

MrSasquatch wrote:
Is there any good Bluetooth setups to train on?
BBC micro:bit though you'll be porting the application from an AVR to an arm Cortex-M0.

Martyn may prefer the HM series modules (Texas Instruments Bluetooth Low Energy 8051, proprietary code though documented interfaces)

If there's a requirement for a 100m to 1km range then some Bluetooth 4 and 5 modules have an RF power amplifier.

Range by Bluetooth mesh is another way.

 


AT90USB1286 - 8-bit AVR Microcontrollers

Schmartboard|ez .5mm Pitch, 64 Pin QFP/QFN to DIP Adapter (204-0018-01) - Schmartboard, Inc.

Proto Advantage - QFN-64 to DIP-68 SMT Adapter (0.5 mm pitch, 9 x 9 mm body, 3.8 x 3.8 mm pad)

Bluetooth Modules | Martyn Currey

Qualified Mesh Products | Bluetooth Technology Website

 

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

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

thanks; good to know!

 

there should not be a requirement for the 100m to 1km range, so i think im safe there. 

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

There’s the nrf52840 dongle. Cheap and you get USB as well. Not sure if it has Arduino support.

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

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

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

Thanks,

Ill check this route out also.