How to configure esp32 s3

Issue #438 resolved
Wenjie Wu created an issue

https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/hw-reference/esp32s3/user-guide-devkitc-1.html#pin-layout

This is the esp32 s3 board I am currently using. The firmware has been written normally, connected to the microblocks ide, and works. How do I configure other information next, such as pin information?

Comments (14)

  1. John Maloney repo owner

    Look at ioPrims.cpp. You'll need to add an entry like this one for the ESP32.

    #elif defined(ARDUINO_ARCH_ESP32)
        #ifdef ARDUINO_IOT_BUS
            #define BOARD_TYPE "IOT-BUS"
            #define PIN_BUTTON_A 15
            #define PIN_BUTTON_B 14
        #else
            #define BOARD_TYPE "ESP32"
        #endif
        #define DIGITAL_PINS 40
        #define ANALOG_PINS 16
        #define TOTAL_PINS 40
        static const int analogPin[] = {};
        #ifdef BUILTIN_LED
            #define PIN_LED BUILTIN_LED
        #else
            #define PIN_LED 2
        #endif
        #if !defined(PIN_BUTTON_A)
            #if defined(KEY_BUILTIN)
                #define PIN_BUTTON_A KEY_BUILTIN
            #else
                #define PIN_BUTTON_A 0
            #endif
        #endif
        static const char reservedPin[TOTAL_PINS] = {
            0, 1, 0, 1, 0, 0, 1, 1, 1, 1,
            1, 1, 0, 0, 0, 0, 0, 0, 0, 0,
            1, 0, 0, 0, 1, 0, 0, 0, 1, 1,
            1, 1, 0, 0, 0, 0, 0, 1, 1, 0};
    

    You'll need to find out what symbol is defined for your board so you can use it in the "defined()" test. For example, the esp32-s3-devkitc-1 defines ARDUINO_ESP32S3_DEV.

    One way to do that is find the entry for the board in the platformio boards.txt file:

    ~/.platformio/packages/framework-arduinoespressif32/boards.txt
    

    Find the "build.board" entry and prefix it with "ARDUINO_". For example, the relevant entry for the esp32-s3-devkitc-1 is:

    esp32s3.build.board=ESP32S3_DEV
    

    If you have trouble find the right symbol for your ESP32-S3 boards let me know and I can help.

    Put your entry before the ARDUINO_ARCH_ESP32 entry, since the latter matches all ESP32's.

    You can probably start with a copy of the generic ESP32 entry, minus the IOT_BUS case. Adjust the number of digital and analog pins .

    Also adjust the reserved pins array. Pin should be reserved if they are used internally by the board -- for example, the SPI pins that communicate with the external Flash and optional RAM)memory chips. The goal is to prevent a user from accidentally crashing the ESP32 by using an off-limits GPIO pin. They should be able to write a program that toggles GPIO pins 0-39 (or whatever the total pins is for the S3) without crashing the board.

    There may be a few other things that need to be tweaked, but the pin definitions is the key thing for any new board.

  2. Wenjie Wu reporter

    Thank you for your detailed explanation. I will follow these tips to define the pins. if I encounter any problems, I will come back

  3. Wenjie Wu reporter

    In the ESP32-S3 series of boards, the smallest flash is 8MB, which is the version I am currently using. Should board_build.partitions still use noota_3g.csv?

  4. John Maloney repo owner

    That should work, at least. The only downside is that the file system may not be able to use the second 4MB of the Flash chip.

    It's probably worth investigating to find out: 1. if there is a standard partitioning file for 8 MB Flash 2. if LittleFS can actually make use of the extra 4 MB of Flash. I have a vague memory that the second 4 MB must be bank-switched; it isn't directly addressable. Thus, LittleFS would need to have code to do the bank switching, which it may not be able to do.

    I suspect a few Google searches would answer these questions but it is probably not super urgent unless you need a larger file system.

  5. Wenjie Wu reporter

    Yeah, it's not urgent. I just shared in the microblocks online meeting on Saturday that I successfully built the ESP32-S3 and lit up the LED, and everyone was excited, as a large number of newly launched devices are based on the ESP32-S3, which seems to be widely liked. John, will you possibly get one ?

  6. John Maloney repo owner

    I will probably get dev boards for both the S2 and the S3 at some point. And perhaps the C3 (RISC-V) as well. I suspect we'll see more educational boards based on those chips in the next few years...

  7. Wenjie Wu reporter

    Yeah, this trend seems obvious, at least in China. In the STEM field, most of the newly launched devices appear to be ESP32-S3, and it seems to be the preferred choice for upgrading old devices.

  8. John Maloney repo owner

    Some sort of ESP32-S3 will probably get added a some point. (I need to get and test an S3 board first, but plan to do that right after Thanksgiving.) Like the ESP32, it will be a generic VM that I hope can run on a wide variety of S3 development boards including the one you linked.

  9. Log in to comment