SEQ EEPROM test Build

Hey Guys,

I’ve put together a test run of my program that exports to the EEPROM. I’m putting a “quick dirty” version up so you can tell me what you think. I don’t want to release it until the EEPROM support is completely finished with all the bugs worked out.

Jim suggested I do a write up on the process i used to do the export.

The export has eleven steps.

Step 1.

First the com port is checked to verify that an SSC-32 is connected with the correct firmware loaded.

Step 2.

The program reads 16 bytes of the EEPROM starting at address 256. It’s looking for “LynxmotionSSÿÿÿÿ” This is the beginning of the header i used so that the program could know how many sequences are on the EEPROM without reading every pointer table entry. If this header is not found it asks the user to continue and then writes a clean header.

Step 3.

The program reads 16 bytes of the EEPROM starting at the address 272. These 16 bytes are split into 128 bits and are then the program does a string query starting with the MSB. The first zero found determines the address of the last pointer used for a sequence.

Step 4.

If the the program found a zero in the first bit then it chooses the write address of the new sequence(288, the first open byte after the header). Otherwise the program reads the last pointer and gets the address of the sequence it corresponds to. Then it reads the first three byte of the sequence to get the number of servos and steps contained in that sequence. Using this information it calculates how many bytes the sequence uses. Where N equals the number of steps and M equals the number of servos in the sequence, M*3 + 2+(M+1)*N + 5 = the byte size. This gives the write address of the new sequence.

Step 5.

The program converts the user created Sequence, steps containing angles for each servo and times for each step, to a format usable by the EEPROM(steps containing pulses for each servo).

Step 6.

The EEPROM sequence header is built from the converted data and is added to the Byte Array.

Step 7.

The EEPROM servo/speed list is built from the converted data and is added to the Byte Array.

Step 8.

The EEPROM pulse/time list is built from the converted data and is added to the Byte Array.

Step 9.

The Byte Array is written to the EEPROM using the address previously calculated. To ensure that the writes are as fast as possible the starting address is looked at and the number of byte equal to the difference between the address and the nearest multiple of 32 is written. Then the remaining bytes in the Byte Array are written to the EEPROM in 32 byte sections.

Step 10.

The Pointer Table in the first 256 bytes of the EEPROM is updated with the address of the new sequence.

Step 11.

The Program header in the first 32 bytes after the pointer table is updated to include the new sequence.

Notes

All sequences are written in order from lowest to highest starting at zero.
Not a single byte is wasted by the write process.
There are no timeouts during the process yet to prevent hanging if the SSC-32 is disconnected during the export.

Let me know what you think
lynxmotion.com/images/files/firmware/eepromtest.zip