SOTAmat / SOTAcat

CAT control for Elecraft KX radios and SOTAMAT
https://sotamat.com
Other
11 stars 2 forks source link

minimal changes for hardware rev 0.3 support #42

Closed poynting closed 3 months ago

poynting commented 7 months ago

@brianmathews @jeffkowalski these are the minimal changes required to support my rev 0.3 hardware (per the earlier schematic posted in slack). The general changes are:

  1. Moved the SOTAcat TX KX RX pin to GPIO4 to deconflict with the fsbl outputs
  2. Removed the second control line for the red/amber LED
  3. Added inverting hardware buffers, so the inversion is no longer required
  4. Added a USB detection pin on GPIO3

These are the minimum to support out of the box. In addition,

  1. Added an I2C/SMBus battery monitor IC ( MAX17260) using GPIO6 and GPIO7

How do we want to fold this in? Should we add a separate PIO definition for these changes? My next step is to start working on the driver for the MAX17260; I've already confirmed that it's responding on the I2C bus using the settings below.

jeffkowalski commented 7 months ago

Awesome, Justin!
Is there a way we could detect your HW at runtime, rather than making a different build target?

poynting commented 7 months ago

GPIO 5/6/7 are pulled up to 3.3V on my board with 4.7k. We could potentially use one or more of those (probably 6 or 7 since 5 is tied to nALRT on the battery monitor) and set a weak pull down in the chip, then read the line. If the line(s) are low, it's not one of these boards. I'm pretty sure that the nALRT pin will never be low before configuring the battery monitor IC and enabling alerts, but there's the possibility of a reboot of the ESP32 when the IC is already configured (e.g. during development).

This should work since the 4.7k is much stronger than the weak pull-down in the IC. After we check we will want to make sure to de-init those pins to remove the pulldown prior to continuing with initialization.

REV 0.3 schematic: image

REV 0.2 schematic / AB6D default setup image

brianmathews commented 7 months ago

Nice work Justin! If we can sense your board as you describe then I agree we should just fold it into the current project. Your changes would only require minimal changes to the current code and I would love to have one firmware installer to deal with (both for the WebSerial firmware installer, and for Jeff's OTA firmware updater).

I like how you use VBAT on the transmit side to the radio (a little extra punch), and 3.3V on the receiving inverter side. Makes sense.

The inverting UART drivers will pull current when the ESP32 goes into deep sleep mode, unless we can pull pin 3 low before sleep and hold it there. The input inverter will be based on the float (or the radio if connected). 0.4mA-ish?

I wonder if we should move from a 300mAH battery to a 480mAH for two reasons: cold weather use (Paul Mower) and because of the Seeed Studio's high charge rate. If we do change batteries, it would be nice to have the battery connector match a specific (reliable) LiPo manufacturer's part. I see you have both JST-SH and PicoBlade - I hope that matches to a correct shape of 480mAH.