electronics forum

Rules | Recent posts | topic RSS | Search | Register  | Log in

stuck writing code for pic side of usb project


Post new topic  Reply to topic    EDAboard.com Forum Index -> Hobby Circuits and Small Projects Problems -> stuck writing code for pic side of usb project
Author Message
jackson15j



Joined: 18 Nov 2004
Posts: 4


Post18 Nov 2004 12:44   

stuck writing code for pic side of usb project


Hello everyone, just a quick question. I'm making a project to allow any PIC to link to a USB host controller to a windows pc (2k or xp). At the moment, I'm just testing my windows drivers with the PIC16C745 connected through usb. It enumerates fine, but I 'm having problems trying to figure out how to reprogram the pic to talk over the usb cable.

Can anyone help me or give me any advice on how to write a usb header file (which doesn't use the usbHID driver information), for my pic, so I can move away from this pic and implement my cypress controller.
Back to top
btbass



Joined: 20 Jul 2001
Posts: 1187
Helped: 113
Location: Oberon


Post18 Nov 2004 13:03   

stuck writing code for pic side of usb project


check out 'beyondlogic.org' for info and sample c code for usb.
Back to top
jackson15j



Joined: 18 Nov 2004
Posts: 4


Post18 Nov 2004 15:34   

Re: stuck writing code for pic side of usb project


I was looking at this site previously, but have found a few interesting points. The stage I'm at now needs an analyzer to read whats been passed up and down the usb cable between the pic and pc. Is there anywhere that just releases a basic software analyzer, or is this a hardware only solution.

thank you for your help so far btbass Smile
Back to top
btbass



Joined: 20 Jul 2001
Posts: 1187
Helped: 113
Location: Oberon


Post18 Nov 2004 16:48   

Re: stuck writing code for pic side of usb project


Here you will find tools to test your usb device, (it used to be called usbcheck?)
h**p://www.usb.org/developers/developers/tools/
If you search about, I think there is a program called 'snoop' which can capture the usb transfers. Attached is a program to help you write usb descricpters.



Sorry, but you need login in to view this attachment

Back to top
jackson15j



Joined: 18 Nov 2004
Posts: 4


Post18 Nov 2004 17:41   

Re: stuck writing code for pic side of usb project


I've found an analyzer from www.sourcequest.com/, it seems to be working pretty well. I have a hid mouse demo running on the pic at the moment, and have tested it with the analyser. Both with a generic hid driver and my modified host controller driver.

Hopefully, I'll be able to get my cypress controller some time next week to sit between the pic and pc. However, I'm still try to find the information on writing the PIC side. I'll keep working on this altough I'll be away for a while so I apologise if I'm slow to reply. (I'll also try the tools you've told me about)

thanks again for the help btbass Smile[/url]
Back to top
nex



Joined: 24 Mar 2004
Posts: 71
Location: Tarnaveni, Romania


Post18 Nov 2004 20:29   

Re: stuck writing code for pic side of usb project


jackson15j wrote:
Can anyone help me or give me any advice on how to write a usb header file (which doesn't use the usbHID driver information), for my pic, so I can move away from this pic and implement my cypress controller.


Hi,

An ideea... Modify the original code ! There's ASCII character commands, try to add yours... I did, but not burn in silicon... I've changed some pins to have PORTB free, and some others pins to implement some handshake (RD, RW, ALE). I hope that soon I-l test that Smile

Cheers !
Back to top
checkmate



Joined: 25 Feb 2004
Posts: 489
Helped: 35
Location: Toilet Seat


Post19 Nov 2004 16:25   

Re: stuck writing code for pic side of usb project


I did my USB debugging over the serial port. You may meet some problems as the usb port is very much faster than the serial one, but it's generally still doable without an expensive protocol analyzer. I used the USBN9604 btw, with custom written drivers.

Since you managed to get enumeration working, 90% of the job is done, and you should be able to use any of the software usb sniffers then.
Back to top
Google
AdSense
Google Adsense




Post19 Nov 2004 16:25   

Ads




Back to top
jackson15j



Joined: 18 Nov 2004
Posts: 4


Post19 Nov 2004 16:36   

Re: stuck writing code for pic side of usb project


thanks for all the help everyone. Unfortunately I can only work on this a few times a week, as the pic's are not mine, but I'll keep reading up and hopefully I'll get a little further ahead. Smile
Back to top
amalassem



Joined: 19 Nov 2004
Posts: 13


Post19 Nov 2004 21:13   

USB with Visual Bacic or C#


Hi,
I have a project that needs me to interface between the Visual basic and the USB drive. So I can send to it number of bytes and receive some.
I need to be able to verify my reciption of those bytes and put the in the user inteface like text box.
I did before for the serial port 232 but I need it now urgently for the USB with any language like C++, C#, Vb.Net or VB6 .
Can anybody help me.
Amal Ibrahim
Back to top
checkmate



Joined: 25 Feb 2004
Posts: 489
Helped: 35
Location: Toilet Seat


Post19 Nov 2004 22:20   

Re: stuck writing code for pic side of usb project


USB is nowhere near as simple as interfacing the serial port. All USB devices need drivers. For some devices like mice and thumbdrives, they use generic drivers that come with the OS. Most of the time, usb devices need customised drivers.

Thumbdrives use the Mass Storage Driver. It makes the thumbdrive appear as a virtual drive that you can mount. If you want to change this behaviour, you'll have to write a driver for it, not merely access through an application.

But for your case, why not just do a simple file I/O to a file on the thumbdrive?
Back to top
vasureddym



Joined: 07 Jan 2005
Posts: 51


Post08 Jan 2005 8:59   

stuck writing code for pic side of usb project


hi btbass!
beyondlogic got good resources on USB but i couldn't find any C codes. can you help me out!!
-srinivas
Back to top
Arabic versionBulgarian versionCatalan versionCzech versionDanish versionGerman versionGreek versionEnglish versionSpanish versionFinnish versionFrench versionHindi versionCroatian versionIndonesian versionItalian versionHebrew versionJapanese versionKorean versionLithuanian versionLatvian versionDutch versionNorwegian versionPolish versionPortuguese versionRomanian versionRussian versionSlovak versionSlovenian versionSerbian versionSwedish versionTagalog versionUkrainian versionVietnamese versionChinese version
Post new topic  Reply to topic    EDAboard.com Forum Index -> Hobby Circuits and Small Projects Problems -> stuck writing code for pic side of usb project
Page 1 of 1 All times are GMT + 1 Hour
Similar topics:
need guidelines to start writing PIC code in C ? (8)
Stuck on a capacitor project. (3)
College project ideas,stuck for ideas! (4)
Challenge for DOS USB driver writing (2)
Free Tool kits for writing device drivers for USB 2.0 (1)
writing Application programs for USB bridge cable driver. (2)
writing C code for 8051 (2)
Microchip USB Pic 18F4550 source code? (10)
Tutorial,Code,Sample ,Project...in Hi-tech Pic C (1)
writing code for mobile interfacing (30)


Abuse || Administrator || Moderators || Support us || sitemap
topic RSS