Multiple Applications from SD card
- Vader_Mester
- Posts: 300
- Joined: Tue Dec 05, 2017 8:28 pm
- Location: Hungary
- Contact:
Multiple Applications from SD card
Hey Guys,
I'm thinking about a method to have multiple different applications to be run from a uSD card.
I had the thought that I have an additional uC (referred to as SMC - System Management Controller) in the design. The SMC has functions anyways, eg providing USB connectivity, managing system power, display, so why not do this also.
Basically the user would use the LCD to select an app to run on the ESP which is the main processor.
I thought about using flash, and reflash every time an app needs to be switched during runtime (SMC can manage this, but it will be slow, and would wear down the fash quickly).
Clearly the flash is not designed for this.
Instead can I use the ESP32 with a PSRAM in the place of the flash?
This is the plan:
- Boot board and SMC, keep the ESP deactivated with CHIP_EN line.
- Copy the first running .bin image to the PSRAM.
- Boot ESP from the PSRAM like you would with the flash, and let the app run.
- When app is switched, the ESP is reset with CHIP_EN and kept disabled
- New bin is copied into the PSRAM
- ESP boots again.
Small schema of the system concerning the ESP and PSRAM
SInce the flash and PSRAM interface is the same, since they are used in parallel, write and read commands are the same, although the Flash implements a ton more other commands to provide write protection, and more wait and dummy cycles.
Is it technically possible? Where should I keep looking for modifying things software wise?
I'm thinking about a method to have multiple different applications to be run from a uSD card.
I had the thought that I have an additional uC (referred to as SMC - System Management Controller) in the design. The SMC has functions anyways, eg providing USB connectivity, managing system power, display, so why not do this also.
Basically the user would use the LCD to select an app to run on the ESP which is the main processor.
I thought about using flash, and reflash every time an app needs to be switched during runtime (SMC can manage this, but it will be slow, and would wear down the fash quickly).
Clearly the flash is not designed for this.
Instead can I use the ESP32 with a PSRAM in the place of the flash?
This is the plan:
- Boot board and SMC, keep the ESP deactivated with CHIP_EN line.
- Copy the first running .bin image to the PSRAM.
- Boot ESP from the PSRAM like you would with the flash, and let the app run.
- When app is switched, the ESP is reset with CHIP_EN and kept disabled
- New bin is copied into the PSRAM
- ESP boots again.
Small schema of the system concerning the ESP and PSRAM
SInce the flash and PSRAM interface is the same, since they are used in parallel, write and read commands are the same, although the Flash implements a ton more other commands to provide write protection, and more wait and dummy cycles.
Is it technically possible? Where should I keep looking for modifying things software wise?
Code: Select all
task_t coffeeTask()
{
while(atWork){
if(!xStreamBufferIsEmpty(mug)){
coffeeDrink(mug);
} else {
xTaskCreate(sBrew, "brew", 9000, &mug, 1, NULL);
xSemaphoreTake(sCoffeeRdy, portMAX_DELAY);
}
}
vTaskDelete(NULL);
}
Re: Multiple Applications from SD card
https://github.com/tobozo/M5Stack-SD-Updater
Whether you can get the mmu to address a spiram on the instruction bus I don't know.
Whether you can get the mmu to address a spiram on the instruction bus I don't know.
Re: Multiple Applications from SD card
I wonder if you could remove the SMC option to simplify it. Use OTA1 when it boots to read the uSD and copy the app you want to PSRAM. When that is done re-boot using PSAM. Of course you would have to disable the RAM testing stuff in menuconfig.
- Vader_Mester
- Posts: 300
- Joined: Tue Dec 05, 2017 8:28 pm
- Location: Hungary
- Contact:
Re: Multiple Applications from SD card
The SMC is there to houskeep the board anyways. It's like a BIOS chip on a PC motherboard.
It is supposed to have tons of GPIOs, USB, OSB-OTG, and serial.
It will manage power, and LCD screen, USB, and on-board debugging via the LCD.
(This is handy, so I don't need to plug the ESP into a PC for debugging, but the serial messages will be displayed on the LCD (without the ESP needing to drive it. This will be mounted to the wall, so this is more convenient. And the LCD will be 800x480, driven by an FT813.)
This would be a UI based system. The LCD is always working. I'm still in the overall design phase, but I want to use a common QSPI bus between my SMC and ESP32.
I will use an STM32L467RC6T, which is Arm cortex M4, maximum 80Mhz, but it is the cheapest (about 5EUR/pc), and it has 64pins, QSPI, and all sorts of jazz right there.
The ESP is there for the unlimeted raw Xtensa pooweeeeer
I was also thinking about using multiple Ota partitions instead, and a 16MB flash, but using RAM would be much more convenient...at least from a speed standpoint.
It is supposed to have tons of GPIOs, USB, OSB-OTG, and serial.
It will manage power, and LCD screen, USB, and on-board debugging via the LCD.
(This is handy, so I don't need to plug the ESP into a PC for debugging, but the serial messages will be displayed on the LCD (without the ESP needing to drive it. This will be mounted to the wall, so this is more convenient. And the LCD will be 800x480, driven by an FT813.)
This would be a UI based system. The LCD is always working. I'm still in the overall design phase, but I want to use a common QSPI bus between my SMC and ESP32.
I will use an STM32L467RC6T, which is Arm cortex M4, maximum 80Mhz, but it is the cheapest (about 5EUR/pc), and it has 64pins, QSPI, and all sorts of jazz right there.
The ESP is there for the unlimeted raw Xtensa pooweeeeer
I was also thinking about using multiple Ota partitions instead, and a 16MB flash, but using RAM would be much more convenient...at least from a speed standpoint.
Code: Select all
task_t coffeeTask()
{
while(atWork){
if(!xStreamBufferIsEmpty(mug)){
coffeeDrink(mug);
} else {
xTaskCreate(sBrew, "brew", 9000, &mug, 1, NULL);
xSemaphoreTake(sCoffeeRdy, portMAX_DELAY);
}
}
vTaskDelete(NULL);
}
Re: Multiple Applications from SD card
I was recently researching something similar. If its a one-off, flash is cheap, so you could connect external flash by modifying the efuses and replace it when its worn.
https://esp32.com/viewtopic.php?f=12&t=2884
https://esp32.com/viewtopic.php?f=12&t=2884
Re: Multiple Applications from SD card
Try look at PocketSprite, it should be open source and they can load different games and its based on esp32Pibbotley wrote:I was recently researching something similar. If its a one-off, flash is cheap, so you could connect external flash by modifying the efuses and replace it when its worn.
https://esp32.com/viewtopic.php?f=12&t=2884
Re: Multiple Applications from SD card
Switching apps is easy with web ota if waiting 30 secs is ok, the problem was wearing out the flash, but even reflashing several times a day ends up not being an issue so I didn't bother with external flash.
- Vader_Mester
- Posts: 300
- Joined: Tue Dec 05, 2017 8:28 pm
- Location: Hungary
- Contact:
Re: Multiple Applications from SD card
Well, no need to use Wifi.
AFAIK there is a way to copy an app from the SD card to an OTA part., so there is no need to use Wifi.
But you actually put the bug in my ear with that one
AFAIK there is a way to copy an app from the SD card to an OTA part., so there is no need to use Wifi.
But you actually put the bug in my ear with that one
Code: Select all
task_t coffeeTask()
{
while(atWork){
if(!xStreamBufferIsEmpty(mug)){
coffeeDrink(mug);
} else {
xTaskCreate(sBrew, "brew", 9000, &mug, 1, NULL);
xSemaphoreTake(sCoffeeRdy, portMAX_DELAY);
}
}
vTaskDelete(NULL);
}
Re: Multiple Applications from SD card
I store the app bin files on a nas drive and upload them via a browser on my tablet
Who is online
Users browsing this forum: Ask Jeeves [Bot], Baidu [Spider], Bing [Bot] and 98 guests