Motherboard Forums


Reply
Thread Tools Display Modes

Writing a serial number to EEPROM...

 
 





















Donner
Guest
Posts: n/a

 
      05-12-2006, 12:50 AM


Hi! I'm trying to write a serial number to a Cypress FX2 EEPROM.
have used the hex2bix method, and it worked great. But my new method i
to edit the binary file from the hex2bix, alter the serial number, an
upload the new binary file to the FX2 EEPROM.

I can find the serial number okay, and can alter it. But whe
writing to the USB device, nothing seems to happen. I have to reset th
device to reconnect, but the serial number doesn't change.

Here's the code I'm using to write the binary file.

// First shut down the processor.
ResetFX2(1);

FX2Device->ControlEndPt->ReqCode = 0xA0;
FX2Device->ControlEndPt->Index = 0;
FX2Device->ControlEndPt->Value = 0;

cur_offset = 0;
for(cur_line_num = 0; cur_line_num < num_data_file_lines
cur_line_num++)
{
length = num_chars_per_line[cur_line_num];
FX2Device->ControlEndPt->Value = cur_offset;
FX2Device->ControlEndPt->Write(data_file_lines[cur_line_num]
length);
cur_offset += num_chars_per_line[cur_line_num];
}

// Restart the processor.
ResetFX2(0);


data_file_lines consists of the lines of data from the tcxmaster.he
file. Each line is 256 bytes long (num_chars_per_line confirms this).
believe I may not be writing to the board properly (maybe the wron
addressing?) I'm not sure what's missing or how to correct it.
- Donner



 
Reply With Quote
 
nappy
Guest
Posts: n/a

 
      05-12-2006, 05:05 PM
Where are you actually writing to EE? Are you using the EERead/Write
routines that came with the Cypress firware?




"Donner" <> wrote in message
news:buGdnZm2peV8UP7ZRVn-...
> Hi! I'm trying to write a serial number to a Cypress FX2 EEPROM. I
> have used the hex2bix method, and it worked great. But my new method is
> to edit the binary file from the hex2bix, alter the serial number, and
> upload the new binary file to the FX2 EEPROM.
>
> I can find the serial number okay, and can alter it. But when
> writing to the USB device, nothing seems to happen. I have to reset the
> device to reconnect, but the serial number doesn't change.
>
> Here's the code I'm using to write the binary file.
>
> // First shut down the processor.
> ResetFX2(1);
>
> FX2Device->ControlEndPt->ReqCode = 0xA0;
> FX2Device->ControlEndPt->Index = 0;
> FX2Device->ControlEndPt->Value = 0;
>
> cur_offset = 0;
> for(cur_line_num = 0; cur_line_num < num_data_file_lines;
> cur_line_num++)
> {
> length = num_chars_per_line[cur_line_num];
> FX2Device->ControlEndPt->Value = cur_offset;
> FX2Device->ControlEndPt->Write(data_file_lines[cur_line_num],
> length);
> cur_offset += num_chars_per_line[cur_line_num];
> }
>
> // Restart the processor.
> ResetFX2(0);
>
>
> data_file_lines consists of the lines of data from the tcxmaster.hex
> file. Each line is 256 bytes long (num_chars_per_line confirms this). I
> believe I may not be writing to the board properly (maybe the wrong
> addressing?) I'm not sure what's missing or how to correct it.
> - Donner
>
>
>



 
Reply With Quote
 
Donner
Guest
Posts: n/a

 
      05-12-2006, 06:09 PM
I actually just got my code working, and discovered some interestin
pieces of information. I'm using the FX2 EEPROM writing code example tha
came from Cypress. It loads some VendAx hex program first before loadin
data to the EEPROM. It does the same as CyConsole. I think that progra
tells the Cypress chip to write to EEPROM and how to do it. I wasn'
loading the VendAx code first, so I wasn't writing to the EEPROM.
- Donner

>Where are you actually writing to EE? Are you using the EERead/Write
>routines that came with the Cypress firware?
>
>
>
>
>"Donner" <> wrote in message
>news:buGdnZm2peV8UP7ZRVn-...
>> Hi! I'm trying to write a serial number to a Cypress FX2 EEPROM.

I
>> have used the hex2bix method, and it worked great. But my new metho

is
>> to edit the binary file from the hex2bix, alter the serial number, and
>> upload the new binary file to the FX2 EEPROM.
>>
>> I can find the serial number okay, and can alter it. But when
>> writing to the USB device, nothing seems to happen. I have to rese

the
>> device to reconnect, but the serial number doesn't change.
>>
>> Here's the code I'm using to write the binary file.
>>
>> // First shut down the processor.
>> ResetFX2(1);
>>
>> FX2Device->ControlEndPt->ReqCode = 0xA0;
>> FX2Device->ControlEndPt->Index = 0;
>> FX2Device->ControlEndPt->Value = 0;
>>
>> cur_offset = 0;
>> for(cur_line_num = 0; cur_line_num < num_data_file_lines;
>> cur_line_num++)
>> {
>> length = num_chars_per_line[cur_line_num];
>> FX2Device->ControlEndPt->Value = cur_offset;
>> FX2Device->ControlEndPt->Write(data_file_lines[cur_line_num],
>> length);
>> cur_offset += num_chars_per_line[cur_line_num];
>> }
>>
>> // Restart the processor.
>> ResetFX2(0);
>>
>>
>> data_file_lines consists of the lines of data from th

tcxmaster.hex
>> file. Each line is 256 bytes long (num_chars_per_line confirms this).

I
>> believe I may not be writing to the board properly (maybe the wrong
>> addressing?) I'm not sure what's missing or how to correct it.
>> - Donner
>>
>>
>>

>
>
>



 
Reply With Quote
 
nappy
Guest
Posts: n/a

 
      05-12-2006, 06:30 PM

"Donner" <> wrote in message
news: ...
> I actually just got my code working, and discovered some interesting
> pieces of information. I'm using the FX2 EEPROM writing code example that
> came from Cypress. It loads some VendAx hex program first before loading
> data to the EEPROM. It does the same as CyConsole. I think that program
> tells the Cypress chip to write to EEPROM and how to do it. I wasn't
> loading the VendAx code first, so I wasn't writing to the EEPROM.
> - Donner



Yes.. the VendAx code, if you look at the source, is the code which parses
vendor commands, like the ones to write and read the EEProm. Without loading
_some_ code there is nothing running in the FX2 at all. Code runs from RAM
inthe FX2 so you either have to load from EEProm with a C2 load or download
it from the host when the FX2 is enumerated.



>
>>Where are you actually writing to EE? Are you using the EERead/Write
>>routines that came with the Cypress firware?
>>
>>
>>
>>
>>"Donner" <> wrote in message
>>news:buGdnZm2peV8UP7ZRVn-...
>>> Hi! I'm trying to write a serial number to a Cypress FX2 EEPROM.

> I
>>> have used the hex2bix method, and it worked great. But my new method

> is
>>> to edit the binary file from the hex2bix, alter the serial number, and
>>> upload the new binary file to the FX2 EEPROM.
>>>
>>> I can find the serial number okay, and can alter it. But when
>>> writing to the USB device, nothing seems to happen. I have to reset

> the
>>> device to reconnect, but the serial number doesn't change.
>>>
>>> Here's the code I'm using to write the binary file.
>>>
>>> // First shut down the processor.
>>> ResetFX2(1);
>>>
>>> FX2Device->ControlEndPt->ReqCode = 0xA0;
>>> FX2Device->ControlEndPt->Index = 0;
>>> FX2Device->ControlEndPt->Value = 0;
>>>
>>> cur_offset = 0;
>>> for(cur_line_num = 0; cur_line_num < num_data_file_lines;
>>> cur_line_num++)
>>> {
>>> length = num_chars_per_line[cur_line_num];
>>> FX2Device->ControlEndPt->Value = cur_offset;
>>> FX2Device->ControlEndPt->Write(data_file_lines[cur_line_num],
>>> length);
>>> cur_offset += num_chars_per_line[cur_line_num];
>>> }
>>>
>>> // Restart the processor.
>>> ResetFX2(0);
>>>
>>>
>>> data_file_lines consists of the lines of data from the

> tcxmaster.hex
>>> file. Each line is 256 bytes long (num_chars_per_line confirms this).

> I
>>> believe I may not be writing to the board properly (maybe the wrong
>>> addressing?) I'm not sure what's missing or how to correct it.
>>> - Donner
>>>
>>>
>>>

>>
>>
>>

>
>



 
Reply With Quote
 
nappy
Guest
Posts: n/a

 
      05-12-2006, 08:54 PM
Oh.. also remember not to overwrite the first 8 locations of the EEPROM
inadvertantly. The FX2 reads the first byte to determine how much to offload
from EEProm in order to boot. .


"nappy" <> wrote in message
news:uC39g.71428$. net...
>
> "Donner" <> wrote in message
> news: ...
>> I actually just got my code working, and discovered some interesting
>> pieces of information. I'm using the FX2 EEPROM writing code example
>> that
>> came from Cypress. It loads some VendAx hex program first before loading
>> data to the EEPROM. It does the same as CyConsole. I think that program
>> tells the Cypress chip to write to EEPROM and how to do it. I wasn't
>> loading the VendAx code first, so I wasn't writing to the EEPROM.
>> - Donner

>
>
> Yes.. the VendAx code, if you look at the source, is the code which parses
> vendor commands, like the ones to write and read the EEProm. Without
> loading _some_ code there is nothing running in the FX2 at all. Code runs
> from RAM inthe FX2 so you either have to load from EEProm with a C2 load
> or download it from the host when the FX2 is enumerated.
>
>
>
>>
>>>Where are you actually writing to EE? Are you using the EERead/Write
>>>routines that came with the Cypress firware?
>>>
>>>
>>>
>>>
>>>"Donner" <> wrote in message
>>>news:buGdnZm2peV8UP7ZRVn-...
>>>> Hi! I'm trying to write a serial number to a Cypress FX2 EEPROM.

>> I
>>>> have used the hex2bix method, and it worked great. But my new method

>> is
>>>> to edit the binary file from the hex2bix, alter the serial number, and
>>>> upload the new binary file to the FX2 EEPROM.
>>>>
>>>> I can find the serial number okay, and can alter it. But when
>>>> writing to the USB device, nothing seems to happen. I have to reset

>> the
>>>> device to reconnect, but the serial number doesn't change.
>>>>
>>>> Here's the code I'm using to write the binary file.
>>>>
>>>> // First shut down the processor.
>>>> ResetFX2(1);
>>>>
>>>> FX2Device->ControlEndPt->ReqCode = 0xA0;
>>>> FX2Device->ControlEndPt->Index = 0;
>>>> FX2Device->ControlEndPt->Value = 0;
>>>>
>>>> cur_offset = 0;
>>>> for(cur_line_num = 0; cur_line_num < num_data_file_lines;
>>>> cur_line_num++)
>>>> {
>>>> length = num_chars_per_line[cur_line_num];
>>>> FX2Device->ControlEndPt->Value = cur_offset;
>>>> FX2Device->ControlEndPt->Write(data_file_lines[cur_line_num],
>>>> length);
>>>> cur_offset += num_chars_per_line[cur_line_num];
>>>> }
>>>>
>>>> // Restart the processor.
>>>> ResetFX2(0);
>>>>
>>>>
>>>> data_file_lines consists of the lines of data from the

>> tcxmaster.hex
>>>> file. Each line is 256 bytes long (num_chars_per_line confirms this).

>> I
>>>> believe I may not be writing to the board properly (maybe the wrong
>>>> addressing?) I'm not sure what's missing or how to correct it.
>>>> - Donner
>>>>
>>>>
>>>>
>>>
>>>
>>>

>>
>>

>
>



 
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



All times are GMT. The time now is 12:14 PM.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43