Author Topic: 18F2550 and USB  (Read 18917 times)

0 Members and 1 Guest are viewing this topic.

Offline JTR

  • Regular Contributor
  • *
  • Posts: 107
  • Country: au
Re: 18F2550 and USB
« Reply #25 on: February 17, 2014, 12:45:59 pm »
and a schematic is available at http://rkeducation.co.uk/images/Schematics/rkpk28schematicsheet1.jpg.

What an awful circuit. 3.3V regulator taps off the 12V output and not the 5V output. No diode across the 7805 to protect against USB power > input terminal. No cap on Vusb, wrong crystal speed (for USB) on circuit diagram.

OK, I'm going to stop now.
 

Offline Skimask

  • Super Contributor
  • ***
  • Posts: 1433
  • Country: us
Re: 18F2550 and USB
« Reply #26 on: February 17, 2014, 12:59:39 pm »
After a longer brake from this mess, I finally obtained a development board for the 18F2550, it is the RKPK28.
Guess what!
None of the examples work, and the site of that dev board is dead!

The pickit2 programs the board, but nothing happens, widows don't give any signs of activity, not even an unknown device. Nothing, as if I plugged the usb cable in a brick.

I am out of ideas here, what else can I try to get ANY usb example to work.

http://www.picbasic.co.uk/forum/showthread.php?t=5418
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 DajgoroTopic starter

  • Frequent Contributor
  • **
  • Posts: 322
  • Country: hr
    • hackaday.io
Re: 18F2550 and USB
« Reply #27 on: February 17, 2014, 04:29:56 pm »
As for the USB - have you connected D+/D- to RC5/RC4?

I did that now, when the website finally decided to come up again.
I got the thing without any instructions whatsoever.

Ok, I now soldered the two wires, and progress! Now I get an unrecognized usb device for every example!

Also, it came with a 16MHz ceramic filter, and not with a 10MHz crystal.

What an awful circuit. 3.3V regulator taps off the 12V output and not the 5V output. No diode across the 7805 to protect against USB power > input terminal. No cap on Vusb, wrong crystal speed (for USB) on circuit diagram.
OK, I'm going to stop now.
Indeed, if I want to turn the thing off, I have to unplug the usb.
No Vusb? So I have to add even that?

Is this a dev board or a figure it out yourself board?

Anyway, what is the right frequency for most of the examples? 20MHz, 4MHz?

Edit: That USB demo doesn't work on win 7.


Edit2: I fixed the thing, and tried this demo (20MHz osc, and added vusb cap):
http://projectproto.blogspot.com/2009/11/pic18f2550-usb-hid-mouse.html

Of course, I just get an unknown device...
« Last Edit: February 17, 2014, 05:00:47 pm by Dajgoro »
 

Offline David_AVD

  • Super Contributor
  • ***
  • Posts: 2863
  • Country: au
Re: 18F2550 and USB
« Reply #28 on: February 17, 2014, 08:42:32 pm »
An "unknown device" error can be the D+ and D- wires swapped. or one of them shorted to 0V.  Might not be the case here, but worth checking.
 

Offline DajgoroTopic starter

  • Frequent Contributor
  • **
  • Posts: 322
  • Country: hr
    • hackaday.io
Re: 18F2550 and USB
« Reply #29 on: February 17, 2014, 09:23:05 pm »
An "unknown device" error can be the D+ and D- wires swapped. or one of them shorted to 0V.  Might not be the case here, but worth checking.
I checked once again, it is ok.
 

Offline diyaudio

  • Frequent Contributor
  • **
  • !
  • Posts: 683
  • Country: za
Re: 18F2550 and USB
« Reply #30 on: February 17, 2014, 09:57:02 pm »
Quote from: Dajgoro
is there a very simple usb demo that is known 100% that it works with a schematic, hex files and fuse settings?

Hi,

Some time ago, about two years ago I successfully got a PIC-4550 to run the USB microchip stack see attachment (I developed a novel 4 channel multimeter (client written in C# .NET) to measure AAA batteries), I must say the USB stack was challenging to get working and it still is cause so much can go wrong and its very bloated (to run all the families using one build)

Here are some tips (things I did as to get my project working)

1) Use the demo supplied example code, unmodified, try out the CDC basic demo its a simple USB to SERIAL demo and it works ! (in fact I used that as a skeleton for my project as I was unable to move, USB library dependences to a custom directory, I used the demo, with all the correct includes )

2) Have you installed the microchip "mchpcdc.inf" driver ?? You must install this driver else no USB communication is established. it comes with the SDK read the demo setup documents.

3) Breadboard a test fixture, as the members already  probably described check your connections, I had issues with D-, D+ not making contact with the pins of the PIC resulting in communication issues, so check that out.

4) If you use the " CDC basic demo" you don't need to compile, the SDK comes supplied with the HEX file (pre-built), I would recommend you learn to recompile "tear it apart" and strip it down for one family, like a PIC 4550, 2550 so its bit bit cleaner. (I did this cause at the time I was learning that processor)
 
 

Consider this, it took two weeks to get this working and it was fun and $#e%$# at the same time. :)

Good luck.


   
« Last Edit: February 17, 2014, 10:10:49 pm by diyaudio »
 

Offline Anks

  • Frequent Contributor
  • **
  • Posts: 252
  • Country: gb
    • www.krisanks.wordpress.com
Re: 18F2550 and USB
« Reply #31 on: February 17, 2014, 10:12:35 pm »
I got the microchip and the DP open source stack to work recently and even ported part of the code to another pic. I lost a hard drive and due to the pain I wont be doing it again.

Im just going to use a different micro for usb in future.
 

Offline diyaudio

  • Frequent Contributor
  • **
  • !
  • Posts: 683
  • Country: za
Re: 18F2550 and USB
« Reply #32 on: February 17, 2014, 10:19:46 pm »
I got the microchip and the DP open source stack to work recently and even ported part of the code to another pic. I lost a hard drive and due to the pain I wont be doing it again.

Im just going to use a different micro for usb in future.

Yeah I saw that one. never used the DP stack yet, The microchip forum is filled with people complaining about the usb bloat. 

I prefer now using a FTDI for serial stuff it just works. I have never used the USB protocol.
 

Offline DajgoroTopic starter

  • Frequent Contributor
  • **
  • Posts: 322
  • Country: hr
    • hackaday.io
Re: 18F2550 and USB
« Reply #33 on: February 18, 2014, 12:16:04 am »
Aaaaaaaaaannnnnnnnnnddddddddd, nothing!  :-BROKE

I installed the sdk and demo pack a long time ago when I first tried poking with the thing.
I tried the CDC demo, once again, and nothing.
MPLAB X changed his mind, and now it won't recognize the libraries of the examples once again.
I managed to fix that a while ago, but Mplabx changed his mind once again.

About mchpcdc.inf, I've tried to install it once again, but how do I install that, installing via windows just gives me a big error.
 

Offline daveshah

  • Supporter
  • ****
  • Posts: 356
  • Country: at
    • Projects
Re: 18F2550 and USB
« Reply #34 on: February 18, 2014, 09:19:18 am »
Also, it came with a 16MHz ceramic filter, and not with a 10MHz crystal.
I seem to remember having a lot of trouble with a PIC-based USB device that used a ceramic resonator rather than a crystal not being recognised (not sure whether the problem was accuracy or stability), so if you have a 16MHz crystal available you could try replacing it.

I think I got the aforementioned device working in the end on an older laptop running Windows XP, so that might be another option.
 

Offline abyrvalg

  • Frequent Contributor
  • **
  • Posts: 837
  • Country: es
Re: 18F2550 and USB
« Reply #35 on: February 18, 2014, 10:26:05 am »
I would recommend this simple tool http://www.uwe-sieber.de/usbtreeview_e.html to separate bus level errors from OS/inf/driver problems - if you don't see your correct vid/pid/speed there, then no need to waste time on PC side, your device is unable to send device descriptor to be recognized
 

Offline DajgoroTopic starter

  • Frequent Contributor
  • **
  • Posts: 322
  • Country: hr
    • hackaday.io
Re: 18F2550 and USB
« Reply #36 on: February 18, 2014, 04:00:12 pm »
I would recommend this simple tool http://www.uwe-sieber.de/usbtreeview_e.html to separate bus level errors from OS/inf/driver problems - if you don't see your correct vid/pid/speed there, then no need to waste time on PC side, your device is unable to send device descriptor to be recognized
I ran the program, and I got this:
Code: [Select]
    =========================== USB Port4 ===========================

Connection Status        : Device failed enumeration
Port Chain               : 6-4

      ======================== USB Device ========================

        +++++++++++++++++ Device Information ++++++++++++++++++
Device Description       : Unknown Device
Device ID                : USB\VID_0000&PID_0000\5&4A9E079&0&4
Driver KeyName           : {36fc9e60-c465-11cf-8056-444553540000}\0060 (GUID_DEVCLASS_USB)
Legacy BusType           : PNPBus
Class                    : USB
Service                  :
Enumerator               : USB
Location Info            : Port_#0004.Hub_#0006
Manufacturer Info        : (Standard USB Host Controller)
Capabilities             : Removable, RawDeviceOK
Address                  : 4
Problem Code             : 43 (CM_PROB_FAILED_POST_START)
Power State              : D3 (supported: D0, D2, D3, wake from D0, wake from D2)

        ---------------- Connection Information ---------------
Connection Index         : 0x04
Connection Status        : 0x02 (DeviceFailedEnumeration)
Current Config Value     : 0x00
Device Address           : 0x00
Is Hub                   : 0x00 (no)
Number Of Open Pipes     : 0x00 (0)
Device Bus Speed         : 0x00 (Low-Speed)

        ------------------ Device Descriptor ------------------
bLength                  : 0x00 (0 bytes)

Edit: On the other hand, I am using a Pickit2 for programming the thing, and in there is the 18F2550, and the pickit works fine.

Edit2: As I already wrote, I replaced the filter with a 20MHz crystal to suit the demo.
I have a stack of crystals, so I can set it to any frequency, depending on the requirements.
« Last Edit: February 18, 2014, 04:06:48 pm by Dajgoro »
 

Offline abyrvalg

  • Frequent Contributor
  • **
  • Posts: 837
  • Country: es
Re: 18F2550 and USB
« Reply #37 on: February 18, 2014, 06:23:46 pm »
Enumeration failed, no communication at all (vid/pid/device desc size are all 0), so the problem is on device side. Your code is running (pullup gets activated, otherwise you'll not see any device attach at all), but some setup is wrong (clocking, D+/D- polarity - try swapping them just be sure, I've spent a day tweaking my first USB device being 100% sure that it has correct polarity, then swapped D+/D- desperately and it started to work :))
 

Offline DajgoroTopic starter

  • Frequent Contributor
  • **
  • Posts: 322
  • Country: hr
    • hackaday.io
Re: 18F2550 and USB
« Reply #38 on: February 18, 2014, 07:06:05 pm »
Enumeration failed, no communication at all (vid/pid/device desc size are all 0), so the problem is on device side. Your code is running (pullup gets activated, otherwise you'll not see any device attach at all), but some setup is wrong (clocking, D+/D- polarity - try swapping them just be sure, I've spent a day tweaking my first USB device being 100% sure that it has correct polarity, then swapped D+/D- desperately and it started to work :))
:rant: :rant: :rant:
 :palm:
...

Yup, the D+ D- marks on the pcb are reversed.
It works now.
At least the basic demo, still a long way to go to get a compiled code to work...
 

Offline David_AVD

  • Super Contributor
  • ***
  • Posts: 2863
  • Country: au
Re: 18F2550 and USB
« Reply #39 on: February 18, 2014, 09:55:51 pm »
See, what did I say?  There's a reason I never assume anything.  Hopefully lesson leaned.   ::)
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf