Skip to main content
Topic: Confirm register is written (Read 685 times) previous topic - next topic

Confirm register is written

Hello Dangerous Prototypes Forum,

I have recently acquired a bus pirate, which I'm using to communicate with a custom device over i2c. My device uses 1.2V, so the bus pirate is connected to a level converter (https://www.sparkfun.com/products/15439).

This is my first time communicating with a device via i2c, so I'm not sure if I'm doing it correctly. I have a list of registers for the device which need to be set to some value. Using the 7bit address search macro, I can see my device address:
Code: [Select]
0xE4(0x72 W) 0xE5(0x72 R)

To set a register value, I'm using this command:
Code: [Select]
[0xE4 0x1F 0x55]
which as I understand should set the value of register 0x1F of my device to 0x55. Is this correct?

To confirm that the register has been written, I use this command:
Code: [Select]
[0xe4 0x1f [0xE5 r]
and get this output:
Code: [Select]
I2C START BIT
WRITE: 0xE4 ACK
WRITE: 0x1F ACK
I2C START BIT
WRITE: 0xE5 ACK
READ: 0x00
NACK
I2C STOP BIT
which I'm interpreting to mean that the register has not been written.

Is my syntax correct? Am I writing/reading correctly? If my commands look correct, that would help me determine if the problem is with the custom device and not with me.

Thank you for your assistance.




 

Re: Confirm register is written

Reply #1
Setting register value seems OK. Usually the datasheet gives what commands to use. But you said this is a custom device so I cannot say this works 100% without looking at the datasheet or explanation of the communication protocol. Same goes for reading, you may need to write some other value to read from that particular register.

There is another variant of the read command, that may work. Try:
Code: [Select]
[0xE4 0x1F]
[0xE5 r]