This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

PGA460: Writing to EEPROM

Part Number: PGA460
Other Parts Discussed in Thread: ENERGIA

Hi, 

reading the documentation regarding the bulk eeprom unlock is a little unclear. Do I have to send a register write command to do this? If no what is the hex sequence that I need to send to do a bulk eeprom write?

Thanks

  • Hi Clint

    In PGA460 you can do the following:

    1a. Write to registers first using the interface that you are using. There are register write commands for TCI and UART in Table 2 and Table 3.

    1b. Follow that by issue an EEPROM burn commands and it takes all the values currently in the register and burns that into EEPROM. See Table 2 Command 11 for TCI. There is no just EEPROM burn command from UART. However using a register write command, you can write to EE_CNTRL register to issue the burn command. See section 7.6.3.45 for register details.

    2. Other option is to use a bulk programming command where you pipe in a large datastream to a register array which also burns the EEPROM. This is for programming efficiency. See Table 2 Command 13 for TCI. See Table 3 Command 12 for UART or Command 23 if you want to broadcast same for all sensors on UART bus.

    3. Both TCI and UART have commands to program certain register blocks with a single command to optimize register programming time. You can use those instead of doing multiple register writes. This has to followed by an EEPROM programming command.

    Please also section 7.6.1 on how to Unlock EEPROM. Also you need to follow the EEPROM programming time spec before executing any other command. See section 6.13 for details.

    Regards,

    Vaibhav
  • Thank you - I am using UART for my application and created three individual buffers

    #define _checksum(f) ((uint8_t) ~(uint8_t)(f))
    uint8_t Ult_unlockEeprom[] = {0x55, 0x0A, 0x40, 0x68, _checksum(0x0A)}
    uint8_t Ult_setToProgramEeprom[] = {0x55, 0x0A, 0x69, _checksum(0x0A)}
    uint8_t Ult_bulkEepromWrite[] ={…} //eeprom code too long for email

    then I send these buffers all one right after another. Should this sequence work? What is the best method of testing if the EEPROM has been written to correctly?

    Best,

    Clint
  • Hi Clint,
    I have answered you question regarding the EEPROM burn on your other post here:
    e2e.ti.com/.../2922937

    FYI, here is the burnEEPROM() command code from the Energia library:

    bool pga460::burnEEPROM()
    {
    byte burnStat = 0;
    byte temp = 0;
    bool burnSuccess = false;

    if (comm != 1 || comm != 3)
    {

    // Write "0xD" to EE_UNLCK to unlock EEPROM, and '0' to EEPRGM bit at EE_CNTRL register
    regAddr = 0x40; //EE_CNTRL
    regData = 0x68;
    byte buf10[5] = {syncByte, SRW, regAddr, regData, calcChecksum(SRW)};
    if (comm == 0 || comm == 2) // UART or OWU mode
    {
    Serial1.write(buf10, sizeof(buf10));
    }
    if (comm == 3) // SPI mode
    {
    spiTransfer(buf10, sizeof(buf10));
    }

    delay(1);

    // Write "0xD" to EE_UNLCK to unlock EEPROM, and '1' to EEPRGM bit at EE_CNTRL register
    regAddr = 0x40; //EE_CNTRL
    regData = 0x69;
    buf10[2] = regAddr;
    buf10[3] = regData;
    buf10[4] = calcChecksum(SRW);
    if (comm == 0 || comm == 2) // UART or OWU mode
    {
    Serial1.write(buf10, sizeof(buf10));
    }
    if (comm == 3) // SPI mode
    {
    spiTransfer(buf10, sizeof(buf10));
    }
    delay(1000);


    // Read back EEPROM program status
    if (comm == 2)
    {
    owuShift = 1; // OWU receive buffer offset to ignore transmitted data
    }
    pga460SerialFlush();
    regAddr = 0x40; //EE_CNTRL
    byte buf9[4] = {syncByte, SRR, regAddr, calcChecksum(SRR)};
    if (comm == 0 || comm == 2) // UART or OWU mode
    {
    Serial1.write(buf9, sizeof(buf9));
    }
    if (comm == 3) // SPI mode
    {
    spiTransfer(buf9, sizeof(buf9));
    }
    delay(10);
    if (comm == 0 || comm == 2) // UART or OWU mode
    {
    for(int n=0; n<3; n++)
    {
    if(n==1-owuShift)
    {
    burnStat = Serial1.read(); // store EE_CNTRL data
    }
    else
    {
    temp = Serial1.read();
    }
    }
    }
    if (comm == 3) // SPI mode
    {
    spiMosiIdle(3);
    burnStat = misoBuf[1];
    }
    }
    else if (comm == 1) // TCI mode
    {
    EE_CNTRL = 0x68;
    tciIndexRW(11, true); // write to index 11 to EE_UNLCK to unlock EEPROM, and '0' to EEPRGM bit at EE_CNTRL register
    delay(1); // immediately send the same UART or TCI command with the EEPRGM bit set to '1'.
    EE_CNTRL = 0x69;
    tciIndexRW(11, true); // write to index 11 to EE_UNLCK to unlock EEPROM, and '1' to EEPRGM bit at EE_CNTRL register
    delay(1000);
    tciIndexRW(11, false); // read back index 11 to review EE_PGRM_OK bit
    burnStat = bufRecv[0];
    }
    else
    {
    //do nothing
    }

    if((burnStat & 0x04) == 0x04){burnSuccess = true;} // check if EE_PGRM_OK bit is '1'

    return burnSuccess;
    }