ESP32 Board with AXP192 Power management

For general Flowcode discussion that does not belong in the other sections.
Post Reply
stefan.erni
Valued Contributor
Posts: 760
http://meble-kuchenne.info.pl
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 150 times
Been thanked: 171 times

ESP32 Board with AXP192 Power management

Post 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 3007 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 145 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

BenR
Matrix Staff
Posts: 1754
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 445 times
Been thanked: 605 times

Re: ESP32 Board with AXP192 Power management

Post 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 144 times

BenR
Matrix Staff
Posts: 1754
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 445 times
Been thanked: 605 times

Re: ESP32 Board with AXP192 Power management

Post by BenR »

Here's another version with the write function.
FC9_M5Stack1_spi_display_adx192-1.fcfx
(17.22 KiB) Downloaded 153 times

stefan.erni
Valued Contributor
Posts: 760
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 150 times
Been thanked: 171 times

Re: ESP32 Board with AXP192 Power management

Post 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

stefan.erni
Valued Contributor
Posts: 760
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 150 times
Been thanked: 171 times

Re: ESP32 Board with AXP192 Power management

Post 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

BenR
Matrix Staff
Posts: 1754
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 445 times
Been thanked: 605 times

Re: ESP32 Board with AXP192 Power management

Post 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?

Post Reply