Skip to content

Reading GPIO16 on power up #8783

Closed
Closed
@joehui

Description

@joehui

Basic Infos

We are working on something that requires me to detect the state of GPIO16 inside user_rf_pre_init() - more specifically, in RF_PRE_INIT() in Arduino IDE.

Platform

  • Hardware: ESP-12F
  • Core Version: 3.0.2
  • Development Env: Arduino IDE / NONOS_SDK
  • Operating System: MacOS

Settings in IDE

  • Module: Nodemcu 1.0 (ESP-12E Module)
  • Flash Size: 4MB
  • lwip Variant: v2 Lower Memory
  • CPU Frequency: 160MHz
  • Upload Using: SERIAL
  • Upload Speed: 115200

Problem Description

We tried the following code, but it always returns me the same value:

RF_PRE_INIT()
{
  system_phy_set_powerup_option(2);
 
  GPIO_DIS_OUTPUT(GPIO_ID_PIN(16));
  int value = GPIO_INPUT_GET(GPIO_ID_PIN(16));
  GPIO_OUTPUT_SET(GPIO_ID_PIN(2), value );        //  Set LED based on state of Pin 16
}

We tried various APIs in NONOS_SDK, but none worked. For other GPIOs, we were able to do something like:

  PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTDI_U, FUNC_GPIO12);     
      OR
  PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTMS_U, FUNC_GPIO14);

before we setup the GPIO. But for GPIO16, there is no equivalent.

We understand that GPIO16 is part of the RTC system and is handled differently but we cannot find the appropriate example or documentation on reading GPIO16.

Help would be greatly appreciated!

Joseph

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions