Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a logger system #1

Open
lpatiny opened this issue May 29, 2022 · 6 comments
Open

Create a logger system #1

lpatiny opened this issue May 29, 2022 · 6 comments

Comments

@lpatiny
Copy link
Member

lpatiny commented May 29, 2022

Create a big binary file (1024 * 1024) on the spiffs partition

Try to have random access and create a logger

https://www.mischianti.org/2020/06/04/esp32-integrated-spiffs-filesystem-part-2/

@lpatiny
Copy link
Member Author

lpatiny commented Jun 3, 2022

Be inspired : https://github.com/Hackuarium/bioreactor-platformio/blob/master/BioMain/include/hack/SSTLogger.cpp

https://esp32.com/viewtopic.php?t=18164

  • Need to be able to write directly on the parition
  • Need to create a new partition table with exactly 1024*1024 bytes
  • We also need to erase a block of 4k before writting on this partition
  • There is somewhere on expressif website the instruction to directly write in a partition

We don't want to create a file !!!

@andrescvargasr
Copy link
Collaborator

@lpatiny
Copy link
Member Author

lpatiny commented Jun 8, 2022

No it is much more low level that this. We should I think use: https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/storage/spi_flash.html#flash-partition-apis

We should use directly the instructions read, write, erase

https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/storage/spi_flash.html#_CPPv418esp_partition_readPK15esp_partition_t6size_tPv6size_t

Interestingly erase range is super similar to the flash we use in the bioreactor: https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/storage/spi_flash.html#_CPPv418esp_partition_readPK15esp_partition_t6size_tPv6size_t

So I think copying the code of the logger and replace the corresponding instructions by those read, write and erase should work.

Please take care to setup a partition that is exactly 1024 * 1024 bytes for the logging system.

@andrescvargasr
Copy link
Collaborator

Preferences.h is the native solution in Platformio, from Spressif page:

"The Preferences library is unique to arduino-esp32. It should be considered as the replacement for the Arduino EEPROM library."

https://docs.espressif.com/projects/arduino-esp32/en/latest/api/preferences.html#

I will use this library for migration if you are agree.

@lpatiny
Copy link
Member Author

lpatiny commented Dec 26, 2022

We should really create our own partition scheme and directly access the memory like we do with the SST memory.

We should create a custom partition:

https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/partition-tables.html#type-field

We would like to directly write to the partition because it is faster and more compact. Will will also looks very similar to : https://github.com/Hackuarium/bioreactor-platformio/blob/master/BioMain/include/hack/SSTLogger.cpp

@andrescvargasr
Copy link
Collaborator

We have a branch for Logger in the project: Logger

We can try to use this version of Logger in Logger branch to check if everything runs well:

I will use the esp32-c3 that you bring me in November!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants