View previous topic :: View next topic |
Author |
Message |
iso9001
Joined: 02 Dec 2003 Posts: 262
|
USB Pic to PC to Website/Database back to Pic |
Posted: Thu May 19, 2005 2:27 am |
|
|
Hi,
I'm thinking about starting a new project that uses a usb series pic (18F?) or a usb interface and normal pic to plug into a pc, have the user load some software, get a value from my website and get it back onto the pic.
I've never done USB before, but as I understand it, you can set it up to act like a Comm port, or you can access the device directly.
I think for this project I'de prefer the comm port approach since in a jam I could access the device on a mac or *nix machine w/o having to write new software.
Some things I'm uncertain about :
I cant think of an 'easy' way to pass data from a website into the exe then to the pic. But copy and paste will work I guess. Has anyone done this before ?
Microchip supplies the driver correct ? Both styles ?
Is it possible to use bootloader functions ? Ie: have the user download an update program that flashes the device to a newer verison? I'm guessing there is, but what I am curious about is would a usb command start the loading of a new flash? Is that a complicated algorithm ?
The problem is if this is complicated on the user end I might as well not even both, I need it to be fairly simple. Infact, Is there anyway to include the driver in so that the user doesnt have to install one ?
Thats about all, I know its kind of vague, but I'm just kicking around the idea. I don't know maybe someone has a better idea for this?
(I would do rs232, buts its becoming unavailable in new laptops) |
|
|
treitmey
Joined: 23 Jan 2004 Posts: 1094 Location: Appleton,WI USA
|
|
Posted: Thu May 19, 2005 7:35 am |
|
|
Is the PC doing anything?
If it just a go-between. Elliminate it. Put this part on your board and go from
ethernet to serial port that you pic can read.
http://www.lantronix.com/device-networking/embedded-device-servers/xport.html
This device could acually be the web site you talk about. They have one on the lantronix site acting as a web server. Take a look. |
|
|
iso9001
Joined: 02 Dec 2003 Posts: 262
|
|
Posted: Thu May 19, 2005 9:38 am |
|
|
Hmmm... I though about Ethernet, but it seems that USB is slightly more available and the customer base I'm dealing with is older. It might be a little much for me to expect them to plug this thing in that dark mysterious region 'behind' thier compuerbox.
As where with usb, well... look if you can't figure out where to plug a usb cable in, I have no support for you at all.
The website or online database will be handing them a code based on what serial number they have and after they select a few options. Pretty much has to be online at some point. Also, at some later point they can plug it back in and change options.
I figure the easiest way for me go would be to set up a usb/com emulation, have them install the driver (yikes), load the program i send this thing with, have them go onto my website, manually fill out thier options, get the code they need, paste it back into my program, hit send, and then it should be done. Some time in the future I'de like to implement a usb bootloader incase I change the code too.
But expecting older people to first load a program that comes with the device is one thing, but to expect them to also load the driver when needed!? Geez, I don't know.
It seems like there should be an eaiser way. |
|
|
treitmey
Joined: 23 Jan 2004 Posts: 1094 Location: Appleton,WI USA
|
|
Posted: Thu May 19, 2005 10:40 am |
|
|
If it is as simple as that go with the FTDI chip. It has schematics(I have used them, they work) and drivers. It allow you to have a PC talk to a USB port and then it converts that to serial for the PIC to read. FT232BM. The drivers on the PC can be the virtual COM port. SO the VB or C# just talks to the com port.
Like I said, I have 3 designes that use these,.. they work well. And the pic just see's a serial port.
http://www.ftdichip.com/Products/FT232BM.htm
http://www.ftdichip.com/Documents/DataSheets/ds232b17.pdf
no stacks, no sockets, no fooling around. Just serial baby |
|
|
iso9001
Joined: 02 Dec 2003 Posts: 262
|
|
Posted: Thu May 19, 2005 10:59 am |
|
|
I've had HORRIBLE experience with the FTDI stuff, but I'm almost certain that is because I'm using thier Java driver/wrapper. (Only works on 1 PC I have, doesn't write() on any of the others)
I'de like to keep part cost and count down. You think it would be much harder to implement the 18F USB chip? I'm reading through the sheets now, looks like windows supplies a CDC driver (for USB/RS232 emulation) you just need to include an inf with the product and it looks pretty easy. Except that you need to make a state machine out of it, but I guess thats only when the thing is in usb mode anyway.
Doesn't look too hard. Hell, I could even keep programming in Java if its just CDC/rs232 calls.
I think i read that CCS doesnt fully support it yet, but maybe that'll change soon.
What do you think ? |
|
|
treitmey
Joined: 23 Jan 2004 Posts: 1094 Location: Appleton,WI USA
|
|
Posted: Thu May 19, 2005 11:30 am |
|
|
I've had a problem with the virtual driver, but on the whole I'm happy. We now the the FTD2XX drivers with visual basic. AND with those drivers we have had 0 problems.
Just consider how all uses these now.
Inside the ICD-U40, FTDI.
Inside the microchip ICD2, FTDI.
Just my 2cents, but I would relook at FTDI. |
|
|
iso9001
Joined: 02 Dec 2003 Posts: 262
|
|
Posted: Thu May 19, 2005 1:12 pm |
|
|
Yea, I'll take another look at those.
You never tried the JD2XX Java wrapper for FTDI have you ?
Microchip must be using the FTDI in place of thier own 18F-USB chip because the IDC uP is just doing too much, I bet a state machine running all the USB stuff wouldn't program a chip using ICSP very well. Or at lease be hard to do.
You know a rough cost for the simplest FTDI chip ? |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Thu May 19, 2005 2:20 pm |
|
|
treitmey wrote: | I've had a problem with the virtual driver, but on the whole I'm happy. We now the the FTD2XX drivers with visual basic. AND with those drivers we have had 0 problems.
Just consider how all uses these now.
Inside the ICD-U40, FTDI.
Inside the microchip ICD2, FTDI.
Just my 2cents, but I would relook at FTDI. |
Microchip ICD2 doesn't use and FTDI cheap! It uses a Cypress cy7c64603 usb micro. |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Thu May 19, 2005 2:35 pm |
|
|
iso9001 wrote: | Yea, I'll take another look at those.
You never tried the JD2XX Java wrapper for FTDI have you ?
Microchip must be using the FTDI in place of thier own 18F-USB chip because the IDC uP is just doing too much, I bet a state machine running all the USB stuff wouldn't program a chip using ICSP very well. Or at lease be hard to do.
You know a rough cost for the simplest FTDI chip ? |
Just the chip $3.70
You can figure about $0.67 for a 6MHz resonator
about $0.16 for the eeprom
about $0.78 for the USB connector
and another $0.15 would cover all the cap, res, and trans |
|
|
iso9001
Joined: 02 Dec 2003 Posts: 262
|
|
Posted: Thu May 19, 2005 6:20 pm |
|
|
www.saelig.com has them for $4 - $5. I havn't found any other better prices, where do you get them mark ? |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Thu May 19, 2005 8:16 pm |
|
|
I have buyers that do that for me. I don't think there was very many suppliers in the US but I believe it was Saelig. The prices that I listed were off a bill for a product that we used (then later removed) the chip on. Also remember that I work for an extremely large company so my prices might be better than someone looking at small quantities. |
|
|
MGP
Joined: 11 Sep 2003 Posts: 57
|
|
Posted: Thu May 19, 2005 9:46 pm |
|
|
You might also look at Silicon Labs CP2102 USB-to-serial chip. It works like the FTDI FT232 but eliminates the crystal/resonator (onboard clock) and the configuration EEPROM. About $5 and takes very few external components. |
|
|
|