Changing pin state: ISA Question

ballsystemlord
Posts: 6
Joined: Wed Aug 14, 2019 6:16 pm

Changing pin state: ISA Question

Postby ballsystemlord » Fri Aug 16, 2019 9:29 pm

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

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: Changing pin state: ISA Question

Postby WiFive » Fri Aug 16, 2019 11:08 pm

It has w1ts w1tc registers

ESP_Angus
Posts: 2344
Joined: Sun May 08, 2016 4:11 am

Re: Changing pin state: ISA Question

Postby ESP_Angus » Mon Aug 19, 2019 12:17 am

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.

ballsystemlord
Posts: 6
Joined: Wed Aug 14, 2019 6:16 pm

Re: Changing pin state: ISA Question

Postby ballsystemlord » Fri Aug 23, 2019 10:49 pm

Thanks! Email notification is not working; hence my late reply.

Who is online

Users browsing this forum: No registered users and 92 guests