I have an expressif esp32-s2-wroom dev board and I would very much appreciate some help with respect to connecting it to an external battery-powered clock (DS3231).
More specifically, which pins on the board to connect the clock's SDA and SC1 pins to?
On an esp32 dev kit 1, I connected them to D21 (I2C SDA) and D22 (I2C SLC) respectfully and that worked fine.
Not sure how I set up for the equivalent on the esp32-s2-wroom dev board.
There is some related documentation here: https://docs.espressif.com/projects/esp ... s/i2c.html under 'Customized Configuration'. However, unfortunately, I don't really 'get it' and I can't seem to find other documentation or examples.
The DS3232 also has pins labeled 32K and SQW but they aren't needed for just accessing the basic clock functionality (setting and retrieving time) which I would like to do.
Again, would very much appreciate some additional guidance.
Connecting esp32-S2 dev board to DS3231 clock
-
- Posts: 9769
- Joined: Thu Nov 26, 2015 4:08 am
Re: Connecting esp32-S2 dev board to DS3231 clock
The ESP32-S2, like the ESP32, doesn't have dedicated I2C pins; you use route any (output-capable, but on the -S2 they all are) GPIO that is not e.g. already occupied by the flash.
Re: Connecting esp32-S2 dev board to DS3231 clock
Thank you but I really don't understand.
Are you saying I can use any two GPIO pins?
If yes, how do I tell the ESP32-S2 dev board ( ESP32-S2-Saola-1) which GPIO I am using for SDA and SCL?
For example, on a ESP32 Dev Kit 1, GPIO21 is SDA and GPIO22 is I2C SCL - so I just use those two pins.
But I don't know which GPIOs to use on the ESP32-S2 dev board, and if I can use any two what additional coding in my Arduino sketch is required to identify the GPIOs I use.
I am working with this library: https://github.com/JChristensen/DS3232RTC
Thanks to anyone that can help further.
Are you saying I can use any two GPIO pins?
If yes, how do I tell the ESP32-S2 dev board ( ESP32-S2-Saola-1) which GPIO I am using for SDA and SCL?
For example, on a ESP32 Dev Kit 1, GPIO21 is SDA and GPIO22 is I2C SCL - so I just use those two pins.
But I don't know which GPIOs to use on the ESP32-S2 dev board, and if I can use any two what additional coding in my Arduino sketch is required to identify the GPIOs I use.
I am working with this library: https://github.com/JChristensen/DS3232RTC
Thanks to anyone that can help further.
-
- Posts: 26
- Joined: Tue Jun 09, 2020 5:27 pm
Re: Connecting esp32-S2 dev board to DS3231 clock
I use headers with code blocks like
[Codebox]
#define GPIO_HANDSHAKE 2
#define GPIO_MOSI 9
#define GPIO_MISO 8
#define GPIO_SCLK 10
#define GPIO_CS 21
#ifdef CONFIG_IDF_TARGET_ESP32
#define SENDER_HOST HSPI_HOST
#define DMA_CHAN 2
#elif defined CONFIG_IDF_TARGET_ESP32S2
#define SENDER_HOST SPI2_HOST
#define DMA_CHAN SENDER_HOST
#endif
#define MCP_MCLK_TIMER LEDC_TIMER_1
#define MCP_MCLK_MODE LEDC_LOW_SPEED_MODE
#define MCP_MCLK_GPIO (18)
#define MCP_MCLK_CHANNEL LEDC_CHANNEL_0
#define MCP_MCLK_DUTY (8)
#define MCP_CH_EN[/Codebox]
then point my function the the definitions
[Codebox]
#define GPIO_HANDSHAKE 2
#define GPIO_MOSI 9
#define GPIO_MISO 8
#define GPIO_SCLK 10
#define GPIO_CS 21
#ifdef CONFIG_IDF_TARGET_ESP32
#define SENDER_HOST HSPI_HOST
#define DMA_CHAN 2
#elif defined CONFIG_IDF_TARGET_ESP32S2
#define SENDER_HOST SPI2_HOST
#define DMA_CHAN SENDER_HOST
#endif
#define MCP_MCLK_TIMER LEDC_TIMER_1
#define MCP_MCLK_MODE LEDC_LOW_SPEED_MODE
#define MCP_MCLK_GPIO (18)
#define MCP_MCLK_CHANNEL LEDC_CHANNEL_0
#define MCP_MCLK_DUTY (8)
#define MCP_CH_EN[/Codebox]
then point my function the the definitions
-
- Posts: 9769
- Joined: Thu Nov 26, 2015 4:08 am
Re: Connecting esp32-S2 dev board to DS3231 clock
Yes, you can.
The I2C pins 'aren't' anything. The hardware does not define any pins as 'i2c pins'.If yes, how do I tell the ESP32-S2 dev board ( ESP32-S2-Saola-1) which GPIO I am using for SDA and SCL?
For example, on a ESP32 Dev Kit 1, GPIO21 is SDA and GPIO22 is I2C SCL - so I just use those two pins.
Aaah, you're using Arduino, that explains. Arduino indeed uses a default set of pins for I2C, although I think it is changable by specifying the correct pins in i2cBegin().But I don't know which GPIOs to use on the ESP32-S2 dev board, and if I can use any two what additional coding in my Arduino sketch is required to identify the GPIOs I use.
I am working with this library: https://github.com/JChristensen/DS3232RTC
Thanks to anyone that can help further.
By default (as specified in variants/esp32s2/pins_arduino.h):
Code: Select all
static const uint8_t SDA = 8;
static const uint8_t SCL = 9;
Re: Connecting esp32-S2 dev board to DS3231 clock
ESP_Sprite: thank you very much, that was exactly what I needed to know - indeed pins 8 and 9 are the two to use.
-
- Posts: 1
- Joined: Thu Aug 05, 2021 7:21 am
Re: Connecting esp32-S2 dev board to DS3231 clock
I am having same issue. But I am using different slave and pins are not the issue. I think there is a problem in i2c library.
Who is online
Users browsing this forum: No registered users and 34 guests