Help making ESP32-3248S035 work

Hi all,

I recently bought ESP32-3248S035 (https://tinyurl.com/nwttm4xw) and trying to get the right configuration to get it up and running (screen/touch).

Did anyone have any success in that?

Thank you so much!

Try Googling the board name and doing some digging. This page platformio-espressif32-sunton/esp32-3248S035C.json at 59ec63edd07c4d5d75d5b1e46083c2ab6446ab46 · rzeldent/platformio-espressif32-sunton · GitHub suggests that’s an ST7796 display driver, which is supported by the ili9xxx ESPHome component, so you just need to set up the correct pins for SPI and the display control lines.

There is no PSRAM so it’s unlikely the ESPHome display drawing functions will work, but LVGL with a 25% buffer_size should be ok.

The capacitive touch version appears to use a GT911 which is also supported in ESPHome.

There is some info here, and it does say they have psram. ESP32-3248S035 - openHASP

That page says 8MB PSRAM at the top, but later in 2 places it says no PSRAM.

1 Like

Thanks for the help, I’ve tried setting the configuration, and get the following:

[23:40:00][C][logger:185]: Logger:
[23:40:00][C][logger:186]:   Level: DEBUG
[23:40:00][C][logger:188]:   Log Baud Rate: 115200
[23:40:00][C][logger:189]:   Hardware UART: UART0
[23:40:00][C][spi:068]: SPI bus:
[23:40:00][C][spi:069]:   CLK Pin: GPIO14
[23:40:00][C][spi:070]:   SDI Pin: GPIO12
[23:40:00][C][spi:071]:   SDO Pin: GPIO13
[23:40:00][C][spi:076]:   Using HW SPI: SPI
[23:40:00][C][spi:068]: SPI bus:
[23:40:00][C][spi:069]:   CLK Pin: GPIO18
[23:40:00][C][ledc.output:181]:   Bit depth: 16
[23:40:00][C][ledc.output:176]: LEDC Output:
[23:40:00][C][ledc.output:177]:   Pin GPIO4
[23:40:00][C][ledc.output:178]:   LEDC Channel: 1
[23:40:00][C][ledc.output:179]:   PWM Frequency: 1000.0 Hz
[23:40:00][C][ledc.output:180]:   Phase angle: 0.0°
[23:40:00][C][ledc.output:181]:   Bit depth: 16
[23:40:00][C][ledc.output:176]: LEDC Output:
[23:40:00][C][ledc.output:177]:   Pin GPIO16
[23:40:00][C][ledc.output:178]:   LEDC Channel: 2
[23:40:00][C][ledc.output:179]:   PWM Frequency: 1000.0 Hz
[23:40:00][C][ledc.output:180]:   Phase angle: 0.0°
[23:40:00][C][ledc.output:181]:   Bit depth: 16
[23:40:00][C][ledc.output:176]: LEDC Output:
[23:40:00][C][ledc.output:177]:   Pin GPIO17
[23:40:00][C][ili9xxx:094]:   Dimensions: 320px x 480px
[23:40:00][C][ili9xxx:095]:   Width Offset: 0
[23:40:00][C][ili9xxx:105]:   Color mode: 8bit 332 mode
[23:40:00][C][ili9xxx:111]:   Data rate: 40MHz
[23:40:00][C][ili9xxx:114]:   CS Pin: GPIO15
[23:40:00][C][ili9xxx:115]:   DC Pin: GPIO2
[23:40:00][C][ili9xxx:117]:   Color order: BGR
[23:40:00][C][ili9xxx:118]:   Swap_xy: NO
[23:40:00][C][ili9xxx:119]:   Mirror_x: YES
[23:40:00][C][ili9xxx:120]:   Mirror_y: NO
[23:40:00][C][ili9xxx:123]:   => Failed to init Memory: YES!
[23:40:00][C][ili9xxx:125]:   Update Interval: 1.0s
[23:40:00][E][component:082]:   Component display is marked FAILED
[23:40:00][C][light:103]: Light 'LED'
[23:40:00][C][light:105]:   Default Transition Length: 1.0s
[23:40:00][C][light:106]:   Gamma Correct: 2.80
[23:40:00][C][esp32_improv.component:261]: ESP32 Improv:
[23:40:00][C][esp32_improv.component:266]:   Status Indicator: 'NO'
[23:40:00][C][captive_portal:088]: Captive Portal:
[23:40:00][C][web_server:173]: Web Server:
[23:40:00][C][web_server:174]:   Address: esphome-web-4560ec.local:80
[23:40:00][C][mdns:115]: mDNS:
[23:40:00][C][mdns:116]:   Hostname: esphome-web-4560ec
[23:40:00][C][esphome.ota:073]: Over-The-Air updates:
[23:40:00][C][esphome.ota:074]:   Address: esphome-web-4560ec.local:3232
[23:40:00][C][esphome.ota:075]:   Version: 2
[23:40:00][C][safe_mode:018]: Safe Mode:
[23:40:00][C][api:140]:   Address: esphome-web-4560ec.local:6053

The configuration I’m using is:

spi:
  - id: tft
    clk_pin: GPIO14
    mosi_pin: GPIO13
    miso_pin: GPIO12
  - id: touch
    clk_pin: GPIO18
    mosi_pin: GPIO23
    miso_pin: GPIO19

display:
  - platform: ili9xxx
    model: ST7796
    cs_pin: GPIO15
    dc_pin: GPIO2
    spi_id: tft

Any thoughts what I still might be missing?

Thanks!

Yes, you are right, that needs fixing doesn’t it, and careful reading.

Like I said, it won’t work with the standard display operations due to insufficient memory. You’ll need update_interval: never and auto_clear_enabled: false then use LVGL - LVGL implementation for ESPHome by clydebarrow · Pull Request #6363 · esphome/esphome · GitHub - read the docs linked there and make sure to set buffer_size: 25%

Also best to log via UART so you capture all the messages after startup.

I struggled getting this to work as well, but it works fine with Openhasp if you want it to just work. I’ve realised I’m not a big fan of that software though and I also plan to add some controls to the device which would be easier using Esphome.

[edit]: I forgot to change the buffer size, now it works!

So I tried @clydebarrow’s suggestions and that works. I used the following yaml for a hello world example:

esphome:
  name: tv-controller
  friendly_name: TV-controller

external_components:
  - source: github://pr#6363
    refresh: 10min
    components: [lvgl]

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:
  level: DEBUG

# Enable Home Assistant API
api:
  encryption:
    key: "xxx"

ota:
  platform: esphome
  password: "xxx"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

i2c:
  sda: 33
  scl: 32
  scan: true
  id: bus_a

spi:
  clk_pin: 14
  mosi_pin: 13
  miso_pin: 12

light:
  - platform: rgb
    name: "Status Light"
    red: red_GPIO
    green: green_GPIO
    blue: blue_GPIO
  - platform: monochromatic
    output: backlight_pin
    name: "Display Backlight"
    id: back_light
    restore_mode: ALWAYS_ON

output:
  - platform: ledc
    pin: 4
    id: red_GPIO
    inverted: True
  - platform: ledc
    pin: 16
    id: green_GPIO
    inverted: True
  - platform: ledc
    pin: 17
    id: blue_GPIO
    inverted: True
  - platform: ledc
    pin: 27
    id: backlight_pin


display:
  - platform: ili9xxx
    id: my_display
    model: ST7796
    dc_pin: 2
    cs_pin: 15
    dimensions: 320x480
    update_interval: never
    auto_clear_enabled: false

touchscreen:
  platform: gt911
  id: my_touch
  update_interval: 50ms
#  interrupt_pin: 21 # maybe not connected?
#  reset_pin: 25 # From a openhasp config, appears to be the 'normal' esp32 reset pin?

color:
  - id: my_red
    red: 100%
    green: 0%
    blue: 0%

# font:
#   - file: "gfonts://Martian+Mono"
#     id: large
#     size: 40
#   - file: "gfonts://Martian+Mono"
#     id: small
#     size: 20

lvgl:
  touchscreens:
    - my_touch
  buffer_size: 25%
  pages:
    - id: main_page
      widgets:
        - label:
            align: CENTER
            text: 'Hello World!'

Yatush,

I was having all sorts of problems with the ESP32-3248S035C until I happened on the Annex RDS site and after that (if you know BASIC) it is easy - it does all the hard work for you just set the Config to ESP32-3248S035C and voila. The Annex RDS puts the BASIC in the chip and uses your WiFi to communicate with it.

Starraker

For all attempting to use the ESP32-3248S035C (or ESP32-3248S035R)

For Touch on these boards the following applies (GPIO Pins):

Resistive Touch : INT = 36, SCLK = 14, MOSI = 13, MISO =12, CS = 33 (XPT2046)

Capacitative Touch: INT = 21, SCL = 32, SDA = 33, RST = 25 (GT911)

The Resistive Touch needs to align the touchscreen before it can be used whereas the Capacitive Touch does not need this Step as it is prealigned.

LED1 has three GPIO pins : RED = 4, GREEN = 16, BLUE = 17

BACKLIGHT = GPIO 27

AUDIO AMP : GPIO 26 - Careful when using a speaker an 8 ohm speaker needs to have a series resistor to prevent overloading the amp.

GPIO 39 is unwired but can still be used

Careful with Capacitive Touch - pin 21 has two other definitions (min)

SCREEN SPI: DC = 2, SCLK = 14, MOSI = 13, MISO = 12, CS = 15 RST = EN(-1) - Please note the Screen SPI and Resistive Touch share SCLK, MOSI, & MISO

This board does not act like other ESP32 boards as many of the pins are hard wired and predefined. However , If you prefer easier manipulation / programming of this board go to Annex 32 Rapid Development Suite and use the BASIC Language where this board and its large number of capabilities are all accessible.

This is great board have fun.

I hope that this helps

1 Like

Hello,
Thanks for your valuable input, I got the display to work but have no contact at all to the touch functionality.

It does not output anything to the log when touching the screen and it does not react, og clicking a button.

This is not a hardware issue as it worked fine with default sw.

I wonder what I am missing.

Here is the relevant config part


i2c:
  sda: GPIO33
  scl: GPIO32
  scan: true
  id: bus_a

touchscreen:
  - platform: gt911
    id: my_touch
    display: my_display
    interrupt_pin: GPIO21
#   reset_pin: GPIO25
#   i2c_id: bus_a
#   address: 0x5D
    update_interval: 50ms

    on_touch: 
      - lambda: |-
          ESP_LOGI("cal", "x=%d, y=%d, x_raw=%0d, y_raw=%d",
            touch.x,
            touch.y,
            touch.x_raw,
            touch.y_raw
            );
      - light.turn_on: 
          id: backlight
          brightness: 100%
    on_release:
      then:
        - if:
            condition: lvgl.is_paused
            then:
              - lvgl.resume:
              - lvgl.widget.redraw:

lvgl:
  displays:
    - my_display
  touchscreens:
    - my_touch
  buffer_size: 25%
  color_depth: 16
  bg_color: room_bg_color #0
  pad_all: 0
  border_width: 0
  border_color: HA_blue
  outline_width: 0
  shadow_width: 0
  text_font: font_s
  align: center
  style_definitions:
    - id: default_style      # choose an ID for your definition
      border_color: default_border_color
      border_width: 0
      align: CENTER
      text_align: CENTER
  pages:
    - id: main_page
      pad_all: 0
      widgets:
        - obj:
            width: 480
            height: 320
            layout:
              type: grid
              grid_row_align: end
              grid_columns: [fr(1)]
              grid_rows: [fr(1), fr(2),fr(2),fr(2), fr(1)]
              pad_row: 0px
              pad_column: 0px
            pad_all: 0px
            outline_pad: 0px
            widgets:
              - label:
                  id: lbl_header
                  grid_cell_column_pos: 0
                  grid_cell_row_pos: 0
                  grid_cell_x_align: CENTER
                  grid_cell_y_align: CENTER
                  styles: default_style
                  text_font: font_l
                  pad_all: 0px
                  outline_pad: 0px
                  text: "Hello World"
              - button:
                  grid_cell_column_pos: 0
                  grid_cell_row_pos: 1
                  grid_cell_x_align: STRETCH
                  grid_cell_y_align: STRETCH
                  id: my_main_climate2
                  pad_all: 0px
                  outline_pad: 0px
                  bg_color: default_button_bg_color
                  bg_grad_color: default_button_bg_grad_color
                  widgets:
                    - label:
                        id: my_main_climate2_target
                        text: "Test touch"
                        text_font: font_xs
                  on_click:
                    then:
                      - lvgl.label.update:
                          id: lbl_header
                          text: "Button pushed"

By the way, I am not able to set the RST pin for the touch. when compiling I get the error:

  [reset_pin] is an invalid option for [touchscreen.gt911]. Please check the indentation.

Update your ESPHome version. reset_pin is valid, and is important. Check the serial logs for errors relating to the touchscreen and i2c.

Hi @clydebarrow,

Thanks for your input.

I updated to latest HA and ESPHome, then I was allowed to set the reset_pin. But it did not fix my problem.

After several trials, It started working when I removed the interrupt_pin.
Then I ended up removing both interrupt and reset pin as in @sophof example and it still works.

So, maybe there is an issue with Pin 21 (the interrupt pint) as it is used by other things as @Starraker1 mentioned “Careful with Capacitive Touch - pin 21 has two other definitions (min)”

Finally, I did not use github://pr#6363, as LVGL is natively supported by ESPHome now.

So, now it looks like I have the basics to work, then I go further with custom configuration to my use case.

Thanks :blush:

so how do we define both LCD and resistive touchscreen in esphome project?

figured: we shall assign same spi_id to both