loboris / MicroPython_ESP32_psRAM_LoBo

MicroPython for ESP32 with psRAM support
Other
831 stars 344 forks source link

Compiling for TinyPICO #322

Closed mdaeron closed 3 years ago

mdaeron commented 4 years ago

I'm trying to compile for a TinyPICO. As expected from this post, I get the following error message:

E (605) psram: ESP32PICOD4 do not support psram yet

Following lobo's reply and these instructions, I modified esp-idf/components/esp32/spiram_psram.c by changing these this sections:

#define FLASH_CLK_IO      6  
#define FLASH_CS_IO       16 // 11
#define PSRAM_CLK_IO      10 // 17
#define PSRAM_CS_IO       09 // 16
#define PSRAM_SPIQ_IO     17 // 7
#define PSRAM_SPID_IO     8
#define PSRAM_SPIWP_IO    7 // 10
#define PSRAM_SPIHD_IO    11 // 9

and commenting out the chip version check:

 else if (pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32PICOD4) {
        ESP_EARLY_LOGE(TAG, "ESP32PICOD4  do not support psram yet");
        return ESP_FAIL;
    }

But I don't know where to insert this piece of code:

#ifdef PICO
   /* TEST Config for the PICO-D4
       * - ESP32_PICO_Core_Board_V2
       * - ESP32_PICO_Core_Board_V3
       * Note: V2 & V3 Boards have ESP32 Rev=0
       * psram_enable works correctly only with v1 (post Feb 2017) and later ESP32 revisions.
       * 29 August 2017 rudi ;-)
       */
   /* SPICS0 CS */
   gpio_matrix_out(16, SPICS0_OUT_IDX, 0, 0); //11
    /* SPICLK CLK */
   gpio_matrix_out(6, SPICLK_OUT_IDX, 0, 0);
    /* SPIQ alias SD0 */
    gpio_matrix_out(17, SPIQ_OUT_IDX, 0, 0);   // 7
    gpio_matrix_in(17,SPIQ_IN_IDX, 0);         // 7
    /* SPID alias SD1 */
    gpio_matrix_out(8, SPID_OUT_IDX, 0, 0);
    gpio_matrix_in(8, SPID_IN_IDX, 0);
    /* SPIHD HOLD alias SD2 */
    gpio_matrix_out(11, SPIHD_OUT_IDX, 0, 0); // 9
    gpio_matrix_in(11, SPIHD_IN_IDX, 0);      // 9
    /* WP alias SD3 */
    gpio_matrix_out(7, SPIWP_OUT_IDX, 0, 0); // 10 a try with 7 like D2WD
    gpio_matrix_in(7, SPIWP_IN_IDX, 0);      // 10 a try with 7 like D2WD

#else
    gpio_matrix_out(6, SPICLK_OUT_IDX, 0, 0);
    gpio_matrix_out(11, SPICS0_OUT_IDX, 0, 0);
    gpio_matrix_out(7, SPIQ_OUT_IDX, 0, 0);
    gpio_matrix_in(7,SPIQ_IN_IDX, 0);
    gpio_matrix_out(8, SPID_OUT_IDX, 0, 0);
    gpio_matrix_in(8, SPID_IN_IDX, 0);
    gpio_matrix_out(10, SPIWP_OUT_IDX, 0, 0);
    gpio_matrix_in(10, SPIWP_IN_IDX, 0);
    gpio_matrix_out(9, SPIHD_OUT_IDX, 0, 0);
    gpio_matrix_in(9, SPIHD_IN_IDX, 0);
#endif

Alternatively, is seems that the latest version of esp-idf supports psram with PICO-D4. But how can I replace the version of esp-idf used by ./BUILD.sh?

Or did anybody already manage to get a TinyPICO to run the LoBo port, and is there a precompiled binary somewhere?