That’s why i use the OLED powersave mode in the paxcounter software, not shutdown. Otherwise i2c bus will crash
When you “power down” your pull-up resistors, are you isolating each resistor from the other such that they are not loading the I2C via the two resistors effectively being connected in series across the I2C bus?
Good point.
No my resistors are still tied together and still connected to Vcc of the sensor. I power down all the sensors and pull-up resistors by open circuiting power supply line with a high side mosfet. Leaving Vdd and SDA and SCL still connected to the processor.
There’s nothing wrong with that, if you take both SDA and SCL low at the MCU. There would only be a problem if you kept them high, or too only one of them low. A resistor without a voltage difference across it doesn’t turn electricity into heat.
Thanks, I’m still trying to manage AXP, but i still can’t initialize it, while, i have a doubt, if i disconnect ground pin of 5V device (such a accelerometer) instead VBUS pin, is more dangerous for board? Disconnecting VBUS, device still maintains power led on, but low intentisty, and device not work, perhaps is getting power from SCL and SDA pin and i think it is dangerous. But if i disconnect GND pin, device switchs off completely.
Thanks, i’ll buy a step-up voltage converter, to raise voltage to 5v.
I’m still trying to work with AXP but still not initialize, i’m using a axp20.h library of m5stack, i can’t found it in your github PaxCounter, seems no longer uses that library, but it used in past. How can i get it? Thanks again!!!
If you are using the Arduino IDE, you need to install the AXP202x library by hand.
If you are using Platformio IDE (like paxcounter), the IDE will grab and install it for you.
Does it sure make sense to have a voltage conversion 5V to 5V like this?
5V USB -> VBUS -> DCDC (AXP192) -> 3V3 -> DCDC(MT3608) -> 5V
Well, working with battery, board will work about 3.5 - 4.2v, so internally board would have a step-up converter too, to supply VBUS isn’t it?
But you are right, to save energy i need to find a accelerometer and a pulsometer that works with 3.3v… really this devices will work only along 20 seconds each 2 minutes, (i will catch values and go to sleep board 2 minutes).
btw, it’s for a sheep or a cow (Smart Farming)
Updated! I switched to platformio as suggested, project works. I’ll continue in platformio, but AX192 still fails initalizing in this line
if (pmu.begin(Wire, (0x34)))
I have build flags;
build_flags = -DCORE_DEBUG_LEVEL=5
but still show nothing about errors in terminal or debug console…
any idea how log i2c errors in platformio?
Many thanks!
If you have debug level 5 and don’t see i2c errors from esp32-arduino core, there won’t be any i2c errors. The i2c hal by stickbreaker in esp32-arduino normally talks a lot when the bus has errors. Check your hardware (i.g. i2c pullup resistors and voltage level) and i2c settings in your software (e.g. SCL/SDA lines/wiring).
Done!
Only replacing this line
if (pmu.begin(Wire, AXP192_PRIMARY_ADDRESS)) {
by those 2 lines:
Wire.begin(21, 22);
if (pmu.begin(Wire, AXP192_SLAVE_ADDRESS))
And AXP intialized and ¡3.5v on 3V3 pin!!!
On the other hand i damaged the board because a bad multimeter, board blue led (charge battery led) is always blinking like charging, but without battery. if i try to put on a battery, components around blue led going very hot fast… but never mind, it was worth it, this board still works under usb and still is valid to make tests and works connected to external usb battery, i have 2 more boards like that and i can now go ahead with my mad project. Thanks a lot!!!
The blue led is directly controlled by AXP192 pmu chip, it’s behaviour can be configured by software. Blinking, even without battery, can be normal, depending on software settings.
AXP192_PRIMARY_ADDRESS
and AXP192_SLAVE_ADDRESS
both are aliases for 0x34, but obviously pasted from different libraries (paxcounter / axp202x)
-> you should sanitize your code and know what you’re doing!
Yes, after all tests, my code is madness.
Finally problem was only this missing line
Wire.begin(21, 22);
@borroz …and now i ran into the problem. What’s a straight forward way to reset the i2c bus on ESP32 with arduino-esp32 core after waking up from deep sleep? I don’t need to restore it’s state, will do a full re-init, but coming from warmstart after deepsleep. Thus don’t have hardware reset of GPIOs.
on ESP32 I’m not sure… arduino is just re init the sensor
Re-init i2c devices is of course mandatory. But for this i need a working i2c bus. After waking up from deep sleep i get
[W][esp32-hal-i2c.c:1411] i2cCheckLineState(): invalid state sda(21)=0, scl(22)=0
[E][esp32-hal-i2c.c:1426] i2cCheckLineState(): Bus Invalid State, TwoWire() Can't init sda=0, scl=0
I tried a Wire.~TwoWire()
before to reset the i2c bus driver - but no success. Maybe the GPIOs need a certain treatment after waking up from deep sleep?
I read something about reconfiguring SDA line upon recover from deep sleep ?
How to
That makes it sound like your pins are stuck low. Might be the ESP, might be something else holding them down.
One debugging trick can be to insert small series resistors in the bus. Then, by seeing (ordinarily with a scope, in this case even with a meter) the direction of voltage drop across them, you can see if it is the processor or peripherals holding the lines down.
sorry… I googled ’ esp32 after deep sleep i2c ’ and forgot the link
seems to be a problem … hope I find the work around again
think it was this one
’ I need to reconfigure the SDA line upon recover from deep sleep:
Code: Select all
rtc_gpio_deinit(SU_HARDWARE_I2CSDA)