I'm trying to demonstrate that I can write a value to a Nordic npm1300 register and read the same value back. Using the code below, I write 0x5a but read 0x0a, so the msb 5 is getting lost:
I'm trying to demonstrate that I can write a value to a Nordic npm1300 register and read the same value back. Using the code below, I write 0x5a but read 0x0a, so the msb 5 is getting lost:
If you look at the description of the register you are attempting to write (address 0x0601 corresponds to https://docs.nordicsemi.com/bundle/ps_npm1300/page/chapters/core_components/gpio/doc/frontpage.html#ariaid-title6), you can see that it uses only the lower 4 bits, so the msb 5 in your case is simply ignored. And yes, the number of bytes to write in the `i2c_write_dt` should be equal to the array size.
To get an idea of how to communicate with the PMIC through I2C it is worth taking a look at how the mfd_npm13xx driver implements this: github.com/.../mfd_npm13xx.c
Thank you, the problem was that I was writing/reading a four bit register.
Thank you, the problem was that I was writing/reading a four bit register.