PIC18xxx to USB device ?


Closed Thread
Results 1 to 8 of 8

Hybrid View

  1. #1
    Join Date
    Sep 2004
    Location
    Tallinn, Estonia
    Posts
    42

    Default

    Thanks for advice! I understand that it might be difficult to programm PIC acting as an USB host. I am just wondering, could it be possible at all (does it have needed hardware ?). I know that an AVR processor has been put working with USB (Mycke Predko, the Girder device) but it did not need a host.
    Surely special chips would make life much easier. I will try this chip for sure.

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959

    Default

    Well, I've learned to "Never say Never", because some 15 year old genius will come along and figure a way to do it.

    However, everything I've found so far, says NO. There are 2 parts to the "Physical Layer" of USB.  Physical layer generaly means hardware, but since we work with PIC's, we know that many types of hardware can be simulated.  But, only 1 of those 2 components are present in any of the current PIC's.
    1. SIE - Serial Interface Engine. This is what is in a USB capable PIC chip. It's the same on both the Host and End device. So in effect, any 2 devices can communicate with each other without having a Host Controller, as long as it is NEVER actually connected to a REAL USB bus.  Being a Half-Duplex system, you are also limited to a Master/Slave arrangement.

    2. HC - Host Controller. This is the part that's lacking in PIC's. It's function goes something like this. "initiates transactions and controls access to the USB. It divides the time into “frames” and issues a start-of-frame (SOF) packet at each frame interval. In addition, it processes requests for data to and from the host and handles errors."
    That makes it sound like you should be able to simulate it in software, but I think that things just happen too fast to be able to do it all in real time. Throw on top of that the "Protocol Engine Layer" and the "Application Layer", and there's just not enough time to do it all.

    Now add the fact that the largest PIC with USB only has 16K words of program space, and you can see why I bought the USBwiz.

    Refs:
    USB Behind the Scenes: Understanding the Technology
    How USB Works


    DT

  3. #3
    Join Date
    Sep 2004
    Location
    Tallinn, Estonia
    Posts
    42

    Default

    Thanks for a very thorough answer. Exactly what I needed.

  4. #4
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,172

    Default

    Why not read the smart card directly? Don't use a reader at all?

    I've seen an example by Myke Predko (sorry on spelling if wrong), but he used his own BASIC language. He has one example using FAT16, and another just doing generic access.

    I'm still looking for an example using PIC Basic Pro though. I wanted to do this myself.

    Robert
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  5. #5
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,172

    Default

    Or, an acrobatic way around the PIC limitation of being only a slave:

    - connect PIC to PC as USB slave.
    - connect card reader to PC as USB slave.
    - have PIC tell PC to access card reader and send info back to PIC.

    Robert
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  6. #6
    Join Date
    Sep 2004
    Location
    Tallinn, Estonia
    Posts
    42

    Default

    Can't read it directly because ia wanted to have an industrial reader (nice look etc, you know). One option is of course replacing industrial readers electronics with mine (i developed code that reads ID-card directly) but ... i was just wondering if there are easier ways.

Similar Threads

  1. USB Bootloader.
    By HenrikOlsson in forum USB
    Replies: 22
    Last Post: - 2nd May 2013, 03:46
  2. Simple USB Comms Problem
    By awmt102 in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 6th January 2010, 21:17
  3. Replies: 0
    Last Post: - 6th March 2009, 08:52
  4. USB Device Not Recognized ???
    By keymuu in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 8th October 2008, 01:53
  5. usb - device not recognised
    By mpardinho in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 8th January 2007, 18:47

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts