Author Topic: Creating USB interface from scratch.  (Read 8591 times)

0 Members and 1 Guest are viewing this topic.

Offline boingaonTopic starter

  • Newbie
  • Posts: 9
Creating USB interface from scratch.
« on: December 24, 2012, 02:31:30 am »
Hello,

The "high level" prototyping boards like the ChipKit and this guy : http://www.mikroe.com/ready/pic/  make it real easy to connect the board to the PC for programming and serial communication.

However, I'm creating a new product that will need to have a USB-to-computer connection. I need to know how to form this connection from scratch since the chips that will be in the product won't have the fancy add-ons that my high level board will have.

How can I practice forming this connectivity on a high level board? Should I also buy a PicKit/handful of chips, and use them for this practice?

Thank you

-P
 

Offline TheDirty

  • Frequent Contributor
  • **
  • Posts: 440
  • Country: ca
Re: Creating USB interface from scratch.
« Reply #1 on: December 24, 2012, 04:31:35 am »
It looks like it uses a pretty common ftdi ft232rl usb->serial converter.  If you want to test with them and don't want to create a prototype board of your own just yet, just search for "ft232rl breakout".  There are plenty of breakout boards available for these.  Some of them have the simple schematic that goes with them.  You should be able to figure it out easily.  It's not a complicated chip or interface.
Mark Higgins
 

Offline boingaonTopic starter

  • Newbie
  • Posts: 9
Re: Creating USB interface from scratch.
« Reply #2 on: December 24, 2012, 04:57:52 am »
I could use the ft232rl breakout board in place of the development board's built-in USB interface?
 

Offline Skimask

  • Super Contributor
  • ***
  • Posts: 1433
  • Country: us
I didn't take it apart.
I turned it on.

The only stupid question is, well, most of them...

Save a fuse...Blow an electrician.
 

Offline notsob

  • Frequent Contributor
  • **
  • Posts: 696
  • Country: au
Re: Creating USB interface from scratch.
« Reply #4 on: December 24, 2012, 07:27:46 am »
there is also Cypress CY7C63310 or SILABS CP210x series
 

Offline andersm

  • Super Contributor
  • ***
  • Posts: 1198
  • Country: fi
Re: Creating USB interface from scratch.
« Reply #5 on: December 24, 2012, 09:59:06 am »
And Microchip's MCP2200.

Offline nctnico

  • Super Contributor
  • ***
  • Posts: 26906
  • Country: nl
    • NCT Developments
Re: Creating USB interface from scratch.
« Reply #6 on: December 24, 2012, 11:30:44 am »
It looks like it uses a pretty common ftdi ft232rl usb->serial converter.  If you want to test with them and don't want to create a prototype board of your own just yet, just search for "ft232rl breakout".  There are plenty of breakout boards available for these.  Some of them have the simple schematic that goes with them.  You should be able to figure it out easily.  It's not a complicated chip or interface.
I strongly recommend using the CP2101 USB serial converters from Silabs. The ones from FTDI are really crappy. Even the smallest disturbance causes the connection to freeze. The CP2101 is much more robust to use. This is most likely a driver issue but still...
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Offline ptricks

  • Frequent Contributor
  • **
  • Posts: 671
  • Country: us
Re: Creating USB interface from scratch.
« Reply #7 on: December 24, 2012, 01:14:40 pm »
Get a pickit 2 or 3, The 2 has the option of being used as a serial interface but you can always do that with a separate part if you want to send data over a terminal.  There are a lot of home made pic programmers , but the pickit will be the easiest to use.

For chips, the 18F4550, 18F2550 are probably the best documented USB interface pic chips. There are newer ones like the pic32 line but they lack a lot of documentation.

You can also install a usb boot loader so that the chips will update over USB.
http://www.diolan.com/pic/bootloader.html
« Last Edit: December 24, 2012, 01:19:38 pm by ptricks »
 

Offline TheDirty

  • Frequent Contributor
  • **
  • Posts: 440
  • Country: ca
Re: Creating USB interface from scratch.
« Reply #8 on: December 24, 2012, 01:40:20 pm »
I strongly recommend using the CP2101 USB serial converters from Silabs. The ones from FTDI are really crappy. Even the smallest disturbance causes the connection to freeze. The CP2101 is much more robust to use. This is most likely a driver issue but still...
I'm guessing this is an issue specifically with you?  I've never heard of the FT232RL having reliability issues and they are an commonly used chip.  It's also an old chip and the drivers are excellent with it now.  There's even default drivers on many linux distributions.
Mark Higgins
 

Offline McMonster

  • Frequent Contributor
  • **
  • Posts: 413
  • Country: pl
    • McMonster's blog
Re: Creating USB interface from scratch.
« Reply #9 on: December 24, 2012, 01:51:13 pm »
Also the availability of CP2101 is rather poor, as per a quick search in FindChips.
 

Offline nctnico

  • Super Contributor
  • ***
  • Posts: 26906
  • Country: nl
    • NCT Developments
Re: Creating USB interface from scratch.
« Reply #10 on: December 24, 2012, 03:20:22 pm »
I strongly recommend using the CP2101 USB serial converters from Silabs. The ones from FTDI are really crappy. Even the smallest disturbance causes the connection to freeze. The CP2101 is much more robust to use. This is most likely a driver issue but still...
I'm guessing this is an issue specifically with you?  I've never heard of the FT232RL having reliability issues and they are an commonly used chip.  It's also an old chip and the drivers are excellent with it now.  There's even default drivers on many linux distributions.
I use them for programming NXP's LPC controllers. The programming board is a double sided board with a solid ground plane on one side. The wires to the target are about 10cm. There is a lot of switching on/off of the target board and also switching between a terminal program and a serial programming tool. The CP2101 handles such an environment perfectly while the FTDI does not at all. I have to unplug/plug it all the time to get it going again. Despite my excellent experiences with the CP2101 I decided to use an FTDI chip for my programming board because it is easier to solder.
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Offline TheDirty

  • Frequent Contributor
  • **
  • Posts: 440
  • Country: ca
Re: Creating USB interface from scratch.
« Reply #11 on: December 24, 2012, 04:04:11 pm »
I use them for programming NXP's LPC controllers. The programming board is a double sided board with a solid ground plane on one side. The wires to the target are about 10cm. There is a lot of switching on/off of the target board and also switching between a terminal program and a serial programming tool. The CP2101 handles such an environment perfectly while the FTDI does not at all. I have to unplug/plug it all the time to get it going again. Despite my excellent experiences with the CP2101 I decided to use an FTDI chip for my programming board because it is easier to solder.

So this is a issue you've had personally and not something that's generally considered a problem.

I've used them even on single sided boards without a hitch and never heard of anyone having any recent problems with the drivers (meaning sometime within the last few years).

Mark Higgins
 

Offline boingaonTopic starter

  • Newbie
  • Posts: 9
Re: Creating USB interface from scratch.
« Reply #12 on: December 24, 2012, 07:44:25 pm »
Lots of great information here. By the way, what are the legalities in using code like that mentioned below:
http://www.diolan.com/pic/bootloader.html

inside a final product that would be sold? I can't imagine that every company creates a brand new communication interface from scratch every time they make a new product. Likely the desktop GUI... But I could be wrong.
 

alm

  • Guest
Re: Creating USB interface from scratch.
« Reply #13 on: December 24, 2012, 08:30:30 pm »
According the documentation it's licensed under GPL v3. This allows commercial use, but requires you to release the source code with any modifications you made. Not exactly a big deal for a bootloader, unless you are trying to prevent customers from uploading their own firmware. I would expect Microchip to offer a bootloader with their USB stack, although I remember the license for some of their software (eg. USB stack) to be somewhat painful.
 

Offline nctnico

  • Super Contributor
  • ***
  • Posts: 26906
  • Country: nl
    • NCT Developments
Re: Creating USB interface from scratch.
« Reply #14 on: December 25, 2012, 02:07:36 am »
I use them for programming NXP's LPC controllers. The programming board is a double sided board with a solid ground plane on one side. The wires to the target are about 10cm. There is a lot of switching on/off of the target board and also switching between a terminal program and a serial programming tool. The CP2101 handles such an environment perfectly while the FTDI does not at all. I have to unplug/plug it all the time to get it going again. Despite my excellent experiences with the CP2101 I decided to use an FTDI chip for my programming board because it is easier to solder.

So this is a issue you've had personally and not something that's generally considered a problem.
Maybe or I'm just kicking it around harder revealing problems others don't notice... Lots of products seem to work fine at first glance until you kick it in the nuts and you get a view of the real nature of the product. BTW I've had similar problems with FTDI based USB serial dongles on different computers. Its not just my board.
« Last Edit: December 25, 2012, 02:09:18 am by nctnico »
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Offline andersm

  • Super Contributor
  • ***
  • Posts: 1198
  • Country: fi
Re: Creating USB interface from scratch.
« Reply #15 on: December 25, 2012, 04:39:17 pm »
I would expect Microchip to offer a bootloader with their USB stack, although I remember the license for some of their software (eg. USB stack) to be somewhat painful.
Microchip do have their own USB bootloader, but IIRC it is a lot larger than what the Diolan bootloader documentation claims about theirs.

Maybe or I'm just kicking it around harder revealing problems others don't notice...
I've seen the odd complaint about FTDI's Windows driver. I don't remember running into the issues you describe, but I've mostly used their devices under OS X or Linux.

Offline boingaonTopic starter

  • Newbie
  • Posts: 9
Re: Creating USB interface from scratch.
« Reply #16 on: December 26, 2012, 11:09:18 am »
In response to ALM,

To abide by the GPL v3,   where to I need to put my source code? Inside the device, on the product's website, or in the product's manual?
 

Offline nctnico

  • Super Contributor
  • ***
  • Posts: 26906
  • Country: nl
    • NCT Developments
Re: Creating USB interface from scratch.
« Reply #17 on: December 26, 2012, 01:26:37 pm »
AFAIK you need to make the sourcecode available. That includes asking money to send it by mail on a medium.
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

alm

  • Guest
Re: Creating USB interface from scratch.
« Reply #18 on: December 26, 2012, 01:54:28 pm »
The easiest solution is usually to either ship it with the product if you're distributing something like a CD, or offer it for download on the product website.
 

Offline amyk

  • Super Contributor
  • ***
  • Posts: 8275
Re: Creating USB interface from scratch.
« Reply #19 on: December 26, 2012, 02:23:11 pm »
From thread title I thought you wanted to make your own USB serialiser/deserialiser... can be done for low speed and full speed with a fast enough MCU bitbanging the pins, but not high speed. (And forget about super speed...)
 

Offline poorchava

  • Super Contributor
  • ***
  • Posts: 1672
  • Country: pl
  • Troll Cave Electronics!
Re: Creating USB interface from scratch.
« Reply #20 on: January 03, 2013, 12:45:51 pm »
One thing is for sure: you definitely DO NOT want to write mcu stack or windoze driver for USD. You actually want USB to be as transparent to you as possible because otherwise it's entirely likely that you're gonna get a mental condition.
I love the smell of FR4 in the morning!
 

Offline boingaonTopic starter

  • Newbie
  • Posts: 9
Re: Creating USB interface from scratch.
« Reply #21 on: January 05, 2013, 07:02:47 am »
Thanks all for the helpful insight.
 

Offline free_electron

  • Super Contributor
  • ***
  • Posts: 8517
  • Country: us
    • SiliconValleyGarage
Re: Creating USB interface from scratch.
« Reply #22 on: January 05, 2013, 09:54:27 pm »
From thread title I thought you wanted to make your own USB serialiser/deserialiser... can be done for low speed and full speed with a fast enough MCU bitbanging the pins, but not high speed. (And forget about super speed...)
and it is compliant as a baboons ass with a rock...if you are going to make a USB phy form scratch you'll need to submit it to certification and that is VERY hard !
Professional Electron Wrangler.
Any comments, or points of view expressed, are my own and not endorsed , induced or compensated by my employer(s).
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf