{"id":4815,"date":"2022-05-30T19:02:19","date_gmt":"2022-05-30T17:02:19","guid":{"rendered":"https:\/\/www.pschatzmann.ch\/home\/?p=4815"},"modified":"2025-06-12T15:01:28","modified_gmt":"2025-06-12T13:01:28","slug":"esp32-and-psram","status":"publish","type":"post","link":"https:\/\/www.pschatzmann.ch\/home\/2022\/05\/30\/esp32-and-psram\/","title":{"rendered":"ESP32 and PSRAM"},"content":{"rendered":"<p>The <strong>ESP32<\/strong> microcontroller has <strong>only a few hundred kilobytes of internal RAM<\/strong>. Fortunately the ESP32 AudioKit or ESP32 Wrover provide 8MB <strong>PSRAM<\/strong> where <strong>4MB<\/strong> can be directly addressed.<\/p>\n<p>More information how to use PSRAM in <strong>Arduino<\/strong> can be found <a href=\"https:\/\/thingpulse.com\/esp32-how-to-use-psram\/\">here<\/a>. The only thing to highlight is that PSRAM <strong>can not be allocated in global variables<\/strong>! This is quite unfortunate because I preferably like to do this, so that the compiler can inform about the total memory usage.<\/p>\n<p>Many <a href=\"https:\/\/faust.grame.fr\/\">FAUST<\/a> examples are using more RAM that is available on an ESP32. Therefore I have added PSRAM support to the FAUST integration. Here is <a href=\"https:\/\/github.com\/pschatzmann\/arduino-audio-tools\/tree\/main\/examples\/examples-faust\/streams-faust_flute-i2s\">an example how to use this<\/a>.<\/p>\n<p>Finally there is a more <strong>generic way<\/strong> that can be used e.g. if you want to use PSRAM with any library that is not under your control. You can call the following <strong>&#8220;magical&#8221; function<\/strong>:<\/p>\n<pre><code>#include \"esp_heap_caps.h\"\n\nconst int limit = 10000;\nheap_caps_malloc_extmem_enable(limit);\n<\/code><\/pre>\n<p>Then, when external memory is available and activated, the allocation strategy is to initially try<br \/>\nto satisfy smaller allocation requests with internal memory and <strong>larger requests<br \/>\nwith external memory<\/strong>. This sets the <strong>limit<\/strong> between the two.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The ESP32 microcontroller has only a few hundred kilobytes of internal RAM. Fortunately the ESP32 AudioKit or ESP32 Wrover provide 8MB PSRAM where 4MB can be directly addressed. More information how to use PSRAM in Arduino can be found here. The only thing to highlight is that PSRAM can not [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":3882,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","_import_markdown_pro_load_document_selector":0,"_import_markdown_pro_submit_text_textarea":"","_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"footnotes":""},"categories":[20,22],"tags":[60],"class_list":["post-4815","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-arduino","category-machine-sound","tag-psram"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>ESP32 and PSRAM - Phil Schatzmann<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.pschatzmann.ch\/home\/2022\/05\/30\/esp32-and-psram\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"ESP32 and PSRAM - Phil Schatzmann\" \/>\n<meta property=\"og:description\" content=\"The ESP32 microcontroller has only a few hundred kilobytes of internal RAM. Fortunately the ESP32 AudioKit or ESP32 Wrover provide 8MB PSRAM where 4MB can be directly addressed. More information how to use PSRAM in Arduino can be found here. The only thing to highlight is that PSRAM can not [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.pschatzmann.ch\/home\/2022\/05\/30\/esp32-and-psram\/\" \/>\n<meta property=\"og:site_name\" content=\"Phil Schatzmann\" \/>\n<meta property=\"article:published_time\" content=\"2022-05-30T17:02:19+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-06-12T13:01:28+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2021\/12\/audio-toolkit.png\" \/>\n\t<meta property=\"og:image:width\" content=\"800\" \/>\n\t<meta property=\"og:image:height\" content=\"500\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"pschatzmann\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"pschatzmann\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2022\\\/05\\\/30\\\/esp32-and-psram\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2022\\\/05\\\/30\\\/esp32-and-psram\\\/\"},\"author\":{\"name\":\"pschatzmann\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#\\\/schema\\\/person\\\/73a53638a4e34e8373405fd737dac9b1\"},\"headline\":\"ESP32 and PSRAM\",\"datePublished\":\"2022-05-30T17:02:19+00:00\",\"dateModified\":\"2025-06-12T13:01:28+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2022\\\/05\\\/30\\\/esp32-and-psram\\\/\"},\"wordCount\":182,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#\\\/schema\\\/person\\\/73a53638a4e34e8373405fd737dac9b1\"},\"image\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2022\\\/05\\\/30\\\/esp32-and-psram\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2021\\\/12\\\/audio-toolkit.png\",\"keywords\":[\"PSRAM\"],\"articleSection\":[\"Arduino\",\"Machine Sound\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2022\\\/05\\\/30\\\/esp32-and-psram\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2022\\\/05\\\/30\\\/esp32-and-psram\\\/\",\"url\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2022\\\/05\\\/30\\\/esp32-and-psram\\\/\",\"name\":\"ESP32 and PSRAM - Phil Schatzmann\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2022\\\/05\\\/30\\\/esp32-and-psram\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2022\\\/05\\\/30\\\/esp32-and-psram\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2021\\\/12\\\/audio-toolkit.png\",\"datePublished\":\"2022-05-30T17:02:19+00:00\",\"dateModified\":\"2025-06-12T13:01:28+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2022\\\/05\\\/30\\\/esp32-and-psram\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2022\\\/05\\\/30\\\/esp32-and-psram\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2022\\\/05\\\/30\\\/esp32-and-psram\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2021\\\/12\\\/audio-toolkit.png\",\"contentUrl\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2021\\\/12\\\/audio-toolkit.png\",\"width\":800,\"height\":500},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2022\\\/05\\\/30\\\/esp32-and-psram\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"ESP32 and PSRAM\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#website\",\"url\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/\",\"name\":\"Phil Schatzmann Consulting\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#\\\/schema\\\/person\\\/73a53638a4e34e8373405fd737dac9b1\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#\\\/schema\\\/person\\\/73a53638a4e34e8373405fd737dac9b1\",\"name\":\"pschatzmann\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2022\\\/08\\\/pschatzmann.png\",\"url\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2022\\\/08\\\/pschatzmann.png\",\"contentUrl\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2022\\\/08\\\/pschatzmann.png\",\"width\":305,\"height\":305,\"caption\":\"pschatzmann\"},\"logo\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2022\\\/08\\\/pschatzmann.png\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"ESP32 and PSRAM - Phil Schatzmann","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.pschatzmann.ch\/home\/2022\/05\/30\/esp32-and-psram\/","og_locale":"en_US","og_type":"article","og_title":"ESP32 and PSRAM - Phil Schatzmann","og_description":"The ESP32 microcontroller has only a few hundred kilobytes of internal RAM. Fortunately the ESP32 AudioKit or ESP32 Wrover provide 8MB PSRAM where 4MB can be directly addressed. More information how to use PSRAM in Arduino can be found here. The only thing to highlight is that PSRAM can not [&hellip;]","og_url":"https:\/\/www.pschatzmann.ch\/home\/2022\/05\/30\/esp32-and-psram\/","og_site_name":"Phil Schatzmann","article_published_time":"2022-05-30T17:02:19+00:00","article_modified_time":"2025-06-12T13:01:28+00:00","og_image":[{"width":800,"height":500,"url":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2021\/12\/audio-toolkit.png","type":"image\/png"}],"author":"pschatzmann","twitter_card":"summary_large_image","twitter_misc":{"Written by":"pschatzmann","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.pschatzmann.ch\/home\/2022\/05\/30\/esp32-and-psram\/#article","isPartOf":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2022\/05\/30\/esp32-and-psram\/"},"author":{"name":"pschatzmann","@id":"https:\/\/www.pschatzmann.ch\/home\/#\/schema\/person\/73a53638a4e34e8373405fd737dac9b1"},"headline":"ESP32 and PSRAM","datePublished":"2022-05-30T17:02:19+00:00","dateModified":"2025-06-12T13:01:28+00:00","mainEntityOfPage":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2022\/05\/30\/esp32-and-psram\/"},"wordCount":182,"commentCount":2,"publisher":{"@id":"https:\/\/www.pschatzmann.ch\/home\/#\/schema\/person\/73a53638a4e34e8373405fd737dac9b1"},"image":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2022\/05\/30\/esp32-and-psram\/#primaryimage"},"thumbnailUrl":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2021\/12\/audio-toolkit.png","keywords":["PSRAM"],"articleSection":["Arduino","Machine Sound"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.pschatzmann.ch\/home\/2022\/05\/30\/esp32-and-psram\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.pschatzmann.ch\/home\/2022\/05\/30\/esp32-and-psram\/","url":"https:\/\/www.pschatzmann.ch\/home\/2022\/05\/30\/esp32-and-psram\/","name":"ESP32 and PSRAM - Phil Schatzmann","isPartOf":{"@id":"https:\/\/www.pschatzmann.ch\/home\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2022\/05\/30\/esp32-and-psram\/#primaryimage"},"image":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2022\/05\/30\/esp32-and-psram\/#primaryimage"},"thumbnailUrl":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2021\/12\/audio-toolkit.png","datePublished":"2022-05-30T17:02:19+00:00","dateModified":"2025-06-12T13:01:28+00:00","breadcrumb":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2022\/05\/30\/esp32-and-psram\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.pschatzmann.ch\/home\/2022\/05\/30\/esp32-and-psram\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.pschatzmann.ch\/home\/2022\/05\/30\/esp32-and-psram\/#primaryimage","url":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2021\/12\/audio-toolkit.png","contentUrl":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2021\/12\/audio-toolkit.png","width":800,"height":500},{"@type":"BreadcrumbList","@id":"https:\/\/www.pschatzmann.ch\/home\/2022\/05\/30\/esp32-and-psram\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.pschatzmann.ch\/home\/"},{"@type":"ListItem","position":2,"name":"ESP32 and PSRAM"}]},{"@type":"WebSite","@id":"https:\/\/www.pschatzmann.ch\/home\/#website","url":"https:\/\/www.pschatzmann.ch\/home\/","name":"Phil Schatzmann Consulting","description":"","publisher":{"@id":"https:\/\/www.pschatzmann.ch\/home\/#\/schema\/person\/73a53638a4e34e8373405fd737dac9b1"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.pschatzmann.ch\/home\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.pschatzmann.ch\/home\/#\/schema\/person\/73a53638a4e34e8373405fd737dac9b1","name":"pschatzmann","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2022\/08\/pschatzmann.png","url":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2022\/08\/pschatzmann.png","contentUrl":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2022\/08\/pschatzmann.png","width":305,"height":305,"caption":"pschatzmann"},"logo":{"@id":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2022\/08\/pschatzmann.png"}}]}},"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/posts\/4815","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/comments?post=4815"}],"version-history":[{"count":23,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/posts\/4815\/revisions"}],"predecessor-version":[{"id":4856,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/posts\/4815\/revisions\/4856"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/media\/3882"}],"wp:attachment":[{"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/media?parent=4815"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/categories?post=4815"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/tags?post=4815"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}