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

LILYGO T-Watch-S3 #9480

Merged
merged 11 commits into from
Aug 12, 2024
Merged

LILYGO T-Watch-S3 #9480

merged 11 commits into from
Aug 12, 2024

Conversation

bill88t
Copy link

@bill88t bill88t commented Aug 4, 2024

A board (or I should better say, a normal looking watch) from LILYGO.
Got it from the official aliexpress store. Similar to lilygo_twatch_2020_v3.

Note:
For supporting all of the hardware out of the box, a few frozen modules were added that are not by adafruit, or by me.
While I am actively testing them, these modules seem pretty final.
If adding frozen modules of 3rd parties without their knowledge is an issue, I am willing to fork & pledge to maintain them.

Task checklist:

  • Display.
  • Pins.
  • USB-PID/VID PR.
  • TinyUF2 PR.
  • PMIC module (AXP2101).
  • Test PMIC.
  • axis sensor module (BMA423).
  • Test axis sensor.
  • FAIL | Test mic (idk how). NotImplementedError: PDMIn
  • IR blaster module (IRRemote).
  • Test IR blaster.
  • RTC module (PCF8563).
  • Test RTC.
  • Haptics module (DRV2605).
  • Test haptics.
  • Touchscreen module (FocalTouch).
  • Test touchscreen.
  • Speaker (audiobusio).
  • Test speaker.

There is also a SX1262, but there is currently no working driver, so not including for now.

@tannewt
Copy link
Member

tannewt commented Aug 5, 2024

Thanks! Just ordered one for myself.

This doesn't work with SX1262
@bill88t
Copy link
Author

bill88t commented Aug 9, 2024

IMPORTANT!

This board does some pretty weird AXP2101 with the RTC, and the docs are wrong.

To get all the hw to work, the following configuration commands must be run after the pmic is loaded:

pmic._aldo1_voltage_setpoint = 3300
pmic._bldo1_voltage_setpoint = 0
pmic._bldo2_voltage_setpoint = 3300
pmic._aldo1_voltage_setpoint = 3300
if pmic._read_register8(24) != 15:
    pmic._write_register8(24, 15) # Charge VBackup at 3v3

If the coin cell battery is not charged for an extended period of time the RTC will not advance (it will set the time and not tick).

Optionally, to configure the power button to behave a bit more normally:

if pmic._read_register8(39) != 31:
    pmic._write_register8(39, 31) # 2s on time, 10s off time

I will provide the commands to init all the hardware once I have everything working.

Technical details They claim PCF8563 is powered through ALDO1, however in the schematic we can see the path exists, but is disconnected due to a NC.
Instead the rtc takes it's power from VBackup. Configuring VBackup is not something the current library supports.
Register `24` is `0x18` which is responsible for all the charging and efuel stuff.
Value `15` is `0xF` and sets the bits as `0000 1111`, which is the correct charging voltages limits and stuff.
At least that's what I think for now. I'll test some more stuff later.
I did test with a multimeter and verified the coin cell is being charged.

@bill88t bill88t marked this pull request as ready for review August 12, 2024 12:32
@bill88t
Copy link
Author

bill88t commented Aug 12, 2024

The PR is kinda ready, I'll update the branch and fix the merge conflicts in a moment.

Hardware init guide:

PMIC (AXP2101)
import board
from axp2101 import AXP2101
pmic = AXP2101(board.I2C())
pmic._aldo1_voltage_setpoint = 3300
pmic._bldo1_voltage_setpoint = 0
pmic._bldo2_voltage_setpoint = 3300
if pmic._read_register8(24) != 15:
    pmic._write_register8(24, 15) # Charge VBackup at 3v3
if pmic._read_register8(39) != 31:
    pmic._write_register8(39, 31) # 2s on time, 10s off time
Axis + temperature sensor (BMA423)
import board
from bma423 import BMA423
bma = BMA423(board.I2C())
Speaker (MAX98357A)
import board, audiobusio
audio = audiobusio.I2SOut(board.I2S_BCK, board.I2S_WS, board.I2S_DOUT)
Vibrator (DRV2605)
import board
import adafruit_drv2605
i2c = board.I2C()
drv = adafruit_drv2605.DRV2605(i2c)
RTC (PCF8563)
import board
from adafruit_pcf8563.pcf8563 import PCF8563
i2c = board.I2C()
rtc = PCF8563(i2c)
Touchscreen (FocalTouch)
from adafruit_focaltouch import Adafruit_FocalTouch
i2c = board.I2C()
ftouch = Adafruit_FocalTouch(i2c)
IR LED
import pulseio
import board
import adafruit_irremote
pulseout = pulseio.PulseOut(board.IR_LED, frequency=38000, duty_cycle=2**15)
encoder = adafruit_irremote.GenericTransmit(
    ...
)

Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@tannewt tannewt merged commit f064354 into adafruit:main Aug 12, 2024
538 checks passed
@bill88t bill88t deleted the tws3 branch August 12, 2024 16:50
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 this pull request may close these issues.

2 participants