CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

18F14K50 Breadboard E3 Mini Board Companion

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Regular Guy



Joined: 04 Jun 2017
Posts: 110

View user's profile Send private message

18F14K50 Breadboard E3 Mini Board Companion
PostPosted: Sun Aug 27, 2017 12:28 pm     Reply with quote

Best I could come up with. 'Companion'.

Going to have two users. Will get one E3 Mini and build one 18F board.

Am I looking for a USB 'breakout' board?

Already bought the crystal and a variety of capacitors to
time the PIC for boot loader/programming connection.
temtronic



Joined: 01 Jul 2010
Posts: 9226
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sun Aug 27, 2017 1:31 pm     Reply with quote

If you mean you want to add USB to the 18F PIC, your easy and cheap slution is to buy a USB<>TTL module. They're $2 CDN up here.No driver or PIC code, simply use the CCS functions for get/put data via 'rs232'.

Jay
Regular Guy



Joined: 04 Jun 2017
Posts: 110

View user's profile Send private message

PostPosted: Sun Aug 27, 2017 2:28 pm     Reply with quote

Thank you Jay!

This needs clarification.

Will reread section in Embedded C and email CCS if necessary.

It is supposed to connect to 2 pins on PIC to the best of my recollection.

Don't know if it's serial communication or a USB routine in bootloader.

Will figure it out.
Ttelmah



Joined: 11 Mar 2010
Posts: 19513

View user's profile Send private message

PostPosted: Sun Aug 27, 2017 2:56 pm     Reply with quote

There are both with the compiler.
The USB is bulkier, and restricts your choice of crystals to ones supporting USB operation (list in the data sheet).
A lot depends on whether you want USB on the final device. Using an external board reduces code size on the PIC, and some of the devices now can be bought for no more than the connectors will cost.
For instance, I've been using these:
<http://www.ebay.co.uk/itm/CH340G-RS232-Upgrade-To-USB-TTL-Auto-Converter-Adapter-STC-Brush-Module/252424791118?ssPageName=STRK%3AMEBIDX%3AIT&var=551277424711&_trksid=p2060353.m2749.l2649>

They are great, since they can be jumpered for 5v or 3.3v operation (the chip supports both voltages), give a simple 5pin interface (there are two extra pins if you want RTS/CTS), and honestly you could not build the USB connector and tracking for the money.....

The chip is directly supported in the current releases of Windows, Linux and the Mac. For me (in the UK), these take about a week to come, and the price includes shipping.
Regular Guy



Joined: 04 Jun 2017
Posts: 110

View user's profile Send private message

PostPosted: Sun Aug 27, 2017 8:15 pm     Reply with quote

Thank you Ttelmah,

When I read the section on building your own board, I came away with
the impression that all that was needed was a breakout board or a USB
connector if you are going to solder up a board.

Maybe I'm wrong. Will look into it some more tomorrow.

If it's just two pins on the PIC for serial, does timing make that big a
difference? Seems like the program should ought to be robust enough to
handle that. Just run on the internal clock.
Ttelmah



Joined: 11 Mar 2010
Posts: 19513

View user's profile Send private message

PostPosted: Mon Aug 28, 2017 2:37 am     Reply with quote

A PIC as a minimum, needs supply decoupling closer to the chip, a stable supply, good grounds. Then possibly an MCLR circuit, and an oscillator.

Now 'timing'. The internal oscillators are generally only just good enough for serial, and not good enough for USB (USB requires a clock that is accurate to 0.25% for 'full speed' operation). However some of the PIC's support 'ACT' (active clock tuning), where they can trim their internal oscillator to match an external USB source. Your chip does not support this, so a crystal is required. If you look at section 2.11.2 in the data sheet, it covers this.

Now USB also requires a bus sense connection unless the device is being powered from the USB. This is a commonly 'missed' requirement, and without this, you will have problems if Windows enters any of the power managed modes. So minimum connections are the D+, D-, bus sense, and ground.
Serial requires RXD, TXD and ground.
Serial typically allows a total timing error of about 5% from one end to the other. This though is the _total_ from clock errors, divider errors etc.. Because a PC will itself have some error, it is usually reckoned that you should keep your error to less than perhaps 3%. The internal oscillator is warranted to give better than +/-2% over 0 to +60C, going up to +/-3% if the temperature gets up to 85C, and +/-5% for -40C to +125C. So generally good enough for serial at 'room temperature', but not reliably good enough if you are designing for something to be used outdoors, or inside a car for example.
Also with USB, you have to be very careful on the board layout. The impedance of the PCB tracks has to be a close match to the USB bus, and have relatively limited lengths, if you are not to suffer from signal problems. It is not a 'solder up a board', and be reliable connection.....

Now the big one though is _code size_. Your chip is quite small. The USB bootloader, compiled for your chip uses over 1/3rd of the ROM. The serial bootloader uses less than 8%. Using the external USB to serial board, you have the advantage of USB connection, without the cost of code space to do this on the chip itself...
Regular Guy



Joined: 04 Jun 2017
Posts: 110

View user's profile Send private message

PostPosted: Mon Aug 28, 2017 2:31 pm     Reply with quote

Thank you Ttelmah

Okay.

I will reread the manual and see if it calls for a USB connector only.

Got the part about USB being troublesome about timing.
Ttelmah



Joined: 11 Mar 2010
Posts: 19513

View user's profile Send private message

PostPosted: Mon Aug 28, 2017 2:40 pm     Reply with quote

The basic USB connection, just requires a connector, but it forces upon you other decisions to support USB operation. Clock, one other pin, a couple of resistors (if you are not powering the PIC off the USB), the placement of this connector, and a lot of code.....
Regular Guy



Joined: 04 Jun 2017
Posts: 110

View user's profile Send private message

PostPosted: Mon Aug 28, 2017 2:48 pm     Reply with quote

Here's the schematic.

http://www.ccsinfo.com/pdfs/e3mini-schematic.pdf

Okay. Just looked through parts and do have the 12 mhz crystal.

Plus a range of cap's from 6 to 33 pf for adjustment.

We'll see.

Have to find a breadboard USB connector or breakout board.
Regular Guy



Joined: 04 Jun 2017
Posts: 110

View user's profile Send private message

PostPosted: Mon Aug 28, 2017 2:52 pm     Reply with quote

This is my pick. It comes with instructions. That's a good thing.

http://www.gravitech.us/usbtyfebrbo.html

Looks reusable for other projects.

Little clunky using a full size USB cable but can't have everything.
Regular Guy



Joined: 04 Jun 2017
Posts: 110

View user's profile Send private message

PostPosted: Thu Aug 31, 2017 8:32 pm     Reply with quote

Okay.

These are better. At least better price.

Which kind will work and is most trouble free?

USB A

USB B

or USB Micro B?
Ttelmah



Joined: 11 Mar 2010
Posts: 19513

View user's profile Send private message

PostPosted: Fri Sep 01, 2017 1:01 am     Reply with quote

Technically on the original USB specs, 'A' is a host device. So a PC or similar device running the USB stack. Then the 'B' connectors are the 'downstream' device connectors (peripherals).
This was done to prevent you accidentally connecting two host devices together (which could cause both signal and power shorts.....).

The original spec was the standard USB connector. There was then a 'mini' connector, but this though legal is now deprecated. Then the 'micro' connector. This technically has a longer contact life that the original larger connectors!...

The idea was that you would have 'A' receptacles on the PC, and then 'B' receptacles on the remote device. Extension cables were illegal (designed to ensure the cable lengths were always compliant. Cables would always end in plugs, and devices with sockets.
However loads of variants then appeared. First devices with A plugs (little dongles etc..), which if they were not plugged directly into the host meant you had to have cables with an A plug to A socket, which people started to use as 'extensions'.

The original USB connector had a rated life of 1500 cycles. Mini USB, 5000 cycles. Micro USB 10000 cycles. This reflects the change in use of USB, with it originally designed for things like printers that you might plug in/out every few days, and now being used for things like phones that are often connected several times a day...
Mini unfortunately had a poor mechanical design and tends to fail in the socket, which is why micro is now preferred.

On micro, the 'B' is distinguished by a key. Devices can elect to have this or not. 'OTG' devices (that have the circuitry so then can be a host or a peripheral), electing not to have the key, so both types of cable can fit. Technically on a peripheral device, you should have the key otherwise things could get damaged. So the 'best' connector is a USB micro B (which will have the key).

A Micro USB B receptacle is what I'd therefore suggest.

So a device like:
<https://www.pololu.com/product/2586>

Though much cheaper variants exist.
Regular Guy



Joined: 04 Jun 2017
Posts: 110

View user's profile Send private message

PostPosted: Fri Sep 01, 2017 7:36 pm     Reply with quote

Thank you!

Here is the schematic again.

http://www.ccsinfo.com/pdfs/e3mini-schematic.pdf

Here are the USB connectors from Futurlec.

http://futurlec.com/Computer_Adapters.shtml#USB_ADAPTER_A

There are four different ones. Two have four connectors like the schematic.

Which kind is what CCS intends you to use for this circuit?
Ttelmah



Joined: 11 Mar 2010
Posts: 19513

View user's profile Send private message

PostPosted: Sat Sep 02, 2017 12:04 am     Reply with quote

USB itself has just four connections.
The fifth connection in some of the units is 'ID'. This is a pin designed for devices that can be both hosts and peripherals. It is shorted to ground on devices that are hosts.
For a peripheral device that is bus powered (which your circuit shows), you just ignore the pin. This pin is only used if you are a 'host' device.
Regular Guy



Joined: 04 Jun 2017
Posts: 110

View user's profile Send private message

PostPosted: Sun Sep 03, 2017 7:14 pm     Reply with quote

Thank you Ttelmah!

Okay. So you are saying any of them will work.

Okay. Will probably start a new post when we go to test this.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group