Progress updates:
I was able to upload the FPGA configuration (ulpitest.rbf), but was not able to check the result yet because of lack of time.
SPT file format (ITI1480A.spt):
A serie oh chunks composed as follows:
- 'CSPT' magic
- 4 bytes (int, probably unsigned): Chunk length, magic included
- 0x20 0x00 0x00 0x00 0x00 0x00 0x00 0x50 0xa0 0x70 0x00 0x00 0x6c 0x65: I believe this contains usb transfer struct and understood it once without writing it down... and forgot it since then. Shame.
- 2 bytes (half int): Address to start writing at on device
- 0x0f 0x00 0x00 0x00
- 4 bytes (int, probably unsigned): data length, so == [chunk length] - 32
- x bytes: Data
Note: When address is 0xe600 (CPUCS register address), payload controls cpu reset state, so separates programs in file.
I could recompose an IHX file from it and both upload it to device and disassemble it with dis51 (in multiple steps as it is not aware of interrupt trampolines, even less of auto interrupt tables as used for usb and i2c in EZ-USB chips). Also, it lacks many special function register names - but nothing is impossible with a good doc at hand.
Here is the protocol sructure as I reverse-engineered it (take this with a grain of salt, as I didn't check most of this experimentaly):
Note: Packets must always be long of 64 bytes, pad when necessary.
Endpoint: 1 (BULK OUT, max packet size 64B)
Structure (in tree-ish representation of):
- 1 byte: command
0x00: FPGA
- 1 byte:
0x00: start configuration (reset FPGA)
0x01: send configuration data
- [61 bytes]: configuration data
- 1 byte: actual configuration data length (should be 61 until last configuration send in typical use)
0x01: Stop capture
0x02: Get status (return value = 1 byte, meaning unknown yet)
0x03: Pause/Continue capture
- 1 byte:
0x00: continue
0x01: pause
Capture data should flow through endpoint 2 (0x82) in the same format as usb file.
Plans:
- rewrite current trial-and-error code into something maintainable (done)
- publish code (done)
- write a udev script taking care of firmware uploads (done)
- design a way for userland to control device and generate ".usb" files (done)
- provide a way to browse ".usb" files under linux (improve .NET support in wine, ...?)
Many thanks to ITI for their approach to software (free - as in beer - and allowing/tolerating reverse engineering for interoperability).