OS SDK Implement a non generic flash

eliott
Posts: 1
Joined: Sat Mar 28, 2020 11:57 am

OS SDK Implement a non generic flash

Postby eliott » Sat Mar 28, 2020 1:27 pm

Hi all,

I developed a home automation system based on ESP8266 controled by ATmega328P.

I created an HMI based on http server. There is a memory flash attached to the ATmega328P to host html pages, css style and javascript necessary to web browser page display. Also the system allow to update the web page content or MCU program via the web interface.

The final result is successfull but I think that it is a pity that 8bit processor order a 32bit processor much more powerfull and faster.

So I bought a ESP32_Devkitc_V4 because i'm very interested on https server functionality. This will allow to access directly to my home automation control from the internet without using a VPN to secure the access.

Today I thinks the best solution is to use the following API components:

  • HTTPS web server
  • External flash with Virtual filesystem component for html pages
I didn't opened the HTTPS web server example but I think the bridge to call the page content from flash will be easy.

Also I want to implement FTP server with the TCP server components to easy update the page content, or keep web update.


Today I need help to start thinking with OS SDK, I'm very not familliar with this and usually code myself low layer libs and functional layer (I don't use arduino sdk). To manage my current flash I have my own flash system partitionning for example.

I understanded the possibility to add a non generic flash and openned code example "ext_flash_fatfs".

I added the "ext_flash" structure variable to assign a non generic flash, but I don't know how to fill it:

Code: Select all

    // Add device to the SPI bus
	esp_flash_t* ext_flash = {
		.spi_flash_host_driver_t = TOFILL,
		.chip_drv = TOFILL,
		.os_func = TOFILL,
		.os_func_data = TOFILL,
		.read_mode = TOFILL,
		.size= TOFILL
		.chip_id= TOFILL
	};
I see in the components "spi_flash" files:

witch one I have to duplicate or modify ? How to call my non generic file/function/headers config ?

For the host driver If I understand I have to duplicate an define a new ESP_FLASH_DEFAULT_HOST_DRIVER() int he "memspi_host_driver.h" and change the pointer fonction (and create the function) if the current function is not compatible with my flash memory ?

Also I'll add a new declaration in "memspi_host_driver.c"

Code: Select all

static const spi_flash_host_driver_t esp_flash_default_host = ESP_FLASH_DEFAULT_HOST_DRIVER();
Eg:
  • static const spi_flash_host_driver_t esp_flash_microchip_host = ESP_FLASH_MICROCHIP_HOST_DRIVER();
For the next I don't know how to change "chip_drv" and for example the define "#define CMD_RDID 0x9F" who should be 90h for Microchip flash.

Thank you for help.

Regards,

Eliott.

Who is online

Users browsing this forum: No registered users and 9 guests