USB Programming
threadz
Posts: 56
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
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.
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.
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...
Seems we can pretend that P2 is a USB HID slave and transfer data like these guys.
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.
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.
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 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.
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.
The high performance parallel FIFOs are about $8 in small quantities. USB to TTL serial are very cheap.
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.
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.