chipKIT® Development Platform

Inspired by Arduino™

Let's take advantage of our built-in USB!

Created Tue, 13 Sep 2011 12:43:16 +0000 by Dano


Dano

Tue, 13 Sep 2011 12:43:16 +0000

Before the Arduino UNO, all Arduinos used FTDI-chips exclusively, limiting their usage to only virtual-COMport devices. While some ChipKIT boards still have this FTDI chip on them, for those boards that have PIC32s with built-in USB I'd suggest that we take full advantage of this in MPIDE! Here's the idea:

Background Unlike the older models which use an FTDI chip, the Arduino UNO uses a second ATMega chip with integrated USB support (the ATMega8U2) to handle the USB bus. The advantage of the newer chip is that it can be reprogrammed to appear on the USB bus as something other than a serial port. It could represent itself as a keyboard, a mouse, a MIDI device, game controller, mass storage device or whatever. If you're not interested in developing computer peripherals and only intend to use the USB connection for programming and simple serial communication, then this is not really a big deal. However, if you are interested in the additional USB functionality, the UNO would be the only way to go in terms of Arduinos. However, they still didn't make it easy to reprogram the ATMega8U2, and this chip itself is a rather limited device. Not to mention, if you have changed the firmware of theATMega8U2 on an UNO to something other than it's default 'dumb' virtual-COMport mode, then if you ever want to change the firmware on the main Arduino chip, you'll need to first put the original firmware back on the ATMega8U2, update the firmware on the main Arduino chip, and then go back to your custom ATMega8U2 firmware again.

In my opinion, the Teensy - an Arduino-compatible devboard just like all our ChipKIT boards - got it right, by using a single chip rather than 2 separate chips, allowing the USB controller to be reprogrammable at the same time as the rest of the firmware. In fact, here's really slick feature that I would like to point out (bringing it up here as a possible future feature for MPIDE): The most nifty feature of the Teensy software addon to the Arduino IDE is to let users select how the Teensy board enumerates (HID/mouse, HID/keyboard, or MIDI-over-USB, for example) via a simple pull-down menu in the IDE! <quote>When you select "MIDI" from the Tools->USB Type menu, the Teensy becomes a USB MIDI (Musical Instrument Digital Interface) device, capable of sending and receiving MIDI messages.</quote> More about this is described here:

http://www.pjrc.com/teensy/td_midi.html http://www.pjrc.com/teensy/td_mouse.html http://www.pjrc.com/teensy/td_keyboard.html

I think we could do this eventually for ChipKIT boards as well (at least those that have PIC32s with USB controllers in them), and it would be a really nice thing to have in my opinion!

Dan


KM6VV

Tue, 13 Sep 2011 17:23:21 +0000

OK, not quite the same, but a few years ago I implemented USB on a PIC18F4550, and found that it took about half my RAM for pointers, and a good deal of the FLASH, as I recall. Not enough room left for the 18F4620 projects I wanted to port to USB.

What's the situation with the PIC32?

Alan KM6VV


Dano

Wed, 14 Sep 2011 13:36:20 +0000

Hi Alan,

PIC32s are in a whole different league - no worries about this kind of stuff any more!

I also made a PIC18F4550 board some years ago (2004-2005) that is actually the name-sake of the current CUI32 sold by SparkFun and the soon-to-be-sold-by-SeeedStudio CUI32Stem .... it was called the CUI, or CREATE USB Interface: [url]http://create.ucsb.edu/~dano/CUI/[/url]

There's a bit more info on the upcoming CUI32Stem here: http://www.chipkit.org/forum/viewtopic.php?p=2057#p2057 and here: http://www.chipkit.org/forum/viewtopic.php?p=2055#p2055

Cheers, Dan


KM6VV

Wed, 14 Sep 2011 17:57:04 +0000

Hi Dan,

Well maybe I can get a bit more USB mileage out of the PIC this time! Thanks for the links.

Alan KM6VV


datamafia

Thu, 05 Jan 2012 21:08:37 +0000

Hello,

I am all in on getting the USB MIDI in line. I just got my Max32 and I am ready. (I am a programmer, new to the PIC/Arduino however).

So far I have 10 hours looking for code/libs/etc to get USB MIDI with no serious luck.

In using other PIC chip systems I know the power, but the Arduino, even on powerful chips, seem lacking, unsupported, and no more than a cute hobby PCB - nothing I would use professionally for music (my goal).

Any pointers/tips are super welcome as I am very dedicated to proving myself wrong.

Thanks in advance - I am going to continue to look....


GeneApperson

Fri, 06 Jan 2012 00:39:18 +0000

In using other PIC chip systems I know the power, but the Arduino, even on powerful chips, seem lacking, unsupported, and no more than a cute hobby PCB - nothing I would use professionally for music (my goal).

My opinion is that the Arduino/chipKIT MPIDE software is hobbyist level and mostly a toy. I wouldn't use it for any professional software development. It is trying to grow up, but is a long way from anything I would use to build a professional product.

The hardware is fine, though. (I'm a bit biased, since I designed it). For professional development, I would have no problem with using the Uno32 or Max32 hardware with the Microchip MPLAB IDE and PICkit3 development tools to build just about anything.

Gene Apperson Digilent


Jacob Christ

Fri, 06 Jan 2012 02:25:14 +0000

My opinion is that the Arduino/chipKIT MPIDE software is hobbyist level and mostly a toy. I wouldn't use it for any professional software development. It is trying to grow up, but is a long way from anything I would use to build a professional product. Digilent

What would you consider not a toy? Hi-Tech?

I wasted two years of my life fighting Hi-Tech compiler bugs that were finally fixed in 9.66 (PIC18).

The chipKIT gcc compiler seems much more robust than Hi-Tech and I've spent about $2000 less on it. Also, since it is open source, I can fix the compiler bug if I run into any and don't have to wait on Hi-Tech (microchip).

Jacob


datamafia

Sat, 07 Jan 2012 18:49:04 +0000

Thanks for the response. Please take my negativity with a grain of salt. As is common in my life, what I want to do is just outside of my reach and not represented by others.

I use other hardware based USB MIDI connections via PIC16/32 and other similar chipsets. The reliability and performance is extraordinary, I understand the potential and Arduino has that potential. The middle-ware required to run (damn near all) Arduino is not an option adding latency to my control. (MIDI over USB is required - most people use MIDI over Serial to OSC or similar middle ware sniffing ports. Plug and play is required especially to release to contemporaries for review)

I have purchased the Arduino to explore ideas specifically to create a proof of concept methodology that stands to illuminate the masses with regards to the work I do.

So I have found the USB MIDI C++ libs (and other associated libs) for the PIC32 chip on the Max32. I am setting up a Windows box to run the software, am I going down some dark road? The point of entry for this code is here:

-edit in url for post- microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=2680&dDocName=en537044

As I look over the code I am definitely put in check. I am still confident as Arduino is pretty robust.

Thoughts? warnings?

And thx!

Finally - in overcoming a few of these hurdles - like HID/USB MIDI PnP will open up the market significantly for Arduino and what you are doing. The burgeoning laptopism/controllerism field is exploding and the innovations come from the players (see Monome). Arduino is the desirable platform -- so close -- but not close enough.

--Marc


Dano

Tue, 07 Feb 2012 08:19:50 +0000

@Marc - I'm with you 100% - it would be very cool to make an extension to MPIDE that would allow end users to easily create customized MIDI-over-USB controllers, by doing something similar to the Teensy approach: http://pjrc.com/teensy/td_midi.html

Not sure if this Teensy MIDI-over-USB implementation is open source or not, or whether or not it will become a part of the official Arduino IDE once the Arduino Leonardo 'grows up' ... but for example, an extension to MPIDE that would literally allow people to call these same functions (as currently made available to Teensy users, but obviously with the "back end" supported by Microchip's USB framework instead) could be quite nice indeed!

Cheers, Dan

ps. Another idea (geting off topic a bit here since this thread is devoted to taking advantage of USB), would be to slap one of Microchip's $23 Wifi modules ( http://www.microchip.com/wwwproducts/Devices.aspx?dDocName=en548014 ) on, and then attempt to port rtpMIDI (MIDI-over-Wifi) along with Bonjour for auto-discovery etc... would be extremely slick for those wishing to control apps on their iPads, etc. But of course if wireless doesn't matter, iOS does already support MIDI-over-USB via the USB adapter for the iPad/iPhone (that Apple calls their 'camera connection kit').