View Single Post
  #2   Spotlight this post!  
Unread 28-01-2007, 01:02
Shinigami2057 Shinigami2057 is offline
Slackware Is Your New God (Mentor)
AKA: Harry Bock
FRC #1350 (Rambots)
Team Role: Programmer
 
Join Date: Oct 2006
Rookie Year: 2006
Location: Johnston, RI
Posts: 106
Shinigami2057 is just really niceShinigami2057 is just really niceShinigami2057 is just really niceShinigami2057 is just really niceShinigami2057 is just really nice
Re: Loader Protocol: Command 09

As far as I can tell, it's basically a "row write" (think memset) command. In my implementation of AN851 0x09 is defined as IFI_WR_ROW.

It seems to write whatever number you specify to a fixed number of rows on the robot controller. Internally, it most likely erases the rows and then writes to them.

09 E0 00 08 00 00
In terms of the AN851 documentation, this would be

Code:
<0x09><LEN><ADDRL><ADDRH><ADDRU><VAL>
Where LEN is the number of rows (1 row = 64 bytes, same as in ER_FLASH) and VAL is what is to be written (0x00 in this case). So the above data represents:
Erase 0xE0 blocks (224 * 64 bytes = 0x3800 bytes total) starting at 0x000800 (to 0x004000) and write the value 0x00 to them. Then it does the same for the next 0xE0 blocks.

I have no idea why IFI implemented it, maybe they didn't like that erasing flash sets all the bits instead of clearing them?

EDIT: Looking at the other bot's data, it's a little weirder.
01 C0 7F 00 00 - set 0x007FC0 - 0x008000 to zero. This is the last row on a PIC18F8722's flash mem, this may serve a special purpose on that RC.
01 00 00 20 00 - set 0x200000 - 0x200040 to zero. This would be the user ID registers of the PIC18F. See the data sheet.
01 00 00 30 00 - set 0x300000 - 0x300000 to zero. These are the configuration registers, which are write-protected on the FRC.
10 00 00 00 00 - set 0x000000 - 0x000800 to zero. this is the boot sector of the FRC, which is where AN851 resides and is also write protected on the FRC.

Seems a little odd to me, but it all makes sense in terms of the "official" Microchip protocol.
__________________
One of the main causes of the fall of the Roman Empire was that, lacking zero, they had no way to indicate successful termination of their C programs.

Last edited by Shinigami2057 : 28-01-2007 at 03:33.