Thanks, 2 questions?
DCD1 can ouput 5Volts?
What is the AXP Primary Address of my board? 0x34 ??
ketch always say that initialization failed
I have this simple sketch, i think that at any moment i switch off (I hope no damage it) lora and i can’t switch on again (it outputs error):
17:21:06.903 -> FAILURE
17:21:06.903 -> /home/carlos/Arduino/libraries/arduino-lmic-master/src/lmic/radio.c:818
// Basic config
#include “axp20x.h”
#define AXP192_PRIMARY_ADDRESS (0x34)
AXP20X_Class pmu;
void AXP192_power(bool on) {
if (on) {
pmu.setPowerOutPut(AXP192_LDO2, AXP202_ON); // Lora on T-Beam V1.0
pmu.setPowerOutPut(AXP192_LDO3, AXP202_ON); // Gps on T-Beam V1.0
pmu.setPowerOutPut(AXP192_DCDC1, AXP202_ON); // OLED on T-Beam v1.0
// pmu.setChgLEDMode(AXP20X_LED_LOW_LEVEL);
pmu.setChgLEDMode(AXP20X_LED_BLINK_1HZ);
} else {
pmu.setChgLEDMode(AXP20X_LED_OFF);
pmu.setPowerOutPut(AXP192_DCDC1, AXP202_OFF);
pmu.setPowerOutPut(AXP192_LDO3, AXP202_OFF);
pmu.setPowerOutPut(AXP192_LDO2, AXP202_OFF);
}
}
void AXP192_init() {
if (pmu.begin(Wire, AXP192_PRIMARY_ADDRESS)) {
Serial.println("AXP192 PMU initialization failed");
}
else {
Serial.println(“Initialization…”);
// configure AXP192
pmu.setDCDC1Voltage(3300); // for external OLED display
pmu.setTimeOutShutdown(false); // no automatic shutdown
pmu.setTSmode(AXP_TS_PIN_MODE_DISABLE); // TS pin mode off to save power
// switch ADCs on
pmu.adc1Enable(AXP202_BATT_VOL_ADC1, true);
pmu.adc1Enable(AXP202_BATT_CUR_ADC1, true);
pmu.adc1Enable(AXP202_VBUS_VOL_ADC1, true);
pmu.adc1Enable(AXP202_VBUS_CUR_ADC1, true);
// switch power rails on
AXP192_power(true);
// I2C access of AXP202X library currently is not mutexable
// so we better should disable AXP interrupts... ?
#ifdef PMU_INT
pinMode(PMU_INT, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(PMU_INT), PMUIRQ, FALLING);
pmu.enableIRQ(AXP202_VBUS_REMOVED_IRQ | AXP202_VBUS_CONNECT_IRQ |
AXP202_BATT_REMOVED_IRQ | AXP202_BATT_CONNECT_IRQ |
AXP202_CHARGING_FINISHED_IRQ,
1);
pmu.clearIRQ();
#endif // PMU_INT
Serial.println("AXP192 PMU initialized");
}
}
void setup() {
Serial.begin(115200);
// put your setup code here, to run once:
AXP192_init();
AXP192_power(true);
}
void loop() {
}