fix(plip): SLIC hook polarity active-LOW (K50835F open-collector) + faithful PD open-drain
CI / platformio (pull_request) Failing after 11m29s
CI / platformio (pull_request) Failing after 11m29s
This commit is contained in:
@@ -43,7 +43,7 @@
|
||||
|
||||
/* ---------- SLIC K50835F / AG1171-class front-end (A1S board wiring) ---------- */
|
||||
/* KEY3=GPIO19, KEY4=GPIO23, KEY5=GPIO18, KEY6=GPIO5 share these pins — reassigned to SLIC */
|
||||
#define PLIP_SLIC_RM 18 /* Ring Mode output — HIGH = ring burst active */
|
||||
#define PLIP_SLIC_RM 18 /* Ring Mode output — HIGH = ring burst active */
|
||||
#define PLIP_SLIC_FR 5 /* Forward/Reverse output — toggled at 25 Hz for bell */
|
||||
#define PLIP_SLIC_SHK 23 /* Switch Hook input — HIGH = off-hook (active-high) */
|
||||
#define PLIP_SLIC_PD 19 /* Power Down (open-drain) — HIGH = SLIC active */
|
||||
#define PLIP_SLIC_SHK 23 /* Switch Hook input — active-LOW (K50835F open-collector) */
|
||||
#define PLIP_SLIC_PD 19 /* Power Down (open-drain) — HIGH = SLIC active */
|
||||
|
||||
+11
-18
@@ -20,10 +20,11 @@
|
||||
|
||||
#define TAG "slic"
|
||||
|
||||
/* Active-high hook polarity: HIGH on SHK = off-hook.
|
||||
* Source: hardware/projects/slic-phone/src/config/A252ConfigStore.cpp:262
|
||||
* cfg.hook_active_high = true; */
|
||||
#define SLIC_SHK_OFFHOOK_LEVEL 1
|
||||
/* K50835F SHK is OPEN-COLLECTOR ACTIVE-LOW: the SLIC pulls SHK LOW when the
|
||||
* loop is closed (off-hook) and releases it (pull-up → HIGH) when on-hook.
|
||||
* So off-hook = LOW. (A252 used active-high via an external inverter; the A1S
|
||||
* wires SHK straight to the GPIO, so the raw polarity is active-low.) */
|
||||
#define SLIC_SHK_OFFHOOK_LEVEL 0
|
||||
|
||||
static volatile bool s_ringing = false;
|
||||
static TaskHandle_t s_ring_task = NULL;
|
||||
@@ -88,23 +89,15 @@ esp_err_t slic_init(void)
|
||||
ret = gpio_config(&shk_cfg);
|
||||
if (ret != ESP_OK) return ret;
|
||||
|
||||
/* PD: Power Down — push-pull output HIGH = SLIC active (definite power-up).
|
||||
* Previous config (open-drain HIGH) left the line floating when no pull-up
|
||||
* is present on the bench, keeping the SLIC in power-down.
|
||||
* Push-pull HIGH drives the PD pin firmly high regardless of external resistors. */
|
||||
gpio_config_t pd_cfg = {
|
||||
.pin_bit_mask = (1ULL << PLIP_SLIC_PD),
|
||||
.mode = GPIO_MODE_OUTPUT, /* push-pull (pas OD) */
|
||||
.pull_up_en = GPIO_PULLUP_DISABLE,
|
||||
.pull_down_en = GPIO_PULLDOWN_DISABLE,
|
||||
.intr_type = GPIO_INTR_DISABLE,
|
||||
};
|
||||
ret = gpio_config(&pd_cfg);
|
||||
/* PD: Power Down — EXACT A252-proven sequence: open-drain output, HIGH = released
|
||||
* = SLIC active (setPowerDown(false) in Ks0835SlicController). This is the config
|
||||
* the working Arduino slic-phone project uses on the same chip. */
|
||||
ret = gpio_set_direction(PLIP_SLIC_PD, GPIO_MODE_OUTPUT_OD);
|
||||
if (ret != ESP_OK) return ret;
|
||||
ret = gpio_set_level(PLIP_SLIC_PD, 1); /* HIGH franc = SLIC actif */
|
||||
ret = gpio_set_level(PLIP_SLIC_PD, 1); /* open-drain released HIGH = active (A252-proven) */
|
||||
if (ret != ESP_OK) return ret;
|
||||
|
||||
ESP_LOGI(TAG, "slic: PD GPIO%d push-pull HIGH (SLIC power-up, franc)", PLIP_SLIC_PD);
|
||||
ESP_LOGI(TAG, "slic: PD GPIO%d open-drain HIGH (A252-proven active) — testing with fixed mic", PLIP_SLIC_PD);
|
||||
ESP_LOGI(TAG, "slic: pins RM=%d FR=%d SHK=%d PD=%d hook_active_high=1",
|
||||
PLIP_SLIC_RM, PLIP_SLIC_FR, PLIP_SLIC_SHK, PLIP_SLIC_PD);
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=2048
|
||||
|
||||
# SLIC hook GPIO — SHK on GPIO23 (A1S KEY4, active-HIGH: HIGH = off-hook)
|
||||
CONFIG_PLIP_HOOK_GPIO=23
|
||||
CONFIG_PLIP_HOOK_ACTIVE_HIGH=y
|
||||
CONFIG_PLIP_HOOK_ACTIVE_HIGH=n
|
||||
|
||||
# WiFi credentials — set via `idf.py menuconfig` (PLIP Voice Configuration)
|
||||
# or override locally in sdkconfig (NOT committed).
|
||||
|
||||
Reference in New Issue
Block a user