Music Player, NES Game Console, and Camera on ESP32

Introduction

Let me vent a bit first, shit! shit! shit!, what a pain in the ass with the reuse!

  • The board used in the example is:

<span>Zhongdian Atom ESP32S3 Development Board + 1.3 inch LCD Module</span>

Music Player, NES Game Console, and Camera on ESP32
  • Code repository address:

<span>https://github.com/loogg/esp32_learning</span>

  • Development Environment

    • IDF: <span>5.3.2</span>

      Copy the <span>idf_v5.3.patch</span> from the repository to the <span>idf</span> path and execute <span>git apply idf_v5.3.patch</span>.

    • ADF: <span>2.7</span>

4G Network Card

Music Player, NES Game Console, and Camera on ESP32

Music Playback

NES Game Console

Camera

Optimization Notes

Display

  • <span>ESP32S3</span>‘s <span>DMA</span> can only use internal <span>RAM</span>, so before running the <span>NES</span> and camera, call <span>lvgl_port_lock</span> to lock the <span>LVGL</span> thread and use it to refresh the buffer.

  • <span>LCD</span> uses an <span>SPI</span> asynchronous refresh mechanism, and during the operation of the <span>NES</span> and camera applications, a synchronous refresh is required, so the code in <span>IDF-> esp_lcd_panel_io_spi.c</span> was modified to add the <span>lcd_panel_io_spi_set_sync_trans</span> interface.

Music Playback

This board shares one <span>SPI</span> bus between the <span>SD card</span> and <span>SPI LCD</span>, so the asynchronous refresh must be turned off during music playback.

What a pain in the ass with the reuse!.

Function Block Introduction

Display

Implemented based on <span>LVGL</span>, the homepage features a honeycomb effect.

Uses <span>TinyTTF</span> to parse vector fonts.

USB

Adapted two protocol stacks, supporting <span>Cherryusb</span> and <span>ESP USB</span>, and supports <span>RNDIS devices</span> and <span>HID devices</span>.

  • <span>RNDIS</span>

    Integrates with the <span>ESP-NETIF</span> component.

  • <span>HID</span>

    Can connect a keyboard and mouse via a <span>USB HUB</span> as input devices for <span>LVGL</span>.

Music Player, NES Game Console, and Camera on ESP32

Audio

Uses the <span>ESP-ADF</span> framework, and due to the special nature of the board, implements custom <span>board</span> and <span>codec</span>.

What a pain in the ass with the reuse!.

NES

Ported based on the <span>C</span> implementation of the <span>NES</span> emulator:

<span>https://github.com/Dozingfiretruck/nes</span>

Camera

Uses the Zhongdian Atom’s <span>OV2640</span>, and can directly read pixel data to display on the screen via the <span>esp-camera</span> component.

Future Plans

  • Add <span>AI Assistant</span> functionality, using <span>USB 4G</span> for internet connectivity

  • Add a detailed interface for music playback, loading text and effects

Leave a Comment