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.

PGA305: PGA305 Read Compensated Output

Part Number: PGA305

Hello

I'm using a Arduino Nano to accessing via I2C.
my Commands are:

const byte extADDR = 0x40;
bool write(uint8_t addr, uint8_t reg, uint8_t data) { uint8_t _adr = extADDR | addr; //addiere Adresse und Offset durch I2CADDR Wire.beginTransmission(_adr); //Start Wire.write(reg); //Register Wire.write(data); //Daten return (Wire.endTransmission() == 0); //Übertragung beginnen } uint8_t read(uint8_t addr, uint8_t reg) { uint8_t _adr = extADDR | addr; //addiere Adresse und Offset durch I2CADDR uint8_t ret; Wire.beginTransmission(_adr); //Start Wire.write(reg); //Register Wire.endTransmission(); //Stop Wire.requestFrom(_adr | 1, 1); //nochmal Start & Leseadresse ansprechen (+1) while (Wire.available()) ret=Wire.read(); return ret; //byte Lesen }

When i diasable COMPENSATION RESET

write(0x0, 0x0C, 0b00000011);

i'm able to accessing the pure PADC Values with Register 20 to 22

long getData()

{
  uint8_t byte1, byte2, byte3;
  byte3 = read(0x2, 0x20); //LSB
  byte2 = read(0x2, 0x21);
  byte1 = read(0x2, 0x22); //MSB

  long ausgabe = byte1;
  ausgabe <<= 8;
  ausgabe += byte2;
  ausgabe <<= 8;
  ausgabe += byte3;

  if (ausgabe > 0x7FFFFF)
    ausgabe -= 0x1000000; //falls Vorzeichenbit gesetzt (an bit24), 2er Komplement beachten
  return ausgabe;
}


this works fine and the data make sense and are usable.

when i try to use the compensated values i just getting rubbish.

after disabling COMP_CONTROL

write(0x0, 0x0C, 0b00000000);

i tried to get data like described on page 33 table 9.

it seems that byte1 is the MSB and every X conversation there is a 0b01111111 (=dec127) on byte2. the datas are also very noisy.
is there a way to get a compsated value out of the device? so i cant use all the fine compensation functions?

i'm able to accessing the eeprom, i made a dump of a fresh device, it's attached.
i read from 00 to 7F, the outputs are in binary format.

0 = 0
1 = 0
2 = 100000
3 = 0
4 = 0
5 = 0
6 = 0
7 = 0
8 = 0
9 = 0
A = 0
B = 0
C = 0
D = 0
E = 10000
F = 0
10 = 0
11 = 0
12 = 0
13 = 0
14 = 0
15 = 0
16 = 0
17 = 0
18 = 0
19 = 0
1A = 0
1B = 0
1C = 0
1D = 0
1E = 0
1F = 0
20 = 0
21 = 0
22 = 0
23 = 0
24 = 0
25 = 0
26 = 0
27 = 0
28 = 0
29 = 0
2A = 0
2B = 0
2C = 0
2D = 0
2E = 0
2F = 0
30 = 1100110
31 = 1
32 = 0
33 = 1000
34 = 1
35 = 10000000
36 = 10
37 = 1000011
38 = 0
39 = 1
3A = 0
3B = 0
3C = 0
3D = 0
3E = 11111111
3F = 111111
40 = 0
41 = 0
42 = 11111111
43 = 111111
44 = 1
45 = 0
46 = 0
47 = 0
48 = 0
49 = 0
4A = 0
4B = 0
4C = 0
4D = 0
4E = 0
4F = 0
50 = 0
51 = 0
52 = 0
53 = 0
54 = 0
55 = 0
56 = 0
57 = 0
58 = 111
59 = 1110011
5A = 11111111
5B = 111111
5C = 11111111
5D = 111111
5E = 1
5F = 0
60 = 0
61 = 0
62 = 0
63 = 0
64 = 0
65 = 0
66 = 0
67 = 0
68 = 1
69 = 0
6A = 11111111
6B = 11111111
6C = 11111111
6D = 11111111
6E = 11111111
6F = 11111111
70 = 11111111
71 = 11111111
72 = 11111111
73 = 11111111
74 = 11111111
75 = 11111111
76 = 11111111
77 = 11111111
78 = 11111111
79 = 11111111
7A = 11111111
7B = 11111111
7C = 11111111
7D = 11111111
7E = 11111111
7F = 10010000

  • Attachment:
    I get data, but they did not make sense:

    This is the not working function:

    long getData2()
    {
      uint8_t byte1, byte2, byte3;
      write(0x0, 0x09, 0x04);
      byte1 = read(0x0, 0x04); //MSB
    
      write(0x0, 0x09, 0x70);
      byte2 = read(0x0, 0x05);
      byte3 = read(0x0, 0x04); //LSB
    
      long ausgabe = byte1;
      ausgabe <<= 8;
      ausgabe += byte2;
      ausgabe <<= 8;
      ausgabe += byte3;
    
      Serial.print(byte1);
      Serial.print("_");
      Serial.print(byte2);
      Serial.print("_");
      Serial.println(byte3);
    
     return ausgabe;
    }
    

    and a short dump of readed data (each byte in decimal value).

    105_224_119
    119_224_92
    92_224_127
    54_224_167
    127_0_153
    153_224_117
    117_224_121
    121_224_121
    113_224_121
    121_224_127
    111_224_95
    127_0_88
    88_224_101
    101_224_101
    127_0_120
    120_224_127
    82_224_74
    127_0_127
    112_224_127
    118_224_152
    152_224_127
    127_224_81
    127_0_127
    77_224_127
    103_224_101
    101_224_101
    65_224_65
    127_0_104
    104_224_104
    119_224_95
    127_0_127
    95_224_127
    126_224_109
    109_224_127
    112_224_108
    127_0_127
    134_224_134
    134_224_132
    132_224_127
    102_224_121
    121_224_127
    94_224_82
    127_0_127
    118_224_127
    145_224_116
    116_224_127
    61_224_143
    127_0_127
    158_224_127
    140_224_95
    95_224_127
    68_224_61
    61_224_104
    104_224_127
    122_224_127
    127_224_127
    168_224_101
    127_0_127
    70_224_70

    i'm using two controllers one on plugboard one on pcb, using the default wiring like on datasheet, I2CADDR set to GND. Both with same result.



  • Hello Heiko,

    What are the coefficients that you are currently using? How are they being calculated? To start with I would manually program coefficients that will pass the ADC values directly to the output so that you can easily compare. 

    Regards,

  • Hello Scott,

    if it will working i want to make an excel sheet and calculate via solver. At this moment i did not use any custom coefficient. As you can see on my EEPROM dump A0 to B2 (at adress 4A to 55) all are 0. H0 to M3 (at adress 00 to 2F) also are 0 except of H0[21] and G0[20]. Therefore i calculate H0=0,5 and G0=0,25 by default.

    Offset and factor compensation (to get a measurement in Newton from the I2C output data) i do on my Arduino device, so after conversation.

    I want to not use the OUT Pin, only I2C, is this a problem? I let the pins (OUT, FB COMP) just floating.


  • ok i tried set H0 to 0 and G0 to 1. I only recieved 0x00 on every byte. switching back to default values i got data again.
    by the way i compared a plot of PADC data (left) to a plot of "compensated" data (right). same bridge voltage, same amplifing (100x), same data reading, no load on loadcell, h0=0,5 g0=0,25.
    where does the high noise come from? TEMP_CTRL is set 0b00100011 but this schould have no effect because all coeffitients which are affected by temperature are 0.

    on OP_STAGE_CTRL there is 4_20MA_EN set by default is that correct?
    on DIG_IF_CTRL there is bit2 set by default but on datasheet it is marked as reserved, what does this affect?

  • Ok i found that it has something to do with CRC.

    i can change P_GAIN and VBRDG but nothing else. i got CRC_GOOD=0. If i changed back my last edit i got CRC_GOOD=1.

    My EEPROM procedere is (pseudocode):

    startAdresse = start >> 3 // get upper 4 bit

    write to 0x5, 0x88

     for (int i = 0; i < 8; i++)
      {

    read(0x5, startAdresse + i)

    write to 0x5, 0x80 + i // read all 8 byte for manipulating
      }

    //manipulate bytes e.g.:

    write(0x5,0x84,0b00000101); //VBRDG=1,25V

    write(0x5, 0x89, 0b00000100); // ERASE_AND_PROGRAMM
    waitms(100);

    write(0x5, 0x8A, 0b00000001); //Calculate CRC
    waitms(100);
    read(0x5,0x8C); //read CRCOK

    is that ok?

  • Hello,


    The 4_20MA_EN bit in the EEPROM should be set to 0 by default.

    Bit 2 of the DIG_IF_CTRL has to do with the OWI communication, but it is reserved because it is not meant to be changed and is hardcoded into the running of the compensation engine.

    Yes, that looks like the correct procedure from your latest post.

    Regards,