PDA

View Full Version : USB support features of PiCs...



grimmjow
- 1st March 2011, 19:01
Hi everyone,
i am almost new at pic programming and components. There is something that i am unable to understand.
As you know 18f25xx and 18f45xx ( but i am not sure if i can assume all 18 family) have usb support. My question is "why dont other families, like 16f and 12f, have usb support?" and "why cannot we use ubs ports to program pic microcontrollers directly? why do we need another component in our porgramming kit circuit (like 18f2550 in pickit2) if its a matter for PGD and PGC 2 bits (as long as usb has 2 data bits already)?"
im sorry if these questions seem awkard.

Thnx for your care...

ScaleRobotics
- 1st March 2011, 21:12
I am not qualified to give you a real answer. But I can give you a layman's guess as an answer for the 18F, and maybe a slightly, more solid 12F answer. Have you ever programmed a 12F and run out of ram? I sure have, and that's just on a smallish program. The 16F answer is probably somewhere in between.

The 12F devices don't have enough ram and stack space to support USB communication, let alone have enough space on the die to fit USB. And if you did cram it in there, once you programmed a USB application, you would not have any room for any code in code space. Just a USB bootloader code takes about 1000 bytes or words ... not really sure, but either way, that is a lot, especially for a 1000 byte chip.

You may notice that on the 18F devices, you get something like USB, and you give up something else. A 18F4620 has a ton of code space, a 18F4550 has USB, but only ample code space. Anything Microchip adds to the silicon die, needs to have room. So they usually have to cut something. Otherwise, I am sure they would put everything including the kitchen sink on the chip. Another example, the 18F4431 has some great PWM and stepper motor capabilities. But not enough room for that and USB, and not enough room for a huge amount of memory, like the 18F4620.

These are really only my guesses, but it might give you an idea or two.

You don't really need a Pickit2, as long as you can get someone to program Microchip's USB HID bootloader onto your USB chip. But it is a good idea to have one, just in case the code somehow gets corrupted, or so you don't have to send every chip to your friend to get programmed for any new boards you make, or go to a different USB chip.

cncmachineguy
- 1st March 2011, 21:47
As for the "why can't we program directly from USB" the easy answer is there are more than just PGD and PGC. The programmer also plays with MCLR, Vcc and GND. If you look at the ICSP part of the datasheet - any datasheet for PIC's, you will see there is more going on. Walter eluded to being able to program from USB, but he is talking about bootloaders. That way it is possible, but the bootloader still needs to get in the chip somehow.

rmteo
- 1st March 2011, 21:57
....but the bootloader still needs to get in the chip somehow.
Unless you are using a chip that has a hardware bootloader built into device itself. Unfortunately, none available from MCHP.

grimmjow
- 1st March 2011, 23:39
Thanks for your answers and care, i ve read all
lets assume that we'r using Vdd, Vpp, Gnd. D+ and D- from usb port. do we still need a bootloader? because as i know bootlader is like a manual for writing program to pic. thus we can do it with using our computer via usb.

ScaleRobotics
- 2nd March 2011, 01:54
Thanks for your answers and care, i ve read all
lets assume that we'r using Vdd, Vpp, Gnd. D+ and D- from usb port. do we still need a bootloader? because as i know bootlader is like a manual for writing program to pic. thus we can do it with using our computer via usb.

Yes, we still need a bootloader to be loaded into some of the code space of the chip. Otherwise, there will not be anthing telling d+ and d- how to communicate, which registers to use, what memory to use, where to write on the chip, how to listen to the PC, etc, etc, etc. Even the PicKit is pre-programmed with code, so it can communicate and write to the chips.

It's kind of like this: Take your PC, then pull out the bios chip (can you even do that anymore?). Then try to start it up. Is it running? You still have a hard drive plugged in. All the hardware is there, but it doesn't work because nothing is telling them what to do.

Just what is it you are trying to do?

grimmjow
- 2nd March 2011, 18:36
Yes, we still need a bootloader to be loaded into some of the code space of the chip. Otherwise, there will not be anthing telling d+ and d- how to communicate, which registers to use, what memory to use, where to write on the chip, how to listen to the PC, etc, etc, etc. Even the PicKit is pre-programmed with code, so it can communicate and write to the chips.

It's kind of like this: Take your PC, then pull out the bios chip (can you even do that anymore?). Then try to start it up. Is it running? You still have a hard drive plugged in. All the hardware is there, but it doesn't work because nothing is telling them what to do.

Just what is it you are trying to do?

first of all, thank you for your care and patience.

Actually i am not trying to do something, i am just trying to understand the point of using other integrated circuits (like 18f2550) in pickit programmer. i was thinking "if we can write programs on other pics by using bootloader on 18f2550, why cant we do it by our computer? 18f2550 is just an interface on pickit programmer board and we can create this interface virtually on our computer."

but thnx to you understood the point.
thnx everyone who had spent their precious time for my questions.

ScaleRobotics
- 2nd March 2011, 18:55
i am just trying to understand the point of using other integrated circuits (like 18f2550) in pickit programmer. i was thinking "if we can write programs on other pics by using bootloader on 18f2550, why cant we do it by our computer? 18f2550 is just an interface on pickit programmer board and we can create this interface virtually on our computer."


There are some programmers that almost do this. They use the parallel port on the computer to program the chip. But it still needs a little hardware to bring the chip up to programming levels, etc.

Hopefully my bios example made some sense. Despite the chip having hardware, without code to set configure the chip, and code to tell the chip what to do with the hardware, nothing will happen.... Unless you have a programmer, like the pickit2 that puts a programming voltage to MCLR and send the bits into the chip using ICD programming port. Or load some software on the chip that sets up its hardware, and bootloader code that runs on the chip, letting it program its own code space.

And by the way, there are many older chips that do not allow programming their own code space, so these will never be able to use a bootloader, and you must program them with a programmer.

Walter