Hello,

I'm trying to enable GPIO28 internal pull-up but there is low-level at MCU pin in all cases, except GPIO28 was configured as output and set to be one (high level). But if I set GPIO_CFGCTL14 = 0x0B030B17 (GPIO28 function SWGPIO, GPIO Pull Up Control = 1 , GPIO Driving Control = 1, GPIO SMT Control = 1, GPIO Input Enable = 1) MCU pin number 31 still have low level (no pull-up). There is only 1 MOhm external pull-down resistor on this line to prevent it from floating and so it couldn't be source of such issues.

What I'am missing? May be this is special pin and it should be specially configured to get pull-up resistor enabled?

Addition #1:
Pull-up initialization fails if I'm using LHAL (SDK v2.0) function:

        bflb_gpio_init(gpio,
	               GPIO_PIN_28,
	               GPIO_INPUT
	               | GPIO_PULLUP
	               | GPIO_SMT_EN
	               | GPIO_DRV_0);

But if I call GLB_GPIO_Init() for GPIO_28 pull-up initialization it works:

	GLB_GPIO_Cfg_Type gpio_cfg = {
		.gpioPin  = UC_MF_BTN_PIN,
		.gpioFun  = GPIO_FUN_GPIO,
		.gpioMode = GPIO_MODE_INPUT,
		.pullType = GPIO_PULL_UP,
		.drive    = 0,
		.smtCtrl  = 1,
	};
	GLB_GPIO_Init(&gpio_cfg);

The main difference between this two functions is undocumented register 0x40000088 (GLB_GPIO_USE_PSRAM__IO) usage in GLB_GPIO_Init():

    realPin = gpioPin;
    /* sf pad use exclusive ie/pd/pu/drive/smtctrl */
    if (gpioPin >= 23 && gpioPin <= 28) {
        if ((BL_RD_REG(GLB_BASE, GLB_GPIO_USE_PSRAM__IO) & (1 << (gpioPin - 23))) > 0) {
            realPin += 9;
        }
    }

So this issues are definitely caused by errors in new LHAL API implementations for GPIO controller in BL702.

    do not support gpio23 ~ gpio28 for bl702, you are right, becaue of GLB_GPIO_USE_PSRAM__IO

    • makc replied to this.

      asaki there is no description for GLB_GPIO_USE_PSRAM__IO register in provided reference manual, but if I use GLB_GPIO_Init() for initialization, then I can successfully control GPIO_28 as input with internal pull-up, and as output GPIO pin. So I definitely sure, that there is support for this GPIO in legacy SDK, but newer SDK 2.0 LHAL drivers doesn't properly handle this GPIOs and should be modified to add such support (add GLB_GPIO_USE_PSRAM__IO handling in bflb_gpio_init()).

        Write a Reply...
        @ 2025 Bouffalo Lab (Nanjing) Co., Ltd. All rights reserved.