Author Topic: PAC1941T-1E Power Monitor Assistance  (Read 1304 times)

0 Members and 1 Guest are viewing this topic.

Offline aFormidableFriendTopic starter

  • Newbie
  • Posts: 7
  • Country: us
  • EE Monkey Brain
PAC1941T-1E Power Monitor Assistance
« on: January 01, 2024, 08:34:38 pm »
Hello everyone, I have been trying to get this PAC1941T-1E power monitor IC to work for a while now and I just feel dumb |O. My friend told me about this forum and that I might find assistance here, so here I am new to the forum. I am still in university and I am fairly new to getting newly ordered parts to work properly with only a datasheet to rely on.

So, I have hot air soldered the IC to a QFN 16 pin breakout board (I'm also pretty new to hot air soldering) and my setup at the moment is I am using an Arduino Uno R3 connected to the power monitor via i2c. I have set the i2c address to 0x10 by tying the ADDRSEL pin to ground per the datasheet, and I have also confirmed that this is the correct i2c address using an i2c address scanner script in Arduino. Pin 2 is tied to VDD, pin 3 is tied to GND, pin 4 and 5 are the i2c pins tied to the Arduino's i2c pins, and I am using pins 11 and 12 as the SENSE+ and SENSE- pins which are across a simple LED and sense resistor circuit I made to just try and measure a current, voltage, and power. I feel like the hardware is correct because I am technically talking to the sensor.

Power monitor:
https://www.digikey.com/en/products/detail/microchip-technology/PAC1941T-1E-4MX/13985740

Breakout board:
https://www.digikey.com/en/products/detail/artekit-labs/DA-QFN16-3X3P50/20485371

Sense resistor:
https://www.digikey.com/en/products/detail/vishay-dale/SR3R0100FE66/7560304

I am using the Arduino IDE to write the code to talk to the chip with the Wire library. I saw that there was embedded software support from the Microchip manufacturer's website, but I am not really sure how to apply it or if even works with Arduino. I've only ever coded a microcontroller in an Arduino IDE. I have used Wire.read() to read from specific registers that the datasheet says you should read from to see a power measurement, and I am getting just fake results in the serial monitor such as 65535 or something similar. I am not sure what I need to do to get these registers to display the correct results. I can upload my code if needed, but I am not sure the protocols of the forum. Should I even be trying to code this in Arduino? I really need this power monitor to work for a school project. Any help or suggestions would be greatly appreciated. Thanks in advance.
« Last Edit: January 01, 2024, 09:18:04 pm by aFormidableFriend »
 

Offline PlainName

  • Super Contributor
  • ***
  • Posts: 7754
  • Country: va
Re: PAC1941T-1E Power Monitor Assistance
« Reply #1 on: January 01, 2024, 09:05:51 pm »
Quote
I feel like the hardware is correct because I am technically talking to the sensor.

but

Quote
I have used Wire.read() to read from specific registers that the datasheet says you should read from to see a power measurement, and I am getting just fake results in the serial monitor such as 65535 or something similar.

So maybe you're not talking to the chip after all. Could be anything, but manually soldering that type of package can easily be a fail until you get the knack.

First, if you haven't already verified, you need to check that you are actually talking to the chip (and that it can reply, and you can read the reply). So read the config register (0x01) and change the upper 8 bits to something recognisable (lower 4 bits are fixed). This is a read-modify-write operation, then you read the new value back and check that it is what you wrote. If that passes then you are indeed communicating with the chip and we know where to start looking for the problem.
 

Offline aFormidableFriendTopic starter

  • Newbie
  • Posts: 7
  • Country: us
  • EE Monkey Brain
Re: PAC1941T-1E Power Monitor Assistance
« Reply #2 on: January 01, 2024, 09:55:00 pm »
Thanks for your response. I have done as you suggested and I am getting 770 in hex which is 0000 0111 0111 0000 in binary if I've written my code correctly. According to the datasheet, does this mean that the power monitor is operating as:

bits 15-12 (0000): 1024 SPS adaptive accumulation
bits 11-10 (01): GPIO digital input
bits 9-8 (11): SLOW function (not sure what this is)
bits 7-4 (0111): Channel 1 is active?
bits 3-0 (0000): Unimplemented
 

Offline PlainName

  • Super Contributor
  • ***
  • Posts: 7754
  • Country: va
Re: PAC1941T-1E Power Monitor Assistance
« Reply #3 on: January 01, 2024, 10:18:34 pm »
OK, if you change bits 15-12 to, say, 0101 and 7-4 to 1010, do they stick if you write that and then read it back?
 

Offline aFormidableFriendTopic starter

  • Newbie
  • Posts: 7
  • Country: us
  • EE Monkey Brain
Re: PAC1941T-1E Power Monitor Assistance
« Reply #4 on: January 01, 2024, 11:03:25 pm »
It looks like the read/write functionality is working, sorta. So the default register was 0x770, whenever I write 0x7B0 to it, it returns 0x7F0. Then if I rewrite 0x770 to it, it goes back to 0x770. Whenever I write 0x5A0, it returns 0x5F0. Something about bits 7-4 are not exactly working. I am not sure what that is about, but I am definitely able to read and write to this register.
« Last Edit: January 01, 2024, 11:11:33 pm by aFormidableFriend »
 

Offline Shonky

  • Frequent Contributor
  • **
  • Posts: 298
  • Country: au
Re: PAC1941T-1E Power Monitor Assistance
« Reply #5 on: January 01, 2024, 11:27:55 pm »
Got pull ups on your I2C lines?
Do you have a scope to look at SDA and SCL?
 

Offline PlainName

  • Super Contributor
  • ***
  • Posts: 7754
  • Country: va
Re: PAC1941T-1E Power Monitor Assistance
« Reply #6 on: January 01, 2024, 11:34:07 pm »
Quote
So the default register was 0x770

Looks promising - it's the default value for that register (datasheet attached). But writing 0x7B0 should return that too. I  think the answer to Shonky's question re pullups might be instructive :)
 

Offline aFormidableFriendTopic starter

  • Newbie
  • Posts: 7
  • Country: us
  • EE Monkey Brain
Re: PAC1941T-1E Power Monitor Assistance
« Reply #7 on: January 01, 2024, 11:51:15 pm »
I do not have pull ups attached to the I2C lines. I will admit I do not have much experience with pull-up and pull-down resistors as I am just learning about physically implementing a lot of this new circuitry. I should just place these resistors across SDA and VDD, and SCL and VDD? I do have a scope available to measure SDA and SCL.
 

Offline Shonky

  • Frequent Contributor
  • **
  • Posts: 298
  • Country: au
Re: PAC1941T-1E Power Monitor Assistance
« Reply #8 on: January 02, 2024, 12:08:07 am »
Your set up and Arduino library is probably relying on internal pull ups but they're probably not ideal for I2C.

Try somewhere in the 4.7k or 10k from SDA to Vcc/Vdd (whatever your supply rail is to the device) and from SCL to Vcc/Vdd
« Last Edit: January 02, 2024, 12:10:13 am by Shonky »
 

Offline aFormidableFriendTopic starter

  • Newbie
  • Posts: 7
  • Country: us
  • EE Monkey Brain
Re: PAC1941T-1E Power Monitor Assistance
« Reply #9 on: January 02, 2024, 12:23:13 am »
Alright I have some 4.7k ohm pull-ups on SCL/SDA now. I tried both 4.7k and 10k and I am still having the issue of not being able to fully write to the CTRL register for some reason (same results as previous post). If I can't modify the control register as I need, then I can't even properly activate the right channels that I'd like to use. I bought multiples power monitors in case I messed something up, I could try soldering up a new one on a breakout as a worst case scenario.
 

Offline PlainName

  • Super Contributor
  • ***
  • Posts: 7754
  • Country: va
Re: PAC1941T-1E Power Monitor Assistance
« Reply #10 on: January 02, 2024, 12:47:06 am »
Try writing a variety of patterns to register 0x44 (OC Limit NSamples register). All bits are read/writable, and it's an 8-bit (thus single byte) register. You should read back exactly what you write.

If that works, do the same for register 0x27 (Slow Alert1 register). That's 24-bits, so three bytes. Again, you should read back exactly what you write except for bit 0, which should always be 0.

If these pass then we know you can successfully transfer single byte and multi-byte. Perhaps the issue with the control register is that it's two bytes.
 

Offline aFormidableFriendTopic starter

  • Newbie
  • Posts: 7
  • Country: us
  • EE Monkey Brain
Re: PAC1941T-1E Power Monitor Assistance
« Reply #11 on: January 02, 2024, 01:45:01 am »
Ok, I've confirmed that I can write to 0x44 and return a single byte, and 0x27 and return all 3 bytes as expected. After further investigation, apparently the control register needs a refresh command sent after you make changes to it. So I am trying to figure out how to get that to work properly.
 

Offline PlainName

  • Super Contributor
  • ***
  • Posts: 7754
  • Country: va
Re: PAC1941T-1E Power Monitor Assistance
« Reply #12 on: January 02, 2024, 10:45:41 am »
OK, sounds good. That kind of thing, the refresh detail, is normal at this stage :)
 

Offline aFormidableFriendTopic starter

  • Newbie
  • Posts: 7
  • Country: us
  • EE Monkey Brain
Re: PAC1941T-1E Power Monitor Assistance
« Reply #13 on: January 03, 2024, 12:55:00 am »
Update: Although I can't modify the control register, which is very unfortunate because I need to operate multiple channels, I am able to read values now from the Vbus and Vsense channel 1 registers. Now I just need to do the conversions in the datasheet to make sense out of the values. I will likely have to manually verify that the values I should be seeing are accurate due to my multimeter not being able to measure down to the 10 milli-ohm sense resistor's level. When I multimeter across the sense resistor, I am reading 0 V, but the Vbus and Vsense registers are giving me values.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf