raplin / DPS-1200FB

Python code to read status from the DPS-1200FB power supply
MIT License
125 stars 33 forks source link

Arduino adventures #3

Open slundell opened 4 years ago

slundell commented 4 years ago

Hi!

I am opening this issue just to let you know that I am experimenting with the i2c bus using an esp8266.

Thanks to your project I have been able to calculate checksums and communicate with the PSU. I have spent a few days in different standard documents now, and I am starting to think that the DPS-1200FB is not using PMBus, but something else.

The communication seems to work fine. It is consistent and with less than .2% CRC errors. I can set and read fan speed. I have fuzzed the PSU with different bit-patterns and it has given me some clues to what some registers do (I have written my ideas in the .ino file).

It has fan speed at 0x20 (or 0x40 if you want the shifted values). All the PMBus specs I have seen has fan speed somewhere else.

Anyways, ideas welcome :) My src is at https://github.com/slundell/dps_charger/ Its just a first draft and is mainly full of redundant functions I use for experimenting :) Best

raplin commented 4 years ago

Hi there, I was not successful turning the power on or off over i2c, it may be possible; I posted a disassembly of the PIC cpu (in the DPS). Yes this isn't PMBus, it's something nonstandard You will not be able to control current or voltage, it's not that sort of PSU unfortunately. I figured out reading a bunch of parameters (wall voltage, current, etc etc) see the python code.

slundell commented 4 years ago

Hi, It might not be possible to control on/off and voltage or current through i2c. I can however control it through other means (the ENABLE#-pin and using 12VFB test-point). I have been able to set it to deliver 100+A at 3.4v (https://github.com/slundell/dps_charger/blob/master/README.md). I seem to have disabled the UVP protection somehow, but OVP and OCP is still in effect. For my application, I would need OVP to be moved up a volt or so.

Could you please explain a bit the difference between commands and "query" registers? The even numbered registers forwards directly to a memory position which can be read and sometimes written. Example being fan speed (0x20) and max amp (0x36). I can read and set them through i2c on these registers. Below is a session where max amps are reset by writing 0x0000 to 0x36

3.14V 7.45A 63.14A (max)
Resetting max amps

[>0x5F] 0x36: 0x0C [S]               # master querying psu register 0x36
[<0x5F] 0x36: 0x92 0x1F 0x4F         # psu responds 0x1F92 ~ 63A
[>0x5F] 0x36: 0x00 0x00 0x0C [S]     # master setting psu register 0x36 to 0x0000
[>0x5F] 0x36: 0x0C [S]               # master querying new value of register
[<0x5F] 0x36: 0xB2 0x03 0x4B         # slave responding with new max A 0x03B2 ~ 7A

[>0x5F] 0x0E: 0x34 [S]               # master querying psu for voltage
[<0x5F] 0x0E: 0x25 0x03 0xD8         # psu responds
[>0x5F] 0x10: 0x32 [S]               # master querying psu for amps
[<0x5F] 0x10: 0xB2 0x03 0x4B         # psu responds
[>0x5F] 0x36: 0x0C [S]               # master querying for max amps (again)
[<0x5F] 0x36: 0xB2 0x03 0x4B         # psu responds
3.14V 7.39A 7.39A (max)

Reading your code comments and the asm comments I understood that I should be able to do the same by accessing command 0x37.

cmd_not_35:             ; CODE XREF: ISR+2BAj
        movfw   i2c_cmd_code_copy2
        sublw   37 ; '7'
        bnz not_cmd_37
        bsf BANK0:STATUS, RP0
; assume bank = 1
        clrf    MaxRecordedCurrentLSB
        clrf    MaxRecordedCurrentMSB
        bcf BANK1:STATUS, RP0

Testing your python-code (without any hardware, just printing bytes to be sent) I get that I should send

0x37 0x00 0x00 0x0b

When I send the same from my test arduino, I get no change in any registers.

3.13V 7.37A 55.31A (max)
Resetting max amps
[>0x5F] 0x36: 0x0C [S]               # master querying psu for max amps at 0x36
[<0x5F] 0x36: 0xA8 0x1B 0x3D         # psu responding
[>0x5F] 0x37: 0x00 0x00 0x0B [S]     # master calling i2c cmd 0x37 
[>0x5F] 0x36: 0x0C [S]               # master querying psu for max amps at 0x36
[<0x5F] 0x36: 0xA8 0x1B 0x3D         # psu responding (no change)

[>0x5F] 0x0E: 0x34 [S]
[<0x5F] 0x0E: 0x22 0x03 0xDB
[>0x5F] 0x10: 0x32 [S]
[<0x5F] 0x10: 0xB2 0x03 0x4B
[>0x5F] 0x36: 0x0C [S]
[<0x5F] 0x36: 0xA8 0x1B 0x3D
3.13V 7.39A 55.31A (max)

Resetting max amps is just a test command. I would like to be able to access the more interesting commands like 0x3b etc.

Is it something I am missing here?

raplin commented 4 years ago

Oh nice, I should go mess with the feedback on mine too; would be handy to have this run at 5v or 3v3 sometimes. Mmmm not sure about the cmd thing; sorry I'm a bit too busy to get into this again, will be a few weeks at least

slundell commented 4 years ago

OK! Do you still have the IDA PRO project files?