Page 1 of 1

If want to enable WiFi and BLE with partitions two ota, 4MB flash is enough or not?

Posted: Fri Jun 08, 2018 2:35 pm
by bzd2132
Hi All,
I'm newer with ESP32, I want to use ESP32 to build a gateway for BLE devices. I build a very simple application with WiFi and BLE,
and found the flash already over 1MB. and the RAM remain about 60KB.
If enable two partitions OTA, is 4MB flash enough? How to customize the partition table. Thanks.

Re: If want to enable WiFi and BLE with partitions two ota, 4MB flash is enough or not?

Posted: Mon Jun 11, 2018 2:49 am
by kolban
Howdy and welcome to the forum.

This is a good document on using the partition tables:

http://esp-idf.readthedocs.io/en/latest ... ables.html

and this for OTA updates:

http://esp-idf.readthedocs.io/en/latest ... m/ota.html

maybe have a read of these documents and see if they help. If not, have a search in this forum and see if there is more light and if that doesn't help or you still have questions, then if nothing else you'll have more details background.

Re: If want to enable WiFi and BLE with partitions two ota, 4MB flash is enough or not?

Posted: Mon Jun 11, 2018 1:06 pm
by HenryM
I've run into a similar situation. I'm using WiFi, SmartConfig, BLE, AWS IoT, Shadow data, OTA, and a few other things. My application is sitting at about 1.1 MB. I've eliminated the factory partition and upped my two OTA partitions to 1.5 MB each. Once the system leaves the factory, we do not want the factory application to ever run again. So I figure we don't need the factory partition when we can load it into ota_0, configure and test the device, then let it update using ota_1. The factory partition seems like wasted space to me in many use cases.

Code: Select all

# Name,   Type, SubType, Offset,  Size,     Flags
nvs,      data, nvs,     0x9000,  0x6000,
otadata,  data, ota,     ,        0x2000,
phy_init, data, phy,     ,        0x1000,
certs,    data, spiffs,  ,        0x10000,
fact_cfg, data, spiffs,  ,        0x8000,
user_cfg, data, spiffs,  ,        0x8000,
storage,  data, spiffs,  ,        0x10000,
ota_0,    app,  ota_0,   0x100000,0x180000,
ota_1,    app,  ota_1,   ,        0x180000,
# factory,  app,  factory, 0x100000,1M,
# ota_0,    app,  ota_0,   ,        1M,
# ota_1,    app,  ota_1,   ,        1M

Re: If want to enable WiFi and BLE with partitions two ota, 4MB flash is enough or not?

Posted: Thu Sep 20, 2018 1:31 am
by RBruderick
When changing the partition table memory values, are there certain rules to be careful about - like size limits, how sizes add up, using certain multiples, and so forth? Must the board.txt values match the default.csv values?

I've just started working on a Wemos (knockoff) ESP32 with OLED, using Arduino 1.8.5 with default settings, selecting the Wemos Lolin32 board. It worked fine with just BLE. But when I added Wifi, it ran out of memory.

Then I edited ../espressif/ESP32/board.txt like this:

Code: Select all

lolin32.name=WEMOS LOLIN32

lolin32.upload.tool=esptool
lolin32.upload.maximum_size=1810720
lolin32.upload.maximum_data_size=494912
lolin32.upload.wait_for_upload_port=true

lolin32.serial.disableDTR=true
lolin32.serial.disableRTS=true

lolin32.build.mcu=esp32
lolin32.build.core=esp32
lolin32.build.variant=lolin32
lolin32.build.board=LOLIN32

lolin32.build.f_cpu=240000000L
lolin32.build.flash_mode=dio
lolin32.build.flash_size=4MB
lolin32.build.boot=dio
lolin32.build.partitions=default

lolin32.menu.FlashFreq.80=80MHz
lolin32.menu.FlashFreq.80.build.flash_freq=80m
lolin32.menu.FlashFreq.40=40MHz
lolin32.menu.FlashFreq.40.build.flash_freq=40m

lolin32.menu.PartitionScheme.default=Default
lolin32.menu.PartitionScheme.default.build.partitions=default
lolin32.menu.PartitionScheme.no_ota=No OTA (Large APP)
lolin32.menu.PartitionScheme.no_ota.build.partitions=no_ota
lolin32.menu.PartitionScheme.no_ota.upload.maximum_size=2097152
lolin32.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (Large APPS with OTA)
lolin32.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs
lolin32.menu.PartitionScheme.min_spiffs.upload.maximum_size=2966080
I also changed the default partition to:

Code: Select all

# Espressif ESP32 Partition Table
# Name, Type, SubType, Offset, Size, Flags
nvs,data,nvs,0x9000,20K,
otadata,data,ota,0xe000,8K,
app0,app,ota_0,0x10000,1280K,
app1,app,ota_1,0x150000,1280K,
eeprom,data,153,0x290000,4K,
spiffs,data,spiffs,0x291000,1468K,
Now the compile works, and the program executes, but it also stops right away with the Serial.print message "user code done".

Any idea what I'm messing up?

Re: If want to enable WiFi and BLE with partitions two ota, 4MB flash is enough or not?

Posted: Fri Sep 21, 2018 6:41 am
by anandvilayil
hi,

i have a doubt that, the ESP32 are able to work in APSTA mode along with BLE.? if you have any link regarding this please share with me

Re: If want to enable WiFi and BLE with partitions two ota, 4MB flash is enough or not?

Posted: Fri Sep 21, 2018 10:45 am
by ESP_Sprite
What makes you doubt that? As usual with WiFi/BL coexistence, performance will be impacted (depending on what you try to do) but to my knowledge there's no reason it won't work.

Re: If want to enable WiFi and BLE with partitions two ota, 4MB flash is enough or not?

Posted: Fri Sep 21, 2018 11:17 am
by RBruderick
Good news! I found the right partition table combination to get BLE, WiFi and the integrated OLED all working together! I'm so happy.
(I'll post those partition settings later. I'm at work, and they're on my home computer.)

Re: If want to enable WiFi and BLE with partitions two ota, 4MB flash is enough or not?

Posted: Fri Sep 21, 2018 1:18 pm
by mr1000
RBruderick wrote:When changing the partition table memory values, are there certain rules to be careful about - like size limits, how sizes add up, using certain multiples, and so forth? Must the board.txt values match the default.csv values?

I've just started working on a Wemos (knockoff) ESP32 with OLED, using Arduino 1.8.5 with default settings, selecting the Wemos Lolin32 board. It worked fine with just BLE. But when I added Wifi, it ran out of memory.

Then I edited ../espressif/ESP32/board.txt like this:

Code: Select all

lolin32.name=WEMOS LOLIN32

lolin32.upload.tool=esptool
lolin32.upload.maximum_size=1810720
lolin32.upload.maximum_data_size=494912
lolin32.upload.wait_for_upload_port=true

lolin32.serial.disableDTR=true
lolin32.serial.disableRTS=true

lolin32.build.mcu=esp32
lolin32.build.core=esp32
lolin32.build.variant=lolin32
lolin32.build.board=LOLIN32

lolin32.build.f_cpu=240000000L
lolin32.build.flash_mode=dio
lolin32.build.flash_size=4MB
lolin32.build.boot=dio
lolin32.build.partitions=default

lolin32.menu.FlashFreq.80=80MHz
lolin32.menu.FlashFreq.80.build.flash_freq=80m
lolin32.menu.FlashFreq.40=40MHz
lolin32.menu.FlashFreq.40.build.flash_freq=40m

lolin32.menu.PartitionScheme.default=Default
lolin32.menu.PartitionScheme.default.build.partitions=default
lolin32.menu.PartitionScheme.no_ota=No OTA (Large APP)
lolin32.menu.PartitionScheme.no_ota.build.partitions=no_ota
lolin32.menu.PartitionScheme.no_ota.upload.maximum_size=2097152
lolin32.menu.PartitionScheme.min_spiffs=Minimal SPIFFS (Large APPS with OTA)
lolin32.menu.PartitionScheme.min_spiffs.build.partitions=min_spiffs
lolin32.menu.PartitionScheme.min_spiffs.upload.maximum_size=2966080
I also changed the default partition to:

Code: Select all

# Espressif ESP32 Partition Table
# Name, Type, SubType, Offset, Size, Flags
nvs,data,nvs,0x9000,20K,
otadata,data,ota,0xe000,8K,
app0,app,ota_0,0x10000,1280K,
app1,app,ota_1,0x150000,1280K,
eeprom,data,153,0x290000,4K,
spiffs,data,spiffs,0x291000,1468K,
Now the compile works, and the program executes, but it also stops right away with the Serial.print message "user code done".

Any idea what I'm messing up?
It seems you're flashing your program to some addres that has no code.
You have to go to 'menuconfig->Partition Table' and modify 'Factory app partition offset' and set as same as your partition, in your case '0x10000'.

Re: If want to enable WiFi and BLE with partitions two ota, 4MB flash is enough or not?

Posted: Tue Oct 09, 2018 3:14 pm
by mpbejo
Hi everybody,
A question for RBruderick, You did not post the right partition table combination to get BLE, WiFi.
Could You share it?,
Actually I run my scketch with wifi and ble, but without ota and the ble doesn't work very well
Thank You.
Best Regards
Marco

Re: If want to enable WiFi and BLE with partitions two ota, 4MB flash is enough or not?

Posted: Thu Oct 11, 2018 1:27 am
by RBruderick
Hey, Marco.
Sorry about that! Here are my changes that are working well for me:

Code: Select all

 *   Edit ../esp32/boards.txt, find your board (WEMOS LOLIN32), and set:
 *     lolin32.upload.maximum_size=1810720
 *     lolin32.upload.maximum_data_size=394912
 *  
 *   Then edit the Partition Table:  default.CSV
 *     # Espressif ESP32 Partition Table
 *     # Name, Type, SubType,    Offset,    Size, Flags
 *     nvs      ,data,   nvs,      0x9000,   24K,
 *     phy_init,   data,   phy,      0xf000,   4K,
 *     factory,   app,      factory,   0x10000,   3M,