Comments (23)
NimBLEDevice::deinit(true) will delete all BLE objects and free the memory.
from nimble-arduino.
NimBLEDevice::deinit(true) --- This is giving me error
NimBLEDevice::deinit() -- This is working fine but its not deleting HEAP of NimBLE.h Library Memory.
from nimble-arduino.
@h2zero
I want the complete NimBLE functionality, including server, to be removed.
How can it be done ?
deinit() ---> Its the only way to do that .
from nimble-arduino.
deinit(true) is the best way to clear it all. I suspect you are using an older commit before that was added. Please update your library to the latest commit and try again.
from nimble-arduino.
Ok...I'll try and update u
But Can we clear NimBLE library memory
from nimble-arduino.
But Can we clear NimBLE library memory
The deinit function will clear the library memory. Do you also want to clear the NimBLE stack memory? That can be done with the esp_bt_controller_mem_release() function, if you do this though you won't be able to re-init and use BLE again until reboot.
from nimble-arduino.
Yess....NimBLE stack memory also
Got it !!!
Thanks again
I'll try and update
from nimble-arduino.
One more thing
ESP32 device, the NimBLE consumes around 80 K of RAM. Is this OK? I feel this is large amount of RAM, although it is less than Bluedriod.
from nimble-arduino.
NimBLE consumes around 80 K of RAM
That seems a little high for NimBLE, but this depends on what you're doing with it, how many attributes/data/connections etc.
For example, in some simple test applications I have 306kB of free heap before initializing, and 277kB after connection, so 39kB consumed.
from nimble-arduino.
When I'm using BLE_UART service and the difference between the memory before and after initialisation is approx 16kB.
But When I'm using BLE and MQTT the difference is approx 110KB.
So, this diff is because of BLE used with MQTT or only MQTT
from nimble-arduino.
NimBLEDevice::deinit(true) --- This is giving me error
NimBLEDevice::deinit() -- This is working fine but its not deleting HEAP of NimBLE.h Library Memory.
@sanketa-54 I thought I'd leave a note for those who face the above problem. I faced a similar problem and then realized that I was using a slightly older version of the library and in that version deinit
doesn't include the clearAll
parameter. ::deinit(true)
should just work fine with the latest version of NimBLE-Arduino.
from nimble-arduino.
NimBLEDevice::deinit(true) --- This is giving me error
NimBLEDevice::deinit() -- This is working fine but its not deleting HEAP of NimBLE.h Library Memory.@sanketa-54 I thought I'd leave a note for those who face the above problem. I faced a similar problem and then realized that I was using a slightly older version of the library and in that version
deinit
doesn't include theclearAll
parameter.::deinit(true)
should just work fine with the latest version of NimBLE-Arduino.
@m-menon : Yes...Everyone should know latest commit.
from nimble-arduino.
When I'm using BLE_UART service and the difference between the memory before and after initialisation is approx 16kB.
But When I'm using BLE and MQTT the difference is approx 110KB.
So, this diff is because of BLE used with MQTT or only MQTT
@sanketa-54 Yes NimBLE is pretty light on it's own. When WiFi is used as well it causes the BT+Wifi coexist drivers to load + the WiFi driver and consumes quite a bit of heap. Sadly, there isn't much we can do about that here.
I've thought about creating a light weight WiFi library for basic connections / MQTT, that's only a thought for now.
from nimble-arduino.
@h2zero :
It wolud be great if there's lighter WIfi library for basic functions.
One more thing If we use pSRAM for ESP32 then can we reduce NimBLE stack , library and functionalities heap ?
from nimble-arduino.
It wolud be great if there's lighter WIfi library for basic functions.
I'm not sure how much could be saved by doing this but it would be an interesting experiment. I won't be attempting it for a while though.
One more thing If we use pSRAM for ESP32 then can we reduce NimBLE stack , library and functionalities heap ?
NimBLE can be loaded into PSRAM, which will reduce the main heap use. Also if you need further reduction you can disable functionality you don't need (client / server etc..). All documented in nimconfig.h and here
from nimble-arduino.
@h2zero : Yes Thanku
from nimble-arduino.
@h2zero : Is there a way to see detailed layout of memory in ESP32 - arduino platform?
The below stuff we can see in idf platform
Total sizes:
DRAM .data size: 19104 bytes
DRAM .bss size: 49264 bytes
Used static DRAM: 68368 bytes ( 56212 available, 54.9% used)
Used static IRAM: 118037 bytes ( 13035 available, 90.1% used)
Flash code: 1079425 bytes
Flash rodata: 274040 bytes
Total image size:~1490606 bytes (.bin may be padded larger)
Please help me this...This will help me to add pSRAM efficiently
from nimble-arduino.
I don't know if there is any way for arduino to produce that data.
Only way I know is to use IDF and arduino as a component.
from nimble-arduino.
@h2zero : I'm using psram with WROVER standalone module ( With Wifi , MQTT , Nimble ).
I have added this line in nimconfig.h as u suggested --- #define CONFIG_BT_NIMBLE_MEM_ALLOC_MODE_EXTERNAL 1
But only approx 10180 bytes is transferred to external RAM. ( that too after BLE init).
Please confirm the approach is correct and suggest more ways to reduce the memory.
from nimble-arduino.
Yes that looks correct. The NimBLE host is quite small.
from nimble-arduino.
Great !!!
Can u suggest some more ways to transfer some memory to pSRAM.
from nimble-arduino.
I can't think of much else you could do. This is not something I have tried personally.
from nimble-arduino.
Thanks alot for the help.
Please let me know if you got anything.
I'll also post if got anything related to memory optimization
from nimble-arduino.
Related Issues (20)
- Support for new ESP32 Arduino core (3.x) and IDF (5.1) HOT 7
- [Feature request] Support for ESP32-C6 HOT 17
- ESP_ERROR_CHECK failed on platformio, [email protected]
- Is it possible to advertise multiple 128bit services with data? HOT 1
- no advertising with ESP32-C6 HOT 6
- Set Manufacturer Data - Bug HOT 1
- Platformio, arduino and esp32 - pinning nimble to core and debug HOT 3
- onAuthenticationComplete() never called HOT 2
- ESP32-S3 crashing with the examples HOT 2
- Device name not showed at first connection HOT 2
- Allow only certain bonded client to connect to NimBLEServer. Whitelist in advertising does not work for already bonded peers
- Changing CPU frequency causes crash HOT 4
- Notification 8 byte data size
- how to get faster reconnects from deep sleep HOT 3
- ble does not work when cpu set to 40mhz or bellow HOT 2
- notify not updating values in nRF Connect HOT 1
- Is it possible to advertise the device name as a client? HOT 2
- How to achieve long-distance connection communication? HOT 3
- Rapid and Repeated: E NimBLEClient: Connection failed; status=574 Connection Failed to be Established HOT 2
- How to obtain client from existing server connection?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nimble-arduino.