USB pins

For questions and comments on programming in general. And for any items that don't fit into the forums below.

Moderators: Benj, Mods

Post Reply
User avatar
achillis1
Posts: 347
Joined: Thu Oct 09, 2008 9:19 am
Has thanked: 91 times
Been thanked: 8 times
Contact:

USB pins

Post by achillis1 »

Hello,

If I use the USB component of a PIC (16F877A, 18F4550) which are the pins and ports used for it?

Thank you in advance,

Best Regards,

Andreas Achilleos

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: USB pins

Post by Benj »

Hello,

The 16F877A does not have the USB functionality.

The 18F4550 has 3 pins on port C which are used for USB comms.

These pins are marked on the Flowcode chip diagram.

D+ - USB D+ Signal
D- - USB D- Signal
Vusb - USB regulator output - connects to an external 220nF capacitor between Vusb and ground.

As well as the USB signals you also have to use a supported oscillator configuration. My advise is to use a crystal with one of the following frequencies. Any frequency can be used, the microcontroller will still run at the same speed 12MIPs.

Compatible crystal frequencies - 4MHz, 8MHz, 12MHz, 16MHz, 20MHz

Configuration settings for the device should be loaded as seen here:
http://www.matrixmultimedia.com/resourc ... %20PIC.pdf

And here is the link to the Article
http://www.matrixmultimedia.com/article.php?a=363

User avatar
JohnCrow
Valued Contributor
Valued Contributor
Posts: 1367
Joined: Wed Sep 19, 2007 1:21 pm
Location: Lincolnshire
Has thanked: 364 times
Been thanked: 716 times
Contact:

Re: USB pins

Post by JohnCrow »

Hi Andreas

The 16F877A does not have USB built in.

The 18F4550 is on port C, not sure which pins without looking in the datasheets though.
You should be able to see it by viewing the chip pinout in flowcode though.
If using the E-block the information should be on the data file that goes with that too.

Remember to use a 4MHz crystal, setup the advanced settings and change flowcode frequency to 48MHz
There are posts that cover setting up in some depth on this forum
Regards John
1 in 10 people understand binary, the other one doesn't !

User avatar
JohnCrow
Valued Contributor
Valued Contributor
Posts: 1367
Joined: Wed Sep 19, 2007 1:21 pm
Location: Lincolnshire
Has thanked: 364 times
Been thanked: 716 times
Contact:

Re: USB pins

Post by JohnCrow »

Looks like we posted almost at the same time:)
1 in 10 people understand binary, the other one doesn't !

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: USB pins

Post by Benj »

Sorry John must have just beat you to it, looks like you answer has more info anyway.

Cheers for posting :D

User avatar
achillis1
Posts: 347
Joined: Thu Oct 09, 2008 9:19 am
Has thanked: 91 times
Been thanked: 8 times
Contact:

Re: USB pins

Post by achillis1 »

Thanks a lot!!!

Yes, sorry about the 16F877A!

I did searched about usb connection to find a previous topic but I must be blind :)


John says to use a 4Mhz crystal, can't I use the 20 Mhz?

Never the less I have a ready made board with 18F4550 and built in USB adaptor so I think that for the moment I will not be bothering with crystals!

Thanks again!

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: USB pins

Post by Benj »

Hello,

You can use any of the following crystal frequencies.

4MHz, 8MHz, 12MHz, 16MHz, 20MHz

I have also been informed that you can set the config setting to use the 20MHz option and then use the standard 19.6608MHz crystal we supply on our hardware. This seems to work reliably but I wouldn't recommended it for actual wholesale products.

User avatar
achillis1
Posts: 347
Joined: Thu Oct 09, 2008 9:19 am
Has thanked: 91 times
Been thanked: 8 times
Contact:

Re: USB pins

Post by achillis1 »

!!! why not use it for actual wholesale products?

By the way, does your products pass for the CE marking?

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: USB pins

Post by Benj »

I wouldn't use the 19.6608 MHz crystal for wholesale products as it is out of tolerance for the device. E.g. it is not the 20MHz crystal specified and while it may work in one offs there may be problems with mass markets and slightly less tolerant USB host hardware.

Yes all of our products are CE approved.

User avatar
achillis1
Posts: 347
Joined: Thu Oct 09, 2008 9:19 am
Has thanked: 91 times
Been thanked: 8 times
Contact:

Re: USB pins

Post by achillis1 »

Ok, Thanks BEn!

Post Reply