Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hardware support for T-Beam V1.2 with AXP2101 #990

Open
XAct-6510 opened this issue Sep 26, 2023 · 21 comments · Fixed by #1015
Open

Hardware support for T-Beam V1.2 with AXP2101 #990

XAct-6510 opened this issue Sep 26, 2023 · 21 comments · Fixed by #1015

Comments

@XAct-6510
Copy link

Please add support for the new version of the Lilygo T-Beam V1.2 with the new power management chip AXP2101.

@cyberman54
Copy link
Owner

Can you provide link to specs of v1.2

@cyberman54
Copy link
Owner

In all your links, i can't find a schematic or specs for v1.2, it all renders as v1.1?

@XAct-6510
Copy link
Author

Yes, they hid this fact pretty well, unfortunately. By changing the PMU from AXP192 to AXP2102 they have changed the versioning from 1.1 to 1.2. Please see the screenshot.

V12

@cyberman54
Copy link
Owner

cyberman54 commented Oct 7, 2023

@XAct-6510 i checked the Xpowerslib example, and found that there is some refactoring of power.cpp needed. Could you do this, and make a PR?

@XAct-6510
Copy link
Author

Unfortunately I'm not a programmer, I'm a networking guy... But I can provide you one of my 5 T-Beam V1.2 if that helps.

@cyberman54
Copy link
Owner

@XAct-6510 not necessary, because if i would code it, you could test it on your board. But currently i have no time to code this.

@XAct-6510
Copy link
Author

As mentioned I'm not a programmer, but maybe this can be used?
https://github.com/meshtastic/firmware/blob/master/src/Power.cpp
The T-Beam V1.2 comes preinstalled with the Meshtastic firmware, which obviously works with the new hardware revision.

@cyberman54
Copy link
Owner

i saw that, but would stick to the example code of XPowersLib, because Meshtastic has more complexity. But again, you or someone else would be welcome to show up with a completely refactored power.cpp

@TD-er
Copy link
Contributor

TD-er commented Jun 10, 2024

Just for completeness, the schematics of the 1.2 version of the T-beam:
https://github.com/Xinyuan-LilyGO/LilyGo-LoRa-Series/tree/master/schematic

Also they split off the older boards, so here are all the LilyGo LoRa series schematics:
https://github.com/Xinyuan-LilyGO/LilyGo-LoRa-Series/tree/v0.0.1/schematic

@idimou
Copy link

idimou commented Jun 14, 2024

Anybody had a change to look at this guys?

@TD-er
Copy link
Contributor

TD-er commented Jun 14, 2024

I am looking into this.
First I am ironing out some issues with AXP192 (my PRs have just been merged) and then I will look into the AXP2101.

I have both versions here on my desk, but since those T-beam boards are quite expensive these days, I wanted to make sure I knew how it all should work.

@cyberman54
Copy link
Owner

I am looking into this. First I am ironing out some issues with AXP192 (my PRs have just been merged) and then I will look into the AXP2101.

I have both versions here on my desk, but since those T-beam boards are quite expensive these days, I wanted to make sure I knew how it all should work.

@TD-er I could do some testing. Received a T-Beam "Supreme" with AXP2101 this week. I finalized a hal file with matching pinout already, build paxcounter code for S3 and flashed it successfully on the T-Supreme. The board seems to be alive, because i can see the USB port triggers on reset. But nothing else happenes. Probably becaue AXP2101 is missing proper initialization, thus the board components are probably not powered.

@TD-er
Copy link
Contributor

TD-er commented Jun 27, 2024

I have been reading into the existing libraries.
There is even an example of how to make it runtime detectable.
This does require some changes like keeping a pointer to the base class.
See: https://github.com/lewisxhe/XPowersLib/blob/master/examples/XPowersLibInterface_Example/XPowersLibInterface_Example.ino

Still I'm puzzling a bit on how to make this as fool proof as possible as wrong settings for power chips like these can for sure ruin your device or stuff connected to it.

The last 2 weeks have been extremely unproductive for me, as apparently Covid is still lurking around and even though I've had it 3 times already, it still hits you every time.
At least I'm already feeling better now, so I will have another look at this code.

@cyberman54
Copy link
Owner

cyberman54 commented Jul 1, 2024

Support for T-Beam v1.2 is now implemented in branch feature-asp2101

Does anyone who reads this own this board, and could test, please? Thanks.
/cc @XAct-6510

@TD-er
Copy link
Contributor

TD-er commented Jul 1, 2024

For those willing to test, please double or triple check these lines first:
33486cc
I only can test it later this evening.

@XAct-6510
Copy link
Author

Can't get it to work yet - after flashing the new build the device hangs on boot:

rst:0x1 (POWERON_RESET),boot:0x12 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:1184
load:0x40078000,len:13232
load:0x40080400,len:3028
entry 0x400805e4
I (17) src/configmanager.cpp: Loading device configuration from NVRAM...
I (20) src/configmanager.cpp: Runtime configuration v3.6.2 loaded
I (21) src/main.cpp: Starting paxcounter_bb0aff61 v3.6.2 (runmode=0 / restarts=0 )
I (26) src/main.cpp: code build date: 1719913557
I (31) src/main.cpp: This is ESP32 chip with 2 CPU cores, WiFi/BT/BLE, silicon r evision 3, 4MB external Flash
I (40) src/main.cpp: Internal Total heap 225948, internal Free Heap 198120
I (47) src/main.cpp: ChipRevision 3, Cpu Freq 240, SDK Version v4.4.5
I (53) src/main.cpp: Flash Size 4194304, Flash Speed 40000000
I (59) src/main.cpp: Wifi/BT software coexist version 1.2.0
I (64) src/main.cpp: Wifi STA MAC: B0:B2:1C:5F:59:24
I (68) src/main.cpp: IBM LMIC version 1.6.1468577746
I (73) src/main.cpp: Arduino LMIC version 4.2.0.1
I (78) src/lorawan.cpp: DevEUI: 70B3D57ED00657F9
I (82) src/main.cpp: TinyGPS+ version 1.1.0
I (86) C:/Users/GIS-Team/.platformio/packages/framework-arduinoespressif32@3.200 11.230801/cores/esp32/esp32-hal-i2c.c: Initialising I2C Master: sda=21 scl=22 fr eq=100000
I (102) .pio/libdeps/usb/XPowersLib/src/XPowersCommon.tpp: SDA:21 SCL:22
W (107) C:/Users/GIS-Team/.platformio/packages/framework-arduinoespressif32@3.20 011.230801/libraries/Wire/src/Wire.cpp: Bus already started in Master Mode.
E (121) C:/Users/GIS-Team/.platformio/packages/framework-arduinoespressif32@3.20 011.230801/libraries/Wire/src/Wire.cpp: NULL TX buffer pointer
E (133) C:/Users/GIS-Team/.platformio/packages/framework-arduinoespressif32@3.20 011.230801/libraries/Wire/src/Wire.cpp: NULL TX buffer pointer
I (146) .pio/libdeps/usb/XPowersLib/src/XPowersAXP2101.tpp: ~XPowersAXP2101

@cyberman54
Copy link
Owner

Looks like the i2c bus did not initialize for some reason. Thus, there is no communication with the AXP2101 chip, so it does not power up all board circuits.

@cyberman54
Copy link
Owner

I can reproduce this with a T-Beam with AXP192 chip and single i2c bus.
The reason is that there is a conflict in power.cpp by the already opened i2c bus by i2c_init() from main.cpp. The code needs some refactoring here, e.g. using a pointer to the i2c object.

@cyberman54
Copy link
Owner

cyberman54 commented Jul 2, 2024

i committed a hot fix, it should work (please re-test), but yet to be discussed if this is a straight forward approach for boards with two i2c buses. /cc @XAct-6510

@XAct-6510
Copy link
Author

I have applied the hotfix and it is now working. I'm still running some tests, but it seems to be running fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants