heeeelp - i2c talking to a Astec power supply

Short why:
I'm building a 144Mhz/2m amplifier and I need a 3Kw/50v power supply. They are around as surpluss HP blade center power modules. The come with a I2C monitoring unit that you are supposed to be able to query.

I have not really dug into I2C, other than used the wire.h library and some C code implementations..

I have a link to the Astec I2C protocol document: http://www.tf3cy.is/files/HPS3KW_i2c.pdf

here is relevant code (calling this once every second):

#include <Wire.h>
#define PSU_ADDRESS_W 0x50
#define PSU_ADDRESS_R 0x50

void setup() {
  // Debugging output
  Serial.begin(9600);
  Wire.begin();
 }
 void READ_STATUS()
 
 {
  Wire.beginTransmission(PSU_ADDRESS_W);
    Wire.write(0x02); 
    Wire.write(0x03); 
  // Wire.write(0x02); 
  // Wire.write(0x03); 
// Wire.beginTransmission(PSU_ADDRESS_W);
 delayMicroseconds(15);

 if  (Wire.endTransmission() == 0) 
 {
 Serial.println("Sucess sending");
 }
 else
 {
 Serial.println("Failed sending");
 }
   delayMicroseconds(15);

if ( Wire.requestFrom(PSU_ADDRESS_R, 1,1) == 1)
{
   Serial.print("got this from slave");
   Serial.println(Wire.read());
}
else
{
 Serial.println("failed reading from slave");
   Serial.print("Avail:");
   Serial.println(Wire.available());
}
   
}

So - there is this thing :
If you look at the AA21970 - Command #2 - Read control register - that is what I decided to do for start - read the #$#" control register.

This is just not working - and I have tried alot of variations
Things I know:

  • I put a I2C 7 seg display on the bus - and that works - so the i2c implemetation is ok
  • I can write to the address, but never get anything back

soo, any pointers ?

I attached a picture of the register I'm trying to access
and don't quite know why it has the two commands - 0x02 and 0x03 ?
and the Slave-adddress+R ? what is the +R ?

  1. Make sure your device is on address 0x32 like your code uses. That is LOW LOW HIGH on A2, A1, A0 respectively.
  2. You have two control registers so you send 0x02 if you want to read control register 2 or 0x03 if you want to read control register 3. You do not send both.
  3. After you have sent the address and what control register you want to read then you read from the I2C bus. with a
Wire.requestFrom(address, number of bytes);

request followed by the appropriate number of Wire.read() calls.

ok - but trying to get my head around this..

Ok - this makes some sense now

Wire.write(0x03);
and now If I read I get one value, and it's actually 0x03 - but I'm not able to request more to get the actual register - or I at least cant see it change - if I change the oper status of the power supply (with PSON external signal)

I tried the next thing:

   Wire.beginTransmission(PSU_ADDRESS_W);
    Wire.write(0x03); 
   if  (Wire.endTransmission() == 0) 
   {
     Serial.println("Sucess sending");
   }
   else
   {
   Serial.println("Failed sending");
   }

   delayMicroseconds(15);

   Wire.requestFrom(PSU_ADDRESS_W, 18,1);
   int iii=0;
   
   while (Wire.available())
   {
    iii++;
    Serial.print("Line ");
	Serial.print(iii);
	Serial.print(" value  ");
	Serial.println(Wire.read());
   }

This yields something - but I think it's junk.
!
Sucess sending
Line 1 value 2
Line 2 value 3
Line 3 value 13
Line 4 value 0
Line 5 value 213
Line 6 value 1
Line 7 value 4
Line 8 value 0
Line 9 value 202
Line 10 value 0
Line 11 value 0
Line 12 value 0
Line 13 value 0
Line 14 value 0
Line 15 value 0
Line 16 value 0
Line 17 value 0
Line 18 value 0

values make no sense...

but I think I'm getting there

sorry I was jumping from one thing to another..

So this is where I'm confused..

according to the psu documentation - there is only one command register.

The command is #2 to read the register - so I assume I write that to the bus.
The other number 0x03 in Blue - is something I don't understand.
But when I sent 0x02 to the bus, the number I then read is 0x03... coincident ? or what ?

from the beloved document:

1.8 Read Status Register Command (Command #2)
Read Status Register Command will return the power supply status. The format of this command will be as
follows:
MCU Command Syntax and Packet Length:
Command 2: Read Control Status Register
Writes: 1 byte
Syntax: CMD#2
Reads: 1 byte
1. Control Status register
Power Supply Address
Read Status Register Command (Command #2)
Power Supply Address+1
Read Status Byte (Nack)
Reading data from the power supply will be the same as reading from the EEPROM. The
"

:wink:

This yields something - but I think it's junk.

Yes it is junk.
You are not reading the I2C bus.
Try this:-

  Wire.beginTransmission(PSU_ADDRESS_W);
    Wire.write(0x03); 
    Wire.write(PSU_ADDRESS_W + ? ); // I don't understand what the +r means on page 6 so try a few fixed values, 0, 1 ,2 and so on
   Wire.endTransmission();
   Wire.requestFrom(PSU_ADDRESS_W, 18);
 int value;
 for(int i=0; i<18; i++){
    if (!Wire.available()) { } // do nothing until data arrives
       value = Wire.read();
 	Serial.print("value ");
        Serial.print(i);
       Serial.print(" is ");
	Serial.println(value);
   }
}

The data sheet is for a HPS3KW AND a AA21970
The blue numbers are for the HPS3KW
What one do you have?

I have the HPS3KW - that is the OEM name for HP - but the astec Partnumber is AA21970

going to bed , but final report - tried your code..

If I only write the command number - and read after that I get data but always these same numbers.. (as I showed before)

If I write anything after the command 0x02 - +1+2+3 etc.. I get -1 in all the output values..

I think I'm close - so I will give this a try tomorrow - it will be really nice getting this to work - then I don't need any analogue voltage tricks to measure 30Amps :wink:

  • Benni TF3CY

"Slave Address + R" is probably referring to the address + "Read bit" - it's LSB set to one - as I2C addresses are 7bits and LSB being read/write.

I'm really assuming that is being taken care of in the wire.h library

.... nn

and to continue this near mononlogue

I surprisingly got an answer from Astec regarding this document

"To read control status register of HPS3KW, you should follow below format, send blue ones, 0x03 instead of 0x02."
Restart is just continuous with Start.

+R means add Read bit value 1, for write that’s

I still just get stuff back if I write either 0x02 or 0x03 and read straight after . anything other written gives -1

so the thing that is bothering me is this "repeated start" - that has a clear meaning in the I2C world - and if you google it - Arduino has had some problems with it.

anyone know anything about this "repeated start" or can comment on this :wink:

73, Benni TF3CY

"Slave Address + R" is probably referring to the address + "Read bit"

Yes of course, sorry I missed that. Remove that

Wire.write(PSU_ADDRESS_W + ? ); // I don't

Line form the code.

73's G8HBR

Just to close the issue

the code works - the problem is that the I2C bus address was wrong

I have no idea why, but if I used the "i2c" scanner - I found another address and that is actually the one that works - totally different from the data sheet - and the strange thing is that is does not change if I play with the A0-A2 address lines. (the other one did) - so that's what threw me off using the address. - and ofc. understanding what commands to send. Now I'm just trying to peace together how they measure the line voltage and current :wink:

so thanks for the help ! most of the power supplies used in Servers like HP/IBM are from emerson/astec - well made high power units , and they usually have this I2C interface :wink:

thanks!

  • Benni