wollewald / EEPROM_SPI_WE

Arduino library for SPI based EEPROMs
https://wolles-elektronikkiste.de/en/eeprom-part-3-external-spi-eeproms
MIT License
9 stars 2 forks source link

Test for eeprom 25AA640 stm32 controller #5

Open simogaspa84 opened 9 months ago

simogaspa84 commented 9 months ago

Hi .

I would like to know if you tried the library with the following eeprom 25AA640 and if i do the porting from c++ to c for using with stm32 microcontrolelr if you see any issues . Thanks

wollewald commented 9 months ago

Hi @simogaspa84 , I tested the library with an 25LC640 and therefore it should also work with a 25AA640. The main difference is the clock frequency which is only 1 MHz for the 25AA640 (according to Microchip's data sheet).

If you use C++, no problem. You would just need to create your object using:

EEPROM_SPI_WE yourObjectName = EEPROM_SPI_WE(csPin, wpPin, 1000000);

But you wrote that you want to port the code from C++ to C. For this I think you would need to re-write the library. Since C++ is object orientated and C isn't, the problems would already start with the constructor for the ESP_SPI_WE object. The next hurdle would be the SPI class that my library uses. I think porting C++ Code into C is a general problem, not only for this library.

simogaspa84 commented 9 months ago

Hi @wollewald thanks for your reply.. i am going to change your library to use C instead C++ and to make it work for stm32 microcontrolelrs using the HAL. when it works i will upload it in github

simogaspa84 commented 9 months ago

Another question @wollewald which is the correct function to call if i want to write 32 bytes or 64 bytes ? I mean usually we want to write pages . Thanks

wollewald commented 9 months ago

@simogaspa84 , there is no specific command for page writing or any setting in the EEPROM. In my library you set the page size with setPageSize but there is no magic behind. I just sets the library-internal variable pageSize. If you write something to the EEPROM this variable is used to cut your data into chunks which fit into the pages. Here you can see how I implemented this:

https://github.com/wollewald/EEPROM_SPI_WE/blob/6e2373d130ade3ce239de09d7751a65b2002dce3/src/EEPROM_SPI_WE.cpp#L225C12-L225C12