Reply by nappy May 12, 20062006-05-12
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" <gospam@yourself.com> wrote in message 
news:uC39g.71428$F_3.36843@newssvr29.news.prodigy.net...
> > "Donner" <dholten@agiloptics.com> wrote in message > news:sPCdnaCphd2oXPnZnZ2dnUVZ_vydnZ2d@giganews.com... >> 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" <dholten@agiloptics.com> wrote in message >>>news:buGdnZm2peV8UP7ZRVn-hg@giganews.com... >>>> 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 by nappy May 12, 20062006-05-12
"Donner" <dholten@agiloptics.com> wrote in message 
news:sPCdnaCphd2oXPnZnZ2dnUVZ_vydnZ2d@giganews.com...
> 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" <dholten@agiloptics.com> wrote in message >>news:buGdnZm2peV8UP7ZRVn-hg@giganews.com... >>> 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 by Donner May 12, 20062006-05-12
    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

>Where are you actually writing to EE? Are you using the EERead/Write >routines that came with the Cypress firware? > > > > >"Donner" <dholten@agiloptics.com> wrote in message >news:buGdnZm2peV8UP7ZRVn-hg@giganews.com... >> 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 by nappy May 12, 20062006-05-12
Where are you actually writing to EE? Are you using the EERead/Write 
routines that came with the Cypress firware?




"Donner" <dholten@agiloptics.com> wrote in message 
news:buGdnZm2peV8UP7ZRVn-hg@giganews.com...
> 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 by Donner May 11, 20062006-05-11
     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