Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

USB functions with PIC18F4550

  1. Feb 17, 2013 #1
    It is my understanding that this pic chip has usb wiring ability. Does this mean i can create a very cheap burner, or that it can comunicate to a computer?

    In the case of the cheap burner being possible could i implement the chip into the circuit and then program it later (that's just an example, would probably use it to give the device updates in real life)?

    In the case of the communication would it be possible to wire it up to a flash drive and all of the data that is put into chip to then be past into the flash drive or does it need direct access to a computer?

    Or is it a case of being able to do both at different times i.e. being able to update it when i develop updates and then reconnect the flash drive to the system to continue giving information.

    Thanks in advance.
  2. jcsd
  3. Feb 17, 2013 #2
    I'm not sure what you mean by a "very cheap burner". But to connect to other USB peripherals, like a flash drive, you need it to be a USB host device.

    I have used that PIC series as a USB slave (as a serial COMM device attached to a "normal" computer" -- you should also be able to emulate a mouse or a mass storage device). But I've not used it as a host. I'm not sure if the chip has enough poot to handle all the host requirements and MicroChip's doc and examples are so convoluted that I just gave up after I got one thing working. You can find the whole doc set and software for my PIC board here:

    And somewhere on the MicroChip site they have the whole example software package along with their free C compiler.
  4. Feb 17, 2013 #3
    By cheap burner I meant programmer (couldn't think of the word at the time), I want to be able to build the project (a darts scorer) and then at a later date program in updates. However my understanding is that there is a separate programmer for the chip, and it is programmed before it is put into the circuit, so I was wondering whether it was possible using the USB function to program the microcontroller when it is still in the circuit.


    I believe that the above link does what I am thinking, however it is very limited in its explanation. I just need it confirming before I go and buy the pic chip
  5. Feb 17, 2013 #4
    Ah... To get started you will need an external programmer. I use the PicKit-2, which I think has been superseded, but it was not very expensive anyway. It connects to an In-Circuit-Serial-Programming (ICSP) connector, so you don't have to swap the PIC chip from place to place. Once you get going you can probably find some boot-loader that would allow you to program over the USB itself.

    However you could use an Arduino (which has an Atmega controller rather than a PIC) to do what you want. It's already setup with the boot-loader and has a huge catalog of programming libraries and such like.
  6. Feb 17, 2013 #5
    I currently have an arduino (Mega ADK to be exact) but because the project is supposed to be permanent I don't want to go overkill on the microcontroller as this will cause expense (the whole project is supposed to be on a budget).

    Also what is the website showing how to do, its very confusing due to the lack of instructions
  7. Feb 18, 2013 #6
    If you're building this thing as a commercial product then I guess it's a good idea to minimize the price, but if it's a one-off the amount of time you spend futzing around with the PIC will probably be way more than the cost of the cheapest Arduino. Especially since you are starting from scratch in either case...

    As to "the website", I guess you mean the link I sent for my USBPIC. It's all the information I have on a board I designed and programmed which uses the PIC chip you asked about. If you insist on using the PIC in your project, the source code linked on that page includes a working USB serial implementation.
  8. Feb 19, 2013 #7
    I am making this as a one off however I am hoping it will get me further business with different companies (so I want to create it one way even if its harder as to minimise the work I will have to do if it is succesful).

    The website I was on about was the one I listed (the one you listed I actually understood). It seems to me that it is showing how to program the chip using hardly any components. I have reposted the URL below.


    I also found this.

  9. Feb 19, 2013 #8
    Well that's a relief that you understood my page...

    Reading the edaboard page it seems that the writer used a "JDM programmer" to get something on the PIC. Googling that, turns up a socketed programmer board, so I guess they plugged their PIC into that and got it programmed and then put it on the minimal board that they built.

    I'd guess that you might be able to use the JDM to get a bootloader onto the PIC initially and then figure out how to upgrade via USB. My preference would be to get the PICkit ICSP programmer and use it for upgrades as well, but that's just me...

    You might look at the BitWhacker board which does sorta what you want:
    I was unsuccessful at reverse engineering the bootloader but you may be more tenacious.
  10. Feb 19, 2013 #9
  11. Feb 20, 2013 #10
    That programmer appears to have a standard serial port connection. First there aren't too many of those around anymore as everyone has gone USB, and second they never, AFAIK, had power on them -- the page says it gets power over the serial...

    I'm sure you could make it work, but I'd look for one that has USB. I don't know what software you'd need on the host either. You'll have to do that research yourself.

    Your schematic looks like the basic idea for getting a PIC and USB port going, presuming that whatever boot-loader you use looks at RB4.
  12. Feb 20, 2013 #11
    I actually have the port on both of my computers haha.

    I get what you are saying.I did look at the PICkit 2 that you suggested using however im not too sure how to use it, the programmers that i'm looking at all seem to have the easy plug it into computer, place mcu into slot and program but the PICkit looks more complicated than this. If you could advise how to use it then I may get that as it is supported by Microchip
  13. Feb 21, 2013 #12
    The advantage of ICSP is that you don't have to shuffle a DIP back and forth between sockets, which means you don't have to use DIPs at all. I used an SOIC package on my board -- which is half the size and still (almost) solderable.

    The Pickit has a USB i'face to the host and you can make a simple ribbon cable extender to go to your board. It comes with software for Windows, I'm not sure about others, like Linux, though.
  14. Feb 22, 2013 #13
    Would it come with an accurate description of which pins I would need to connect in order to program it then?
  15. Feb 25, 2013 #14
    I'm pretty sure you can figure it out when you get it. You can also look at the schematic for my board to see what pins are used on the PIC.
  16. Feb 25, 2013 #15
    Thanks I think that really settles all of my queries. Thanks for all the help
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook