Hello, I'm new to uCs. I intend to buy some. I'm just not sure which type.
I've read that with AVR, you have to read-modify-write a register in order to change a single pins value, whereas with ARM, you just change a whole byte and the pin is set to high or low.
How does the ESP32s work?
Thanks
Changing pin state: ISA Question
Re: Changing pin state: ISA Question
It has w1ts w1tc registers
Re: Changing pin state: ISA Question
Hi ballsystemlord,
As WiFive suggests, it's possible to write a single GPIO register to set output bits (W1TS register) or clear outputs (W1TC register). The first 32 GPIOs can be independently set/cleared in a single write to GPIO_OUT_W1TS_REG / GPIO_OUT_W1TC_REG. GPIOS 32-39 can be set/cleared by writing to GPIO_OUT1_W1TS_REG / GPIO_OUT1_W1TC_REG.
GPIOs are not part of the Instruction Set Architecture, they're part of the chip design. You can find more information about the GPIO registers by searching for the register names in the ESP32 Technical Reference Manual.
Note that the ESP32 has a CPU write buffer (meaning that memory writes don't immediately take effect), and the GPIO bus doesn't run at the CPU speed (it runs at APB bus speed) so people who try "bit banging" GPIOs this way for maximum performance are often disappointed that the peak performance doesn't match their expectations from a 240MHz CPU. Peripherals like the RMT peripheral or the SPI/I2S peripherals can be used in ways that allows manipulating pins at up to 80MHz, without needing constant CPU involvement (a double win). The ESP32 Technical Reference Manual has details about these peripherals as well.
As WiFive suggests, it's possible to write a single GPIO register to set output bits (W1TS register) or clear outputs (W1TC register). The first 32 GPIOs can be independently set/cleared in a single write to GPIO_OUT_W1TS_REG / GPIO_OUT_W1TC_REG. GPIOS 32-39 can be set/cleared by writing to GPIO_OUT1_W1TS_REG / GPIO_OUT1_W1TC_REG.
GPIOs are not part of the Instruction Set Architecture, they're part of the chip design. You can find more information about the GPIO registers by searching for the register names in the ESP32 Technical Reference Manual.
Note that the ESP32 has a CPU write buffer (meaning that memory writes don't immediately take effect), and the GPIO bus doesn't run at the CPU speed (it runs at APB bus speed) so people who try "bit banging" GPIOs this way for maximum performance are often disappointed that the peak performance doesn't match their expectations from a 240MHz CPU. Peripherals like the RMT peripheral or the SPI/I2S peripherals can be used in ways that allows manipulating pins at up to 80MHz, without needing constant CPU involvement (a double win). The ESP32 Technical Reference Manual has details about these peripherals as well.
-
- Posts: 6
- Joined: Wed Aug 14, 2019 6:16 pm
Re: Changing pin state: ISA Question
Thanks! Email notification is not working; hence my late reply.
Who is online
Users browsing this forum: No registered users and 59 guests