Use this forum to chat about hardware specific topics for the ESP8266 (peripherals, memory, clocks, JTAG, programming)

User avatar
By 123francoz
#45038 Hi everyone, i'm new here,
i got my ESP8266 yesterday and i already started playing with it on Arduino IDE.
After testing some wifi examples, i went through hardware benchmarking,
i'm now able to set and clear a single GPIO with these instructions, (example on GPIO2):
Code: Select all    GPOS = 1<<2;
    GPOC = 1<<2;

that i found in the "core_esp8266_wiring_digital.c" file.
Now i need to manipulate multiple GPIOs at the same time,
(read or write the entire port in only one instruction).
I tryed GPOP, ex:
Code: Select all    GPOP = GPOP | 0x00000004;
    GPOP = GPOP & 0xFFFFFFFB;

but obviously it gives me "'GPOP' was not declared in this scope".
Anyone know the proper register name?
Thank you
User avatar
By martinayotte
#45043 if you look in hardware/esp8266/2.1.0/cores/esp8266/esp8266_peri.h, you will see the following defines :

Code: Select all#define GPO    ESP8266_REG(0x300) //GPIO_OUT R/W (Output Level)
#define GPOS   ESP8266_REG(0x304) //GPIO_OUT_SET WO
#define GPOC   ESP8266_REG(0x308) //GPIO_OUT_CLR WO
#define GPOP(p) ((GPO & (1 << ((p) & 0xF))) != 0)
User avatar
By 123francoz
#45071 Thank you, i got it working with these instructions:
Code: Select all    GPO = GPO | 0x00000004;
    GPO = GPO & 0xFFFFFFFB;

But something strange is happening,
it seems to have a sort of interrupt every about 3 seconds that delays the execution and sends some ramdon data through USART.
the instruction
Code: Select all  noInterrupts();

in the setup makes only the delay shorter but it is still there.
Do you know anything about it?
User avatar
By 123francoz
#45073 Thank you, i got it working with these instructions:
Code: Select all    GPO = GPO | 0x00000004;
    GPO = GPO & 0xFFFFFFFB;

But something strange is happening,
it seems to have a sort of interrupt every about 3 seconds that delays the execution and sends some ramdon data through USART.
the instruction
Code: Select all  noInterrupts();

in the setup makes only the delay shorter but it is still there.
Do you know anything about it?