Pic's With Usb Support


rabidpoobear

Member
Joined
Aug 5, 2008
Messages
978
Age
33
Location
Texas
Website
www.lukevp.com
Now before you go RAWRR RABIDPOOBEAR IS IT USB2.0 OR NOT?!?! here's why I ask the question:

I'm going to build some devices (eg. a MIDI foot controller, some human interface devices, etc.) and I'd like to use PIC's as my microcontrollers of choice.
However, I don't want to have to use a hub with it. These devices will be extremely low in power requirement so 500mA is way more than they'll need. I'm going to want to use them on stage & in the studio with just the Pandora connected to them (no power source anywhere except Pandora's battery - cuts down on the possibility of A/C hum and such, better for music-makin'.)

So possibly I could use a bus-powered hub, but for a minute let's discuss the other question.

The thing is, I don't want to be using USB-Serial crap and having to write my own client-side drivers and all this business. I just want to build an HID device I can plug directly into the Pandora's USB port.

Here's the info for the PIC I'd like to use.
http://www.microchip.com/wwwproducts/Devices.aspx?dDocName=en010300

Now here is the confusing part:
USB (ch, speed, compliance) 1, Full Speed, USB 2.0

I.E. there's 1 channel, the speed is full-speed (12 mb/s), and it's USB 2.0 compliant. However, full-speed refers to the max speed of USB 1.1, not 2.0. So the problem I'm having is deciding whether they are saying it is
1) USB 2.0 Compliant just because most USB 2.0 ports will have 1.1 chips in them too, or
2) it TRULY is 2.0 compliant (will work with a 2.0-only port like Pandora has) but that the speed is limited to Full-Speed just because it's a cheap microcontroller that can't push 480mb/s across the USB line.

So what do you guys think, can I build a device based on this microcontroller and use it on Pandora without any other adapters?

(Also if you know of a better PIC to use, perhaps with better USB 2.0 support or something, PLEASE let me know, I'm completely new to PIC's (trying to leave Arduinos to get away from the dreaded USB-Serial conversion bullcrap. An AVR with USB 2.0 support would be just fine too, do these exist?)
 

Mr B

Member
Joined
Dec 21, 2007
Messages
346
USB 2.0 Full speed is 12Mbit/s. Not exactly a uncommon description of USB 2.0 devices. The other is Hi-Speed. Actually, when a device reads "USB 2.0" and not "Hi-Speed" it's also a "full speed" at best, so if anything, these beasts are more common. So, it IS a USB2.0 chip, but it also is using USB 1.1 transfer rates. Upside, it should be compatible, and energy efficient, downside, it's not going to have as much available bandwidth... For your needs this might be enough? It should work with the Panda. Might want to get a second opinion on that tho, since i never went to deep in to what makes, or breaks the pandas USB 2.0 only compatibly .

Actually... It says so on top of the page, i noticed now, so it might be i wasn't bringing you news..."Ideal for low power (nanoWatt) and connectivity applications that benefit from the availability of three serial ports: FS-USB(12Mbit/s), I²C™ and SPI™ (up to 10 Mbit/s) and an asynchronous (LIN capable) serial port (EUSART). "
B!
 

rabidpoobear

Member
Joined
Aug 5, 2008
Messages
978
Age
33
Location
Texas
Website
www.lukevp.com
OH, I didn't realize Full Speed was part of the 2.0 spec. I'd like to get a second opinion on this (anyone?) but it sounds like I should be able to use the PIC! Thanks for the info. Yes, 12 mb/s is way more bandwidth than I need. Just gonna be sending some slider / switch states and such.
 

Tobs

Member
Joined
Oct 14, 2008
Messages
113
Location
Derby, UK
Website
Visit site
USB communication's a bitch, especially if you're doing it yourself. You might want to look at some other solution, for example I've been playing around with a Teensy the last few weeks and it's really ace. As fun as programming MCUs is, making it work with USB is a hell of a lot of work, especially if you just want to make music! On that note, have you considered midi? It's easy as hell to use...
http://www.pjrc.com/teensy/ - Teensy link. It's like $21, and there's plenty of help online for programming it/drivers.
Just read the bit at the bottom; since you're relatively new to MCU programming (other than Arduino), go with something easy like the Teensy, it's awesome. Also, soldering the pins is harder than it seems (for me at least >.>), so it might be worth shelling out the extra few bucks for pins (I broke a $15 Bumble-B this way =[
 

laurencevde

Member
Joined
Nov 17, 2008
Messages
270
Location
Enschede, The Netherlands
USB-2.0 full-speed == USB-1.1
You can blame the USB-IF for allowing people selling usb-1.1-devices as usb-2.0 full-speed... Marketing-reasons and junk like that...
usb-2.0 high-speed uses a different modulation-technique than usb-1, and implementing and switching between both requires extra complexity and power-consumption...

At least, that's what I understood about it.
 

yannv

Still Fresh
Joined
Dec 27, 2007
Messages
74
Laurencevde said:
USB-2.0 full-speed == USB-1.1
You can blame the USB-IF for allowing people selling usb-1.1-devices as usb-2.0 full-speed... Marketing-reasons and junk like that...
Worse actually, you can blame USB-IF for requiring it. They only permit certifying your products against the latest spec. And AFAICT, no, Pandora can't talk directly to full speed devices on the host port. You'd have to use a translator (hub), the OTG port, or the Ext port (non-USB). Or, of course, a high-speed capable chip like the Atmel SAM3U or FTDI FT2232H, but their most hobby friendly packages are LQFP.
Edit: There is a slight difference between 1.1 and 2.0 full speed, but it's basically a structure version bump.
 
Last edited by a moderator:

WizardStan

Mega GP Mania
Joined
May 24, 2008
Messages
16,733
You can also consider Cypress MCUs. I've never actually used one, but when I was asking about High-Speed USB microcontrollers, these came up as a recommendation. The CY7C68013A-100AXC seems to be pretty good for $10. The Atmel chips are probably cheaper though, and I suspect easier to program. You can get one from Digikey for under $5.
Yeah, it sucks that Microchip hasn't made a high-speed PIC yet. I'd be all over that like a fat kid on the last slice of pizza, which I usually am anyway.
 

rabidpoobear

Member
Joined
Aug 5, 2008
Messages
978
Age
33
Location
Texas
Website
www.lukevp.com
WizardStan said:
You can also consider Cypress MCUs. I've never actually used one, but when I was asking about High-Speed USB microcontrollers, these came up as a recommendation. The CY7C68013A-100AXC seems to be pretty good for $10. The Atmel chips are probably cheaper though, and I suspect easier to program. You can get one from Digikey for under $5.
Yeah, it sucks that Microchip hasn't made a high-speed PIC yet. I'd be all over that like a fat kid on the last slice of pizza, which I usually am anyway.
That's pretty cool. Wonder what "automotive qualified" means... is that to do with the heat? or the reliability?
I am pretty confident in my ability to solder so I could probably do that chip, but I am a lot less confident in my ability to etch PCB's for SMD stuff, so the Cypress chips aren't really an option for these projects, I think.

Glad I asked you guys, this USB 2.0 business is really depressing. It's not too big of a deal to just connect to the On-The-Go port with a cable adapter, I guess I'll just do that. Would it be a bad idea just to use a mini-A to mini-B cable (b side on the microcontroller, a side on the OTG, putting Pandora in Host Mode)?

Tobs said:
USB communication's a bitch, especially if you're doing it yourself. You might want to look at some other solution, for example I've been playing around with a Teensy the last few weeks and it's really ace. As fun as programming MCUs is, making it work with USB is a hell of a lot of work, especially if you just want to make music! On that note, have you considered midi? It's easy as hell to use...
Yeah, midi as a protocol is fine, but I don't like straight-up MIDI (with the 5-pin ports, etc.) Not many computers have MIDI, and I don't really like the connectors that much (sorta bulky) so while I could just do MIDI with an adapter (they sell cheap cables on eBay) I'd much prefer USB - there's no latency of converting MIDI-USB, and it's more universal and less bulky. (also I can do HID joysticks and such if I am using USB, can't do with MIDI.)
Tobs said:
http://www.pjrc.com/teensy/ - Teensy link. It's like $21, and there's plenty of help online for programming it/drivers.
Just read the bit at the bottom; since you're relatively new to MCU programming (other than Arduino), go with something easy like the Teensy, it's awesome. Also, soldering the pins is harder than it seems (for me at least >.>), so it might be worth shelling out the extra few bucks for pins (I broke a $15 Bumble-B this way =[
This is pretty intriguing. Is there something like this that is maybe better but harder to use? Despite my using arduinos in personal projects, I've taken a microcontrollers class so I've developed a sensor network and other such things using low level C without Arduino lib's help, and I'm a graduate student in Computer Science, so the programming is really a non-issue. Easiness of the compilation / IDE IS a big issue, and Arduino has a decent IDE. I hate fighting with crappy tools.

That having been said, Teensy seems to have a fairly standard toolset, not as nice as Arduino but not too convoluted either. It's also fairly cheap. The only thing I wonder is - is it actually USB? not some small FTDI chip somewhere (I can't see one...?) but actually truly running off USB? So I can write HID devices for it that will work out of the box on ANY system (eg. I could hook it up to a PS3 and emulate a keyboard if I want to, right?)
Basically if any drivers are involved at all and I can't use straight HID then I'll have to go with the PIC's. Otherwise it looks like this is a good solution and not too expensive. It's too bad shipping costs so much, I guess I'll order more than one if I do order any.

Hmm, can I change what descriptors Teensy uses? Can I make it describe itself as a USB joystick or a USB keyboard or a mouse or whatever I want? Or will it always just be "generic HID device"? Also I assume you can do 2-way communication with HID, back and forth from the device to the host, is this correct?

Sorry for all the dumb questions, hardware development is somewhat new to me and I'm hating all this FTDI stuff I have to do with Arduino.
 
Last edited by a moderator:

Tobs

Member
Joined
Oct 14, 2008
Messages
113
Location
Derby, UK
Website
Visit site
Yeah I agree, FTDI sucks something terribly, especially when there's AVR chips that natively support USB (AT90USBx range for example)
As for Teensy, it's basically just an easy interface to the ATMEGA32U4/AT90USB1286's inbuilt USB support (same as how many chips natively support some form of serial comms), so you're free to do anything with it. One of the basic samples is a HID keyboard which even works on BIOS, so I'd be surprised if it didn't work on any USB compliant device.
Development's as easy as it gets for AVR chips; write code, run make, press the button on the teensy, use their tool to transfer hex to the teensy.
It's not really 'better', but it is lower level, http://www.obdev.at/products/vusb/index.html . Uses pretty much any AVR chip, but I always had issues with getting it to work reliably. It's also a pain to get code on it, since you need to use an AVR programmer to transfer code.
In my experience the teensy is a more reliable, easier to use/program USB chip.
 
Top