Search found 15 matches

by insanoff
Fri May 29, 2020 4:33 pm
Forum: General Discussion
Topic: Questions about example code in Github: gpio_example_main.c
Replies: 0
Views: 1646

Questions about example code in Github: gpio_example_main.c

I am trying to understand ESP32 external interrupts so decided to test "gpio_example_main.c" example found on Github repository: https://github.com/espressif/esp-idf/blob/6517c5033aab27afe491e433d6beeba93dfb1aa7/examples/peripherals/gpio/main/gpio_example_main.c Some definitions are not clear to me:...
by insanoff
Wed May 27, 2020 2:22 pm
Forum: ESP-IDF
Topic: mismatch vTaskDelay and cycle count using XTHAL_GET_CCOUNT() ?
Replies: 4
Views: 7788

Re: mismatch vTaskDelay and cycle count using XTHAL_GET_CCOUNT() ?

Sorry for hijacking the thread. But when I run the above code it gives me this result: ⸮T⸮U⸮⸮⸮2-hal-cpu.c:178] setCpuFrequencyMhz(): PLL: 320 / 4 = 80 Mhz, APB: 80000000 Hz [I][ESP32_timer_count.ino:48] setup(): imu task started [I][ESP32_timer_count.ino:49] setup(): portTICK_PERIOD_MS = 1 [I][ESP32...
by insanoff
Sat May 23, 2020 12:16 am
Forum: General Discussion
Topic: Why GPIO data types must be defined again in Arduino environment?
Replies: 1
Views: 3401

Re: Why GPIO data types must be defined again in Arduino environment?

OK, I got it. That's because Arduino uses C++, but ESP32 code is written in C.
by insanoff
Fri May 22, 2020 9:21 pm
Forum: General Discussion
Topic: Why GPIO data types must be defined again in Arduino environment?
Replies: 1
Views: 3401

Why GPIO data types must be defined again in Arduino environment?

Hi Everyone, I tried to execute the following example code from the Arduino environment, but it threw a data type error ESP32_freeRTOS_test:50:21: error: cannot convert 'GPIO_INT_TYPE' to 'gpio_int_type_t' in assignment for all GPIO configuration lines. I fixed them by adding the appropriate data ty...
by insanoff
Wed May 20, 2020 5:42 pm
Forum: General Discussion
Topic: Direct manipulation of GRIO's 32-39 for ESP32
Replies: 3
Views: 4543

Re: Direct manipulation of GRIO's 32-39 for ESP32

Hi insanoff, The bits of GPIO_IN_REG map to GPIOs 0-31, and the bits of GPIO_IN1_REG map to GPIOs 32 and up. So to access GPIO32, you need to read bit 0 of GPIO_IN1_REG. Same applies to other GPIO-related registers (output, output enable, etc). GPIO_SEL_34 macro in gpio.h is useful mainly for the p...
by insanoff
Wed May 20, 2020 9:26 am
Forum: General Discussion
Topic: Direct manipulation of GRIO's 32-39 for ESP32
Replies: 3
Views: 4543

Direct manipulation of GRIO's 32-39 for ESP32

Hi Folks, I could not find anywhere how to define GRIO's 32-39 using macros. This is how I thought it could be done: REG_WRITE(GPIO_IN1_REG, BIT34); But apparently it is not the case. In gpio.h file it is defined as: #define GPIO_SEL_34 ((uint64_t)(((uint64_t)1)<<34)) Definitely I did not understand...
by insanoff
Mon Aug 19, 2019 7:51 am
Forum: ESP32 Arduino
Topic: SPI communication code in C and converting into Arduino
Replies: 2
Views: 3856

Re: SPI communication code in C and converting into Arduino

1. SPI messages are 32 bit messages, I am not sure what is the best way to do it in Arduino IDE. If you have another suggestion other that Arduino, welcome. So far I have not used anything else, but would like to. My answer to my question 1, 32 bit SPI read and write in Arduino: uint32_t SendReques...
by insanoff
Sun Aug 18, 2019 4:52 pm
Forum: Hardware
Topic: Max bit size possible to read over SPI?
Replies: 5
Views: 7699

Re: Max bit size possible to read over SPI?

In one transaction (I think you call that a frame; the time when CS is active), you can send/receive any amount of bits, from 1 bit all the way up to 16777215 bits (however, you don't have enough RAM to store the latter amount), and anything in between, with a granularity of 1 bit. As such, 32 bits...
by insanoff
Fri Aug 16, 2019 3:35 pm
Forum: Hardware
Topic: Max bit size possible to read over SPI?
Replies: 5
Views: 7699

Re: Max bit size possible to read over SPI?

SPI itself doesn't have the concept of 'word size', it just reads in a stream of bits. The ESP32 hardware then reformats these bits into 32-bit words, but that's just a method of storing information. As you can store a bitstream that is as big as the ESP32's free memory, the bit size is more-or-les...
by insanoff
Fri Aug 16, 2019 10:08 am
Forum: Hardware
Topic: Max bit size possible to read over SPI?
Replies: 5
Views: 7699

Re: Max bit size possible to read over SPI?

Although there is no reply to my question I would like to share my initial thought how 32 bit SPI respond frame can be captured. First the request can be send byte by byte, then the SPI buffer can be read one byte at a time sending dummy loads. uint32_t SendRequest(uint32_t Request) { uint32_t Respo...