Single byte (8-bit) write to register GPIO_OUT_REG

kmatch98
Posts: 14
Joined: Sun Jan 24, 2021 2:31 am

Single byte (8-bit) write to register GPIO_OUT_REG

Postby kmatch98 » Sun Jan 24, 2021 2:34 am

I'm trying to bitbang a parallel (8080) LCD display using an ESP32-S2 using an 8-bit parallel bus (Saola-Wrover demo board). In writing the code, I'm trying to use the "simple GPIO" method to write to the registers for the GPIOs (see technical manual section 19.3.3 using GPIO_OUT_REG).

Since I want to write 8-bits (single-bytes) to the register, I thought I could make an 8-bit integer pointer to the correct register address and write/read to this single byte. I can successfully write a 32-bit integer to the GPIOs but an 8-bit write doesn't seem to do anything. Also, I cannot perform an 8-bit read properly either.

I see in section 10.3.3 (ESP32-S2 technical manual) that there are conditions where interrrupts occur when writing to this address location (0x3F404004). It is unclear to me whether the chip allows non-aligned reads/writes.

Question: Is there anyway to write a single byte (8-bit) to this GPIO_OUT_REG register? If not, what are best practices for the fastest way to pack the 8-bits into a 32-bit integer and then write them to the register?

———
Also, perhaps this is related to the following issue on github from the ESP32 IDF. https://github.com/espressif/esp-idf/issues/597

ESP_Sprite
Posts: 9040
Joined: Thu Nov 26, 2015 4:08 am

Re: Single byte (8-bit) write to register GPIO_OUT_REG

Postby ESP_Sprite » Sun Jan 24, 2021 3:42 am

There's very few registers in the ESP32 that can be read/written with anything else than 32-bit (UART FIFO comes to mind). GPIO, from what I know, is not one of them. You'll either have to do a read/modify/write or use the w1tc/w1tc registers.

kmatch98
Posts: 14
Joined: Sun Jan 24, 2021 2:31 am

Re: Single byte (8-bit) write to register GPIO_OUT_REG

Postby kmatch98 » Sun Jan 24, 2021 3:56 am

Thanks, that’s what I suspected. Thanks for confirming.

Who is online

Users browsing this forum: Bing [Bot], bs-eng, MicroController, willgeco and 123 guests