Trenz Electronic GmbH Support Forum

Archived Boards and Threads => Archived Boards => FAQ Trenz Electronic FPGA Modules => Topic started by: Thorsten Trenz on December 23, 2010, 09:15:45 AM

Title: Example of EEPROM writing on TE03xx Series modules
Post by: Thorsten Trenz on December 23, 2010, 09:15:45 AM
Q: I need an example of how to write EEPROM or Flash via the API

Please refer to the FX2_instruction_set.xls in the reference design for the full command set.
A description can be found here: http://docs.trenz-electronic.de/Optomotive/intellectual%20property/CAM_API_user_guide_v10.pdf (http://docs.trenz-electronic.de/Optomotive/intellectual%20property/CAM_API_user_guide_v10.pdf)


char SetDeviceIDcommand(unsigned int handle, unsigned char device_id)
{
      byte cmd[FX2_MESS_LEN], reply[FX2_MESS_LEN];
      int cmd_length = 64;
      int reply_length = 64;

      cmd[0] = 0xA9;
      cmd[1] = (byte)(DEVICE_ID_EEPROM_ADDR>>; //addr HIGH
      cmd[2] = (byte)DEVICE_ID_EEPROM_ADDR; //addr LOW
      cmd[3] = 1; //single byte
      cmd[4] = device_id;

      if (TE0300_SendCommand(handle, cmd, cmd_length, reply,&reply_length,TIMEOUT_MS)) {
            MSG(::MessageBox(NULL,"GetDeviceIDcommand!","ERROR",MB_OK)
            return -1;
      }
      return 0;
}

Title: Re: Example of EEPROM writing on TE03xx Series modules
Post by: Thorsten Trenz on April 17, 2012, 03:18:13 PM
More examples can be found here now:
https://github.com/Trenz-Electronic/TE-USB-Suite