Writing a serial number to EEPROM...

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 to
Donner
Loading thread data ...

Where are you actually writing to EE? Are you using the EERead/Write routines that came with the Cypress firware?

Reply to
nappy

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

I

is

the

tcxmaster.hex

I
Reply to
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.

Reply to
nappy

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. .

Reply to
nappy

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.