Page 1 of 1

ESP32 Board with AXP192 Power management

Posted: Wed Jan 06, 2021 4:23 pm
by stefan.erni
Hi Ben

On my board I have AXP192 Power management IC.
I like to read a register and later write in the register
I have a sample code but I don't know to translate this in flowcode.
I'm always reading 255
read_reg_2021-01-06_17-13-00.png
read_reg_2021-01-06_17-13-00.png (59.55 KiB) Viewed 6452 times

here the democode:
uint8_t AXP192::Read8bit( uint8_t Addr )
{
Wire1.beginTransmission(0x34);
Wire1.write(Addr);
Wire1.endTransmission();
Wire1.requestFrom(0x34, 1);
return Wire1.read();
}
Here my program:
FC9_M5Stack1_spi_display_adx192-1.fcfx
(14.4 KiB) Downloaded 481 times
Some info about all the register:
https://github.com/RolandoMagico/TTGO-T ... nformation


regards


Stefan

and the democode:
https://github.com/m5stack/M5StickC/blo ... AXP192.cpp

Re: ESP32 Board with AXP192 Power management

Posted: Wed Jan 06, 2021 4:43 pm
by BenR
Hi Stefan,

You were on the right track.

Give this a whirl, fingers crossed :D
FC9_M5Stack1_spi_display_adx192-1.fcfx
(15.58 KiB) Downloaded 556 times

Re: ESP32 Board with AXP192 Power management

Posted: Wed Jan 06, 2021 4:46 pm
by BenR
Here's another version with the write function.
FC9_M5Stack1_spi_display_adx192-1.fcfx
(17.22 KiB) Downloaded 579 times

Re: ESP32 Board with AXP192 Power management

Posted: Wed Jan 06, 2021 5:40 pm
by stefan.erni
Hi Ben

I tried both versions but I always get 0. With the oscilloscope I have clock and data on the correct pin.

regards

Stefan

Re: ESP32 Board with AXP192 Power management

Posted: Wed Jan 06, 2021 5:59 pm
by stefan.erni
Hi Ben

I think the register 32h is 0.

I tried some another register with your first code and there I get the correct value.


regards

Stefan

Re: ESP32 Board with AXP192 Power management

Posted: Wed Jan 06, 2021 6:19 pm
by BenR
Hi Stefan

In the example code there is a far bit in the initialise function code. It might be it needs setting up to work as expected?