Coexistence driver limits the pins for BLE_EIP from P00 up to P07

ID: LPCBARESDK-707

Status: Fixed

First reported: 6.0.14.1114

Fixed in: 6.0.22.1401

Description

The DA14531 and the DA14585 are able to expose the diagnostic pins (the BLE_EIP in the case of the coexistence driver) at pins:

  • For the DA14531 Diagnostic pins are available from P00 up to P011.

  • For the DA14585 Diagnostic pins are available from P00 up to P07 and from P10 up to P13.

The existing coex driver limits the BLE_EIP signal in both devices from P00 to P07. If the user tries to output the BLE_EIP signal on any other Diagnostic capable pin the SDK will assert an error. An update is required in the wlan_coex.c file for the following functions:

  • wlan_coex_gpio_cfg() for modifying the Assertion

  • wlan_coex_BLE_set() for properly configuring the diagnostic at the other available pins.

In the workaround section the updated functions are given supporting both DA14531 and DA14585/586 devices.

Workaround

void wlan_coex_gpio_cfg(void)
{
    // WLAN_COEX_BLE_EVENT can be applied on any pin for DA14531 and only on pins P0[0-7] and P1[1-3] for DA14585.
#if!(__DA14531__)
        ASSERT_WARNING((wlan_coex_cfg.ble_eip_pin <= GPIO_PIN_7) && (wlan_coex_cfg.ble_eip_port == GPIO_PORT_0) ||
                        (wlan_coex_cfg.ble_eip_pin <= GPIO_PIN_3) && (wlan_coex_cfg.ble_eip_port == GPIO_PORT_1));
#endif

    // Drive to inactive state the pin used for the BLE event in progress signal
    wlan_coex_set_ble_eip_pin_inactive();

    // Configure selected GPIO as output - BLE priority
    GPIO_ConfigurePin(wlan_coex_cfg.ble_prio_port, wlan_coex_cfg.ble_prio_pin, OUTPUT, PID_GPIO, false);

    // Configure selected GPIO as input with pull-down - 2.4GHz external device event in progress
    GPIO_ConfigurePin(wlan_coex_cfg.ext_24g_eip_port, wlan_coex_cfg.ext_24g_eip_pin, INPUT_PULLDOWN, PID_GPIO, false);

    // Configure 2.4GHz external device event in progress signal to act as a GPIO interrupt
    GPIO_RegisterCallback((IRQn_Type)(GPIO0_IRQn + wlan_coex_cfg.irq), ext_24g_eip_handler);
    GPIO_EnableIRQ(wlan_coex_cfg.ext_24g_eip_port, wlan_coex_cfg.ext_24g_eip_pin, (IRQn_Type)(GPIO0_IRQn + wlan_coex_cfg.irq),
                    /*low_input*/ false, /*release_wait*/ false, /*debounce_ms*/ 0);

#if defined (CFG_WLAN_COEX_DEBUG)
    GPIO_ConfigurePin(wlan_coex_cfg.debug_a_port, wlan_coex_cfg.debug_a_pin, OUTPUT, PID_GPIO, false);
    GPIO_ConfigurePin(wlan_coex_cfg.debug_b_port, wlan_coex_cfg.debug_b_pin, OUTPUT, PID_GPIO, false);
#endif
}
void wlan_coex_BLE_set(void)
{
    uint8_t shift;
    GPIO_PIN diag_en;
#if (__DA14531__)
    if ((wlan_coex_cfg.ble_eip_pin < GPIO_PIN_4) || (wlan_coex_cfg.ble_eip_pin > GPIO_PIN_7))
#else
    if (wlan_coex_cfg.ble_eip_pin < GPIO_PIN_4)
#endif
    {
#if (__DA14531__)
        if(wlan_coex_cfg.ble_eip_pin > GPIO_PIN_7)
        {
            diag_en = (GPIO_PIN)(wlan_coex_cfg.ble_eip_pin - GPIO_PIN_8);
            shift = diag_en * 8;
        }
        else
#endif
        {
            shift = wlan_coex_cfg.ble_eip_pin * 8;
            diag_en = wlan_coex_cfg.ble_eip_pin;
        }
        // Enable BLE event in progress
        SetBits32(BLE_DIAGCNTL_REG, DIAG0 << shift, 0x1F);
        SetBits32(BLE_DIAGCNTL_REG, DIAG0_EN << shift, 1);
    }
    else
    {
        shift = (wlan_coex_cfg.ble_eip_pin - 4) * 8;
        diag_en = wlan_coex_cfg.ble_eip_pin;
        // Enable BLE event in progress
        SetBits32(BLE_DIAGCNTL2_REG, DIAG4 << shift, 0x1F);
        SetBits32(BLE_DIAGCNTL2_REG, DIAG4_EN << shift, 1);
    }

    SetWord16(GPIO_BASE + 0x6 + (wlan_coex_cfg.ble_eip_port << 5) + (wlan_coex_cfg.ble_eip_pin << 1), 0x312);

#if defined (CFG_WLAN_COEX_BLE_EVENT_INV)
    SetBits32(BLE_DIAGCNTL3_REG, (DIAG0_INV << (diag_en * 4)), 1);
#endif
    SetBits32(BLE_DIAGCNTL3_REG, (DIAG0_BIT << (diag_en * 4)), 7);
}