|
|
|
Re:Basic USB - Using Microchip Stack and C#.Net
|
|
Date: 2006/06/24 17:59
|
By: recursos
|
Status: Visitor
|
|
|
|
|
|
|
Oops! No reply needed... RA1, 4K7 are not on the schematic, but in the text; I just read it to fast .Rec
|
|
|
|
|
|
Re:Basic USB - Using Microchip Stack and C#.Net
|
|
Date: 2006/06/24 18:48
|
By: recursos
|
Status: Visitor
|
|
|
|
|
|
|
I just programmed the 4550. Upon power up, LED1, 2 flash very fast, after a few seconds flash alternated, later they switch off. Meanwhile Windows pops a yellow warning, USB Device Not Recognized What could it be?
Rec
|
|
|
|
|
|
Re:Basic USB - Using Microchip Stack and C#.Net
|
|
Date: 2006/06/25 09:22
|
By: recursos
|
Status: Visitor
|
|
|
|
|
|
|
It is working now. I was not sure about the USB cable connections, and put small resistors in series, just in case. (I have no PIC DEMO, I'm using a breadboard; the cable is from a digital camera, one plug had been damaged, and I cut it away). Now I tried 10R each, and it worked - hence I know that the cable is well wired, and no resistors needed any more. Next - the PC side program. Rec
|
|
|
|
|
|
Re:Basic USB - Using Microchip Stack and C#.Net
|
|
Date: 2006/06/25 15:35
|
By: ´recursos
|
Status: Visitor
|
|
|
|
|
|
|
With the hardware working, and XP asking for the drivers, I installed them, run the demo software, and everything worked: the LEDs toggled, the "Add" added. Next I unzipped the sources, launched Visual C# 2005 Express, and double clicked "PICusbdemo.sln". Visual C# opened a "Conversion Wizard", and converted... Tried to build the solution, Visual C# complained that "unsafe code appears in compilation without /unsafe etc.". Back to ProjectProperties - General, and checked "allow unsafe code". Rebuild program, but when running, and clicking any button, I got an exception - the "mpusbapi.dll" could not be used. Added reference to "mpusbapi.dll", or rather tried to add, because Visual C# wouldn't allow me, always asking me to make sure the file was accessible or a valid COM. Any sugestion?
Rec
|
|
|
|
|
Re:Basic USB - Using Microchip Stack and C#.Net
|
|
Date: 2006/06/26 13:19
|
By: Mat
|
Status: Admin
|
|
|
Karma: 7  
|
|
| Posts: 211 |  | |
|
|
You shouldnt need to add a reference in the project. A copy of mpusbapi.dll needs to be in the same directory as the main exe, and it will find it at runtime. Let me know if that helps. Mat
|
|
|
|
|
|
Re:Basic USB - Using Microchip Stack and C#.Net
|
|
Date: 2006/06/26 13:46
|
By: recursos
|
Status: User
|
|
|
Karma: 0  
|
|
| Posts: 1 |   | |
|
Thanks Mat, it helped . My application was going to the Release folder, and mpusbapi.dll was in Debug folder. I copied it there, everything is working now. Rec
|
|
|
|
|
|
Re:Basic USB - Using Microchip Stack and C#.Net
|
|
Date: 2006/07/11 19:43
|
By: HeartRate
|
Status: Visitor
|
|
|
|
|
|
|
Hi, I'm having the same problem that Rec was having, the " USB Device Not Recognized" error. I cannot install the USB driver in Windows.
I've checked my USB physical connection and there are short packets coming over on the + and - for a short time after power-up. Using an ICD2 debugger, I see that the PIC is going into USB suspend mode (UCONbits.SUSPND = 1).
I think the next step will be to watch the USB receive and transmit registers to see if the data I'm seeing on the scope is actually making it into the registers.
Any other suggestions?
PS - I'm not using the USB supplied 5V. I'm using external 5V and 3.3V (Vusb) supplies. Also I added a pull-up on RA1 to force USB present in the firmware, but this didn't help.
PPS - Great article! It has been very helpful to me, just need to get it to work!
|
|
|
|
|
Re:Basic USB - Using Microchip Stack and C#.Net
|
|
Date: 2006/07/11 20:53
|
By: Mat
|
Status: Admin
|
|
|
Karma: 7  
|
|
| Posts: 211 |  | |
|
Give this a go, if you go into the properties of the device, via device manager, and there is an option to allow windows to put the device into suspend mode, disable this. This should stop it from happening hopefully, let me know how it goes.
Mat
|
|
|
|
|
|
Re:Basic USB - Using Microchip Stack and C#.Net
|
|
Date: 2006/07/13 15:35
|
By: HeartRate
|
Status: User
|
|
|
Karma: 0  
|
|
| Posts: 3 |   | |
|
Hi Mat, Thanks for the quick reply. I can't find any property that allows me to disable suspend. Windows is just giving me a USB Device Malfunction error, and when I attempt to install the windows driver either automatically or manually, it tells me the driver is not compatible with the device. Here are some screen shots from windows:
 http://www.skifreakz.com/images/USB_DNR.jpg
 http://www.skifreakz.com/images/USB_Help.jpg
 http://www.skifreakz.com/images/Device_Prop.jpg
More information for you. I'm using a PIC18FL4455 instead of the 4550. The main difference appears to be memory size. I've tried a fresh PIC. I've made a new USB cable and eliminated a connector pair. I've varied supply voltages. All with the same result. I'll spend more time with the ICD2 debugger today. Yesterday I tracked down some Error Interrupts were being flag. I need to better understand when they are being asserted
|
|
|
|
|
Re:Basic USB - Using Microchip Stack and C#.Net
|
|
Date: 2006/07/13 15:49
|
By: Mat
|
Status: Admin
|
|
|
Karma: 7  
|
|
| Posts: 211 |  | |
|
Hi,
Thanks for the screenshots. I would normally expect the device to appear under other devices in device manager. Regretably these issues are hard to locate. One thing which is worth checking is the config bits, if you could give me a screen shot of the configuration settings I might be able to help further.
There are normally two reasons, either it is a hardware fault, or the oscillator is setup wrong.
Mat
|
|
|
|
|
|
Re:Basic USB - Using Microchip Stack and C#.Net
|
|
Date: 2006/07/13 17:24
|
By: HeartRate
|
Status: User
|
|
|
Karma: 0  
|
|
| Posts: 3 |   | |
|
Hi Mat, Thanks again for your time! I think you may be right about the config bits. I did notice that when I loaded your project into MPLAB, some of them seem incorrect (meaning that for some reason MPLAB didn't read in the config bits correctly). I didn't touch the PLL/clock config bits, so they could be wrong. So you know, I am using a 20MHz clock oscillator connected to OSC1, not the crystal you are using in your schematic.
Here are the config bits from MPLAB:
 http://www.skifreakz.com/images/CFG_BITS.JPG
Thanks!
Post edited by: HeartRate, at: 2006/07/13 18:25
|
|
|
|