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-Q1: EEPROM BULK WRITE

Part Number: PGA460-Q1
Other Parts Discussed in Thread: PGA460, ENERGIA

After doing EEPROM bulk write I am doing the EEPROM bulk read but I am getting the values FF FF FF FF........ for all the registers.Why is it so?

Also I  need circuit schematic diagram please send me that. 

  • Chethan,
    When you perform the EEPROM bulk read, are you also reading the first byte (diagnostic field) at a value of 0x40 (assuming the previous command was processed correctly), and the last byte (checksum) of non-0xFF?

    Can you provide the exact command sequence you are sending? {0x55, 0x0B, 0xF4}

    Are you changing the UART_ADDR to a non-zero value during the EEPROM bulk write?

    Does your UART comply with the following? (see Figure 20 of the datasheet for timing):
    • Baud rate from 2400 bps to 115 200 bps, auto-detected (as previously described)
    • 8 data bits
    • 1 start bit
    • 2 stop bit
    • No parity bit
    • No flow control
    • Interfield wait time (only required for 1 stop bit)

    The PGA460 schematic is available as a design file in eight variants. Download your required configuration form the Design files section at:
    www.ti.com/.../technicaldocuments
  • Thank you Akeem Whitehead for your reply.

    As you asked I am not changing the UART_ADDR to non zero.

    Could you please guide me how to do EEPROM bulk write and also EEPROM burn,so that I can check whether am I doing it correctly or not.
  • Chethan,
    I recommend that you review the PGA460 Energia Library and Code Example (www.ti.com/.../slac741) for an actual implementation of the EEPROM bulk write and EEPROM burn commands. The PGA460 Software Development Guide (www.ti.com/.../slaa730) provides a walk through of this code sequence.

    Here is a subset of the code showing the EEPROM bulk write and EEPROM burn commands:

    /*------------------------------------------------- defaultPGA460 -----
    | Function defaultPGA460
    |
    | Purpose: Updates user EEPROM values, and performs bulk EEPROM write.
    |
    | Parameters:
    | xdcr (IN) -- updates user EEPROM based on predefined listing for a specific transducer.
    | Modify existing case statements, or append additional case-statement for custom user EEPROM configurations.
    | • 0 = Murata MA58MF14-7N
    | • 1 = Murata MA40H1S-R
    |
    | Returns: none
    *-------------------------------------------------------------------*/
    void pga460::defaultPGA460(byte xdcr)
    {
    switch (xdcr)
    {
    case 0: // Murata MA58MF14-7N
    USER_DATA1 = 0x00;
    USER_DATA2 = 0x00;
    USER_DATA3 = 0x00;
    USER_DATA4 = 0x00;
    USER_DATA5 = 0x00;
    USER_DATA6 = 0x00;
    USER_DATA7 = 0x00;
    USER_DATA8 = 0x00;
    USER_DATA9 = 0x00;
    USER_DATA10 = 0x00;
    USER_DATA11 = 0x00;
    USER_DATA12 = 0x00;
    USER_DATA13 = 0x00;
    USER_DATA14 = 0x00;
    USER_DATA15 = 0x00;
    USER_DATA16 = 0x00;
    USER_DATA17 = 0x00;
    USER_DATA18 = 0x00;
    USER_DATA19 = 0x00;
    USER_DATA20 = 0x00;
    TVGAIN0 = 0xAA;
    TVGAIN1 = 0xAA;
    TVGAIN2 = 0xAA;
    TVGAIN3 = 0x82;
    TVGAIN4 = 0x08;
    TVGAIN5 = 0x20;
    TVGAIN6 = 0x80;
    INIT_GAIN = 0x60;
    FREQUENCY = 0x8F;
    DEADTIME = 0xA0;
    if (comm == 2)
    {
    PULSE_P1 = 0x80 | 0x04;
    }
    else
    {
    PULSE_P1 = 0x04;
    }
    PULSE_P2 = 0x10;
    CURR_LIM_P1 = 0x55;
    CURR_LIM_P2 = 0x55;
    REC_LENGTH = 0x19;
    FREQ_DIAG = 0x33;
    SAT_FDIAG_TH = 0xEE;
    FVOLT_DEC = 0x7C;
    DECPL_TEMP = 0x4F;
    DSP_SCALE = 0x00;
    TEMP_TRIM = 0x00;
    P1_GAIN_CTRL = 0x09;
    P2_GAIN_CTRL = 0x09;
    break;
    case 1: // Murata MA40H1SR
    USER_DATA1 = 0x00;
    USER_DATA2 = 0x00;
    USER_DATA3 = 0x00;
    USER_DATA4 = 0x00;
    USER_DATA5 = 0x00;
    USER_DATA6 = 0x00;
    USER_DATA7 = 0x00;
    USER_DATA8 = 0x00;
    USER_DATA9 = 0x00;
    USER_DATA10 = 0x00;
    USER_DATA11 = 0x00;
    USER_DATA12 = 0x00;
    USER_DATA13 = 0x00;
    USER_DATA14 = 0x00;
    USER_DATA15 = 0x00;
    USER_DATA16 = 0x00;
    USER_DATA17 = 0x00;
    USER_DATA18 = 0x00;
    USER_DATA19 = 0x00;
    USER_DATA20 = 0x00;
    TVGAIN0 = 0xAA;
    TVGAIN1 = 0xAA;
    TVGAIN2 = 0xAA;
    TVGAIN3 = 0x51;
    TVGAIN4 = 0x45;
    TVGAIN5 = 0x14;
    TVGAIN6 = 0x50;
    INIT_GAIN = 0x54;
    FREQUENCY = 0x32;
    DEADTIME = 0xA0;
    if (comm == 2)
    {
    PULSE_P1 = 0x80 | 0x08;
    }
    else
    {
    PULSE_P1 = 0x08;
    }
    PULSE_P2 = 0x10;
    CURR_LIM_P1 = 0x40;
    CURR_LIM_P2 = 0x40;
    REC_LENGTH = 0x19;
    FREQ_DIAG = 0x33;
    SAT_FDIAG_TH = 0xEE;
    FVOLT_DEC = 0x7C;
    DECPL_TEMP = 0x4F;
    DSP_SCALE = 0x00;
    TEMP_TRIM = 0x00;
    P1_GAIN_CTRL = 0x09;
    P2_GAIN_CTRL = 0x09;
    break;
    case 2: // user custom
    {
    // insert custom user EEPROM listing
    }
    default: break;
    }

    if ((comm !=1) && (comm !=6)) // UART or OWU mode and not busDemo6
    {
    byte buf12[46] = {syncByte, EEBW, USER_DATA1, USER_DATA2, USER_DATA3, USER_DATA4, USER_DATA5, USER_DATA6,
    USER_DATA7, USER_DATA8, USER_DATA9, USER_DATA10, USER_DATA11, USER_DATA12, USER_DATA13, USER_DATA14,
    USER_DATA15,USER_DATA16,USER_DATA17,USER_DATA18,USER_DATA19,USER_DATA20,
    TVGAIN0,TVGAIN1,TVGAIN2,TVGAIN3,TVGAIN4,TVGAIN5,TVGAIN6,INIT_GAIN,FREQUENCY,DEADTIME,
    PULSE_P1,PULSE_P2,CURR_LIM_P1,CURR_LIM_P2,REC_LENGTH,FREQ_DIAG,SAT_FDIAG_TH,FVOLT_DEC,DECPL_TEMP,
    DSP_SCALE,TEMP_TRIM,P1_GAIN_CTRL,P2_GAIN_CTRL,calcChecksum(EEBW)};

    Serial1.write(buf12, sizeof(buf12)); // serial transmit master data for bulk EEPROM
    delay(50);

    // Update targeted UART_ADDR to address defined in EEPROM bulk switch-case
    byte uartAddrUpdate = (PULSE_P2 >> 5) & 0x07;
    if (uartAddr != uartAddrUpdate)
    {
    // Update commands to account for new UART addr
    // Single Address
    P1BL = 0x00 + (uartAddrUpdate << 5);
    P2BL = 0x01 + (uartAddrUpdate << 5);
    P1LO = 0x02 + (uartAddrUpdate << 5);
    P2LO = 0x03 + (uartAddrUpdate << 5);
    TNLM = 0x04 + (uartAddrUpdate << 5);
    UMR = 0x05 + (uartAddrUpdate << 5);
    TNLR = 0x06 + (uartAddrUpdate << 5);
    TEDD = 0x07 + (uartAddrUpdate << 5);
    SD = 0x08 + (uartAddrUpdate << 5);
    SRR = 0x09 + (uartAddrUpdate << 5);
    SRW = 0x0A + (uartAddrUpdate << 5);
    EEBR = 0x0B + (uartAddrUpdate << 5);
    EEBW = 0x0C + (uartAddrUpdate << 5);
    TVGBR = 0x0D + (uartAddrUpdate << 5);
    TVGBW = 0x0E + (uartAddrUpdate << 5);
    THRBR = 0x0F + (uartAddrUpdate << 5);
    THRBW = 0x10 + (uartAddrUpdate << 5);
    }
    uartAddr = uartAddrUpdate;
    }
    else if (comm == 6)
    {
    return;
    }
    else
    {
    tciIndexRW(13, true); // TCI index 13 write
    }

    return;
    }

    /*------------------------------------------------- burnEEPROM -----
    | Function burnEEPROM
    |
    | Purpose: Burns the EEPROM to preserve the working/shadow register values to EEPROM after power
    | cycling the PGA460 device. Returns EE_PGRM_OK bit to determine if EEPROM burn was successful.
    |
    | Parameters:
    | none
    |
    | Returns: bool representation of EEPROM program success
    *-------------------------------------------------------------------*/
    bool pga460::burnEEPROM()
    {
    byte burnStat = 0;
    byte temp = 0;
    bool burnSuccess = false;

    if (comm != 1)
    {

    // 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)};
    Serial1.write(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);
    Serial1.write(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)};
    Serial1.write(buf9, sizeof(buf9));
    delay(10);
    for(int n=0; n<3; n++)
    {
    if(n==1-owuShift)
    {
    burnStat = Serial1.read(); // store EE_CNTRL data
    }
    else
    {
    temp = Serial1.read();
    }
    }
    }
    else
    {
    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];
    }

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

    return burnSuccess;
    }
  • Thank you Akeem Whitehead for your reply.

  • Now I am able to read the EEPROM but the problem I am facing is in writing the EEPROM .I am using Arduino for programing the PGA460.

    command sequence I am using is syncByte = 0x55; EEBW = 0x0C;
  • Chethan,

    Here is an example sequence of how to execute a Command 12 EEPROM Bulk Write (in hex):
    55 0C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 AA AA AA 00 00 00 00 C0 8C 00 01 12 07 FF 1C 00 EE 7C 0A 00 00 00 00 FA

    The EEPROM bulk write command requires that you define all the desired user EEPROM values to be written. See Table 3 in the datasheet for UART command size requirements. Also see the following snippet of the PGA460 example code for the command 12 transmit structure:

    byte buf12[46] = {syncByte, EEBW, USER_DATA1, USER_DATA2, USER_DATA3, USER_DATA4, USER_DATA5, USER_DATA6,
    USER_DATA7, USER_DATA8, USER_DATA9, USER_DATA10, USER_DATA11, USER_DATA12, USER_DATA13, USER_DATA14,
    USER_DATA15,USER_DATA16,USER_DATA17,USER_DATA18,USER_DATA19,USER_DATA20,
    TVGAIN0,TVGAIN1,TVGAIN2,TVGAIN3,TVGAIN4,TVGAIN5,TVGAIN6,INIT_GAIN,FREQUENCY,DEADTIME,
    PULSE_P1,PULSE_P2,CURR_LIM_P1,CURR_LIM_P2,REC_LENGTH,FREQ_DIAG,SAT_FDIAG_TH,FVOLT_DEC,DECPL_TEMP,
    DSP_SCALE,TEMP_TRIM,P1_GAIN_CTRL,P2_GAIN_CTRL,calcChecksum(EEBW)};
    Serial1.write(buf12, sizeof(buf12)); // serial transmit master data for bulk EEPROM