USB Programming

threadzthreadz Posts: 43
edited October 12 in Propeller 2 Vote Up0Vote Down
Seeing as the P2 has USB support, will the startup ROM have support to program it over USB, perhaps mimicking a usb-to-serial adapter?

Comments

  • 16 Comments sorted by Date Added Votes
  • While the hardware to do such is there, we would need to develop the ROM code to operate it for that purpose. Currently, we just support serial loading.
  • How much space is unused in the ROM?
  • We're using just over 2KB of a 16KB ROM.

    There is plenty of space for lots of software, and it can be updated with a single-layer mask.

    Proving USB would take some time.
  • I really think it would be a good time investment because it would do away with the need for a USB to serial IC and bring down the prices of any kits sold, making it more accessible.

    Plus, one less thing to think about on the user end.
  • threadz wrote: »
    I really think it would be a good time investment because it would do away with the need for a USB to serial IC and bring down the prices of any kits sold, making it more accessible.

    Plus, one less thing to think about on the user end.

    I agree. It should do USB and serial, both.

    There are some formalities, perhaps, to getting a USB ID from the USB foundation. Someone here offered us some ID once that they weren't using.

    We could have the USB code in a flash chip, too. No absolute need for it to be in ROM, though that would be better. Then, there's always the issue of reset and power-down with software-driven USB.
  • RaymanRayman Posts: 8,303
    edited October 12 Vote Up0Vote Down
    Maybe could be easy if willing to use a second P2 as the programmer?

    Just put Garryj's USB HID boot protocol in ROM. At boot, it looks for a keyboard. If it finds a keyboard it waits a moment for special series of keystrokes to initiate download (or signal connection to programmer or signal to reboot). After that, keystrokes represent programming data.

    The programmer P2 device would have serial interface to PC and USB keyboard slave interface to P2 being programmed.

    Then, all your P2 system needs is a USB port in order to be programmed.

    That could work, right? It's complicated, but I think we already have everything we need to do it...


    Never mind, that was a crazy idea...
    Prop Info and Apps: http://www.rayslogic.com/
  • threadzthreadz Posts: 43
    edited October 12 Vote Up0Vote Down
    I was thinking more along the lines of the P2 tells the computer it's an already existing model of USB to Serial converter. That way no special drivers are needed and existing software on the computer end doesn't need to be rewritten.
  • is 64 kByte/s fast enough?

    Seems we can pretend that P2 is a USB HID slave and transfer data like these guys.
    Prop Info and Apps: http://www.rayslogic.com/
  • jmgjmg Posts: 10,482
    edited October 12 Vote Up0Vote Down
    threadz wrote: »
    I really think it would be a good time investment because it would do away with the need for a USB to serial IC and bring down the prices of any kits sold, making it more accessible.

    Plus, one less thing to think about on the user end.

    Hmm, whilst nice, USB needs too much code space to fit on top of everything else, and it is far too early in development to place into hard-coded ROM.

    However, there MAY be a way....
    Suppose Chip talked with OnSemi, and between them they managed to get OTP or MTP memory...


    This then allows a series of P2 parts with a CHOICE of Bootloader :)

    Just like other vendors have part codes for Serial / i2c / USB loaders** / (CAN / LIN / SD ?) , Parallax could do exactly the same with P2.

    The price impact of a Bridge chip is not kit-significant. (eg CP2102N is just over $1).
    With those, you get a fast UART that can be used for DEBUG, and you have drivers done.

    **addit:

    With USB loaders, possible choices could be (one of) HID, CDC or MSD device.
    Some vendors have Development boards using MSD, where the target device appears as a Flash Disk.
  • Rayman wrote: »
    Maybe could be easy if willing to use a second P2 as the programmer?

    Just put Garryj's USB HID boot protocol in ROM. At boot, it looks for a keyboard. If it finds a keyboard it waits a moment for special series of keystrokes to initiate download (or signal connection to programmer or signal to reboot). After that, keystrokes represent programming data.

    The programmer P2 device would have serial interface to PC and USB keyboard slave interface to P2 being programmed.

    That could work, right? It's complicated, but I think we already have everything we need to do it...


    Never mind, that was a crazy idea...

    It's actually not completely crazy, if you add Debug Step/Break into the mix.

    P2 is a total overkill for USB-Bridge use, both in price and physical size. You can do that, for just over $1, in 3mm x 3mm :)

    That said, if you need fast debug links, with minimal pin impact, then a UART is not quite good enough.
    Many vendors do have Special Debug Bridge parts that give a VCOM port, and manage the Reset/Debug with measurements.

    Maybe not on the first module, but I would not discard the idea entirely.
  • threadz,
    I was thinking more along the lines of the P2 tells the computer it's an already existing model of USB to Serial converter.
    That would be great wouldn't it.

    But that implies the P2 announcing itself with a vendor id and device id of some existing manufacturer who has registered and perhaps paid for those ids. That means all kind of legal trouble with the USB Mafia.

  • For some reason I though USB-to-Serial chips were like 8$ in bulk. But if that's not true then there is no price issue and it comes down to are we willing to do it.

    I think it would be beneficial for debugging. Once a program uploaded over USB as if it was a serial port, then the pins could go into "float" mode making it look like it was unplugged, and then reconnect and act like a USB to JTAG interface for debugging.

  • threadzthreadz Posts: 43
    edited October 12 Vote Up0Vote Down
    Heater. wrote: »
    But that implies the P2 announcing itself with a vendor id and device id of some existing manufacturer who has registered and perhaps paid for those ids. That means all kind of legal trouble with the USB Mafia.

    I though there were some generic USB devices with general purpose drivers anyone can use as long as they stick to the specifications. Does ever USB mouse manufacturer need a different VID and DID and to write their own drivers? That sounds unmanageable.
  • threadz wrote: »
    For some reason I though USB-to-Serial chips were like 8$ in bulk.

    The high performance parallel FIFOs are about $8 in small quantities. USB to TTL serial are very cheap.
    Feel the need for speed between your PC's com port and Prop?
    Try the FTDI 245 and the FullDuplexParallel Object.

    Check out my spin driver for the Parallax "96 x 64 Color OLED Display Module" Product ID: 28087
  • threadz wrote: »
    I though there were some generic USB devices with general purpose drivers anyone can use as long as they stick to the specifications. Does ever USB mouse manufacturer need a different VID and DID and to write their own drivers? That sounds unmanageable.

    There are HID and CDC parts, and those are generic, and not of great performance.

    However, the P2-USB code to date I think has been tested on P2_USB-Keyboard & P2_USB-Mouse, which is USB-Host, and some distance from HID/CDC.


  • cgracey wrote: »
    ...
    We could have the USB code in a flash chip, too. No absolute need for it to be in ROM, though that would be better. Then, there's always the issue of reset and power-down with software-driven USB.

    I see OnSemi list these in their ONC18 :
    Non-Volatile Memory
    OTP – One Time Programmable
    Sidense 1.8/3.3 V gate-rupture
    1k-bit array and 256 k-bit array
    In field programming capable
    EEPROM – No additional masks or processing steps
    Vector: Up to 64 bits supported
    Internal Charge Pump provided


    Issues with USB boot will be
    a) 'What Xtal' ? - UART allows autobaud, and boots fine off RCFAST, but USB will need to enable the PLL, and know the Crystal/osc modes the PCB needs.
    ( I don't think the PLL can lock to the RCFAST ? (pity) )

    b) What Std ? - HID, CDC, MSD ... ?

    All of that points to ideally a Parallax factory loaded boot, with a part-code that says what the default is (as other vendors do) - unless you program the external boot, in a two step process.


    Checking on connected memory - A quick update of memory prices gives :
    SPI FLASH
    FT25H04S-RT 4MBIT 120MHZ 8SOP 27,500 - stk $0.14883 @ 3000
    FT25H16S-RT 16MBIT 120MHZ 8SOP 5,000 - stk $0.20460 @ 3000
    i2c EEPROM
    CAT24C16WI-GT3 EEPROM 16KBIT 400KHZ 8SOIC 15,000 -stk $0.11221 @ 3000
    FT24C16A-USG-T EEPROM 16KBIT 1MHZ 8SOP 12,500 - stk $0.11253 @ 3000
    Interesting that SOT23 is more expensive than SO8..
    FT24C16A-ULR-T EEPROM 16KBIT 1MHZ SOT23-5 12,000 - stk $0.18755 @ 3000
    FT24C64A-ULR-T EEPROM 64KBIT 1MHZ SOT23-5 0 $0.21313 @ 3000

    To allow a safer USB boot, it may be possible to secure part of the Serial flash device ?
    Block Protect Secure on those SPI parts, seems to be top-block down, but they do have whole-chip-erase protections.
Sign In or Register to comment.