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

bzd2132
Posts: 1
Joined: Fri Jun 08, 2018 2:26 pm

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

Postby bzd2132 » Fri Jun 08, 2018 2:35 pm

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.

User avatar
kolban
Posts: 1683
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

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

Postby kolban » Mon Jun 11, 2018 2:49 am

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.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

HenryM
Posts: 15
Joined: Fri May 25, 2018 12:48 pm

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

Postby HenryM » Mon Jun 11, 2018 1:06 pm

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

RBruderick
Posts: 3
Joined: Wed Sep 19, 2018 11:07 am

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

Postby RBruderick » Thu Sep 20, 2018 1:31 am

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?

anandvilayil
Posts: 17
Joined: Mon Apr 30, 2018 12:14 pm

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

Postby anandvilayil » Fri Sep 21, 2018 6:41 am

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

ESP_Sprite
Posts: 2048
Joined: Thu Nov 26, 2015 4:08 am

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

Postby ESP_Sprite » Fri Sep 21, 2018 10:45 am

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.

RBruderick
Posts: 3
Joined: Wed Sep 19, 2018 11:07 am

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

Postby RBruderick » Fri Sep 21, 2018 11:17 am

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.)

mr1000
Posts: 21
Joined: Fri Jan 12, 2018 9:05 am

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

Postby mr1000 » Fri Sep 21, 2018 1:18 pm

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'.

mpbejo
Posts: 4
Joined: Tue Oct 09, 2018 3:04 pm

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

Postby mpbejo » Tue Oct 09, 2018 3:14 pm

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

RBruderick
Posts: 3
Joined: Wed Sep 19, 2018 11:07 am

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

Postby RBruderick » Thu Oct 11, 2018 1:27 am

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,

Who is online

Users browsing this forum: jeanbie and 16 guests