Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PSRAM for BLE stack #105

Closed
darshan-mirajkar opened this issue Jul 30, 2020 · 10 comments
Closed

PSRAM for BLE stack #105

darshan-mirajkar opened this issue Jul 30, 2020 · 10 comments

Comments

@darshan-mirajkar
Copy link

Can we use PSRAM for BLE stack?? If yes what are the changes required?

@h2zero
Copy link
Owner

h2zero commented Jul 30, 2020

I think this is possible, I have not tested.

You would need to change this line in nimconfig.h to CONFIG_BT_NIMBLE_MEM_ALLOC_MODE_EXTERNAL.

Let me know if that works.

@darshan-mirajkar
Copy link
Author

Sure... I am looking for module with PSRAM...I'll let you know

@ntwallace
Copy link

@h2zero changing that line results in:

lib/NimBLE/src/port/src/esp_nimble_mem.c:31:47: error: #elif with no expression
lib/NimBLE/src/port/src/esp_nimble_mem.c: In function 'nimble_platform_mem_calloc':
lib/NimBLE/src/port/src/esp_nimble_mem.c:44:47: error: #elif with no expression
*** [.pio/build/esp-wrover-kit/lib839/NimBLE/port/src/esp_nimble_mem.c.o] Error 1

It looks like in esp_nimble_mem.c all the #elifs are missing a defined. Adding that fixes the problem and the stack loads in PSRAM, e.g.:

#ifdef CONFIG_BT_NIMBLE_MEM_ALLOC_MODE_INTERNAL
    return heap_caps_malloc(size, MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT);
#elif defined CONFIG_BT_NIMBLE_MEM_ALLOC_MODE_EXTERNAL
    return heap_caps_malloc(size, MALLOC_CAP_SPIRAM|MALLOC_CAP_8BIT);
#elif defined CONFIG_BT_NIMBLE_MEM_ALLOC_MODE_IRAM_8BIT
    return heap_caps_malloc_prefer(size, 2, MALLOC_CAP_INTERNAL|MALLOC_CAP_IRAM_8BIT, MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT);

@h2zero
Copy link
Owner

h2zero commented Aug 14, 2020

@ntwallace Thanks for reporting this. Please consider raising the issue in esp-idf as that file is tracked from there. In the meantime I will consider fixing it here for this library's purposes.

@h2zero
Copy link
Owner

h2zero commented Aug 15, 2020

After looking at this again I think the fix is actually to define a value of 1 to the config define, such as:

#define CONFIG_BT_NIMBLE_MEM_ALLOC_MODE_EXTERNAL 1

I will add this line, commented, in nimconfig.

@ntwallace
Copy link

Ah good catch, makes sense. Thanks.

@darshan-mirajkar
Copy link
Author

Nice one guys... I am also looking for hardware with PSRAM to test this.

@ntwallace
Copy link

@darshan-mirajkar Mouser has the official Dev Kit C for $11 USD, looks like they have stock in most countries.

@darshan-mirajkar
Copy link
Author

Yes I know... I our application hardware we designed PSRAM with the help of expressif. Gerber is ready... Waiting for PCB. So we. Continue on that.

@h2zero
Copy link
Owner

h2zero commented Dec 29, 2020

Closing this as resolved.

@h2zero h2zero closed this as completed Dec 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants