Skip to content

Too little DMA memory (or free memory block) is available for the eps32s3 (or other esp32s) #12075

@nspsck

Description

@nspsck

Hi, I am having trouble to get the maximum 256KB DMA block using the latest release. After some hardcoded debug print in a C-Module, I found out that the maximum allocatable memory block is roughly at 247KB. This is the code I've used:

STATIC void frame_buffer_alloc(mp_lcd_rm67162_obj_t *self, int len) {
    self->frame_buffer_size = len;
    size_t free_size = heap_caps_get_largest_free_block(MALLOC_CAP_DMA);
    self->frame_buffer = heap_caps_malloc(self->frame_buffer_size, MALLOC_CAP_DMA);
    int threshold = free_size / 1024;

    if (self->frame_buffer == NULL) {
        if (threshold <= 247) {
            mp_raise_msg(&mp_type_OSError, MP_ERROR_TEXT("Failed to allocate DMA'able framebuffer, 
                                           Maiximum available DMA size: less than 247KB"));
        }
        if (threshold <= 248) {
            mp_raise_msg(&mp_type_OSError, MP_ERROR_TEXT("Failed to allocate DMA'able framebuffer, 
                                           Maiximum available DMA size: less than 248KB"));
        }
        if (threshold <= 249) {
            mp_raise_msg(&mp_type_OSError, MP_ERROR_TEXT("Failed to allocate DMA'able framebuffer, 
                                           Maiximum available DMA size: less than 249KB"));
        } else {
            mp_raise_msg(&mp_type_OSError, MP_ERROR_TEXT("Failed to allocate DMA'able framebuffer, 
                                           Maiximum available DMA size: more than 249KB"));
        }
    }
    memset(self->frame_buffer, 0, self->frame_buffer_size);
}

Now I don't know if this is a bug... But, if uPy is using roughly 16KB of RAM as it advertised (which I highly doubt on the esp32 port, because of wifi and stuff), and freeRTOS taking at most 10KB according to this (that being all the ROM has been loaded into the RAM), why isn't it possible to allocate 256KB of continous block? Is this caused by some bug or have I underestimate the memory usage of uPy by a huge margine?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy