Giter VIP home page Giter VIP logo

ee's Introduction

Hi there! 👋

I'm Nima Askari, an Electronic Engineer passionate about sharing my knowledge through libraries I've written. Welcome to my GitHub profile!

About Me

I'm dedicated to creating libraries that make life easier for electronic engineers like you. Whether it's optimizing code or simplifying complex tasks, I strive to provide solutions that enhance your projects.

Connect with Me, Support Me

  • YouTube
  • Instagram
  • LinkedIn
  • Email
  • Ko-fi

Thank you for your support! Together, we can build a vibrant community of electronic engineers. Let's innovate and create amazing projects!

ee's People

Contributors

brendena avatar leech001 avatar nimaltd avatar voidseeder avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ee's Issues

STM32H7

Hello
Would it be possible to modify the library to use it with an STM32H757XIH6, it has a flash of up to 2Mb on 2 banks, 8 sectors per bank and 128kb between two sectors. For each recording we must do it on 32bits even to write a single byte.
I need it to use with a Riverdi screen.
If you could port the library that would be great.
https://www.st.com/content/ccc/resource/training/technical/product_training/group0/1f/4f/b7/85/91/e0/4d/2f/STM32H7-Memory-Flash_FLASH/files/STM32H7-Memory-Flash_FLASH.pdf/_jcr_content/translations/en.STM32H7-Memory-Flash_FLASH.pdf

https://riverdi.com/fr/product/7-inch-lcd-display-capacitive-touch-panel-air-bonding-atouch-frame-stm32h7-rvt70hssfwca0

Problem withe the lib for the MCU STM32F411RET6

Hello nimaltd

I have problems with the ee.c libary.
I use the MCU STM32F411RET6 with STM32Cuben IDE.
The troubleshoot on the debug window show me:

Break at address "0xfffffffe" with no debug information available, or outside of program code.

Can you help me on Microsoft Teams or Skype?

I will pay you for the support.

Best regards
Alex Dechand
My e Mail adress: [email protected]

STM32G0

Nice library... How to use it on STM32G0?

Use of this lib for stm32l476 in shutdown mode

Hello and thanks for your library.
I tried to adapt it to L476 with the following parameters :

#define   _EE_USE_FLASH_PAGE_OR_SECTOR              (255)
...
#if defined(STM32L476xx)
#define   _EE_SIZE              2048
#define   _EE_ADDR_INUSE        (((uint32_t)0x08000000) | (_EE_SIZE * _EE_USE_FLASH_PAGE_OR_SECTOR))
#define   _EE_FLASH_BANK        FLASH_BANK_1
#define   _EE_PAGE_OR_SECTOR    PAGE_NUM
#if (_EE_USE_FLASH_PAGE_OR_SECTOR > 255)
#error  "Please Enter correct address, maximum is (255)"
#endif
#endif

It works !
But I need to use your lib in order to backup some data to enter in shutdown mode. I had the following idea in a sort of algorithm :

  • First boot : ee_init and ee_erase
  • Before shutdown : write : first byte is the number of data written just after. Next bytes : data
  • Sleep
  • After shutdown : ee_init , read the first byte to know the size of the next reading. Read the following bytes according to the size
  • Before shutdown : rewrite the first byte to the following append. Write after existing bytes new data.

Is this algorithm is possible according to your lib and flash caracteristics ?
Thanks in advance and sorry for my english
Axoul

Writing Half word (16-bit) instead of Word(32-bits)

Hi

What would happen if I decided to store 16-bits variables instead of 32-bits ? Would that free up spaces ? As it's mentioned in ST EEPROM Emulation Docs

Or it's prohibited ?

Also, Can you provide an example to know where to start ? ST eeprom emulation has an example and clear way to use that lib. (EE_init() is the starter ofcourse.) But here it's confusing and don't know where to start, Don't know how it work, or how should it work. As whether it label pages in headers or not..

Thanks

STM32F730R8T6

سلام، تشکر
می خواهم روی STM32F730R8T6 استفاده کنم، ولی موفق نشدم، لطفا راهنمایی کنید.
مثلا فرمت کار نمی کند، حتی خواستم از مثالهای F7 مربوط تلفیق کنم باز هم نشد.

FE instead of FF

Hello,
I am using a STM32L476RG.

//From eeConfig.h
#define _EE_PAGE_OR_SECTOR (2) //For page writes instead of by address
#define _EE_USE_FLASH_PAGE_OR_SECTOR (255) //Last page of bank 1
#define _EE_USE_RAM_BYTE (1048) //Have no idea ;)

//From ee.c
#if defined(STM32L476xx)
#define _EE_SIZE 2048
#define _EE_ADDR_INUSE (((uint32_t)0x08000000) | (_EE_SIZE * _EE_USE_FLASH_PAGE_OR_SECTOR))
#if (_EE_USE_FLASH_PAGE_OR_SECTOR < 256)
#define _EE_FLASH_BANK FLASH_BANK_1
#endif

#if (_EE_USE_RAM_BYTE > 0)
uint8_t ee_ram[_EE_USE_RAM_BYTE];
#endif

For the most part everything is working as expected except when I write the data into cleared FLASH some of 64 bit double words end up as FFFFFFFE instead of FFFFFFFF. This corruption occurs even in areas I am not writing.

I am sure its likely the way I have your library configured however I have been struggling for a few days now and so far I have not been able to solve it.

This is what I am writing. First I read in the flash and print via serial, its during debug and I have mass erase enabled in the IDE so the first set is all FF's next I write my buffer which is 25 words long starting with HEX 7C so far so good

image

after this write and commit here is a picture of the flash memory as reported by the IDE

image

You can see the FE in almost every other word except for some unknown reason in the first two. Also notice how the FE corruption extends off into FLASH even into areas I am not writing. It extends down a little over 1k. These are all showing as FF's before I write and commit and then change to FE's after

To make matters more interesting, in the area that I am writing the FE's almost always corresponds to me trying to write an FF.
I know crazy right ;)

I love the your library and it seems like a perfect low overhead way to manage a couple of configuration buffers for my project.
Its really pretty perfect if I could just make it work ;)
Thanks for any help,
Eric

data not written on stm32f103c8t6?

Hi,

i'm currently trying to write and read a data structure into eeprom which looks basically like this

`
typedef struct s_machinecfg {
uint8_t version,
uint16_t datax,
uint16_t datay,
..
} t_machinecfg, *p_machinecfg;

typedef struct s_machine {
t_machinecfg config;
..
} t_machine, *p_machine;
...

void read_config() {
ee_read(0, sizeof(t_machinecfg), &self.config);
if (self.config.version != stdconfig.version) {
memcpy(&self.config, &std_config, sizeof(t_machinecfg));
write_config();
}
}
void write_config() {
ee_format(0);
ee_WriteToRAM(0, sizeof(t_machinecfg), &self.config);
ee_commit();
}

...
t_machine machine;

ee_init();
read_config();

`

later, I want to alter some values in my configuration and save it using write_config() but every time I restart the controller, I get the unaltered data. If I change my stdconfig in the program, former data is displayed, so first write must work.. but why doesn't the second one do?

Do you have any idea what my problem could be?

my eeConfig.h looks this way:
`
#ifndef __EECONFIG_H
#define __EECONFIG_H

#define _EE_USE_FLASH_PAGE_OR_SECTOR (63)
#define _EE_USE_RAM_BYTE (1024)
#define _EE_VOLTAGE FLASH_VOLTAGE_RANGE_3 // use in some devices
#endif
`

Returns false, Please add example

Hi,
first of all, thank you for this library
I wanted to use this to store permanent data on my STM32F030K6T6
However, EE_Write() and EE_Writes() both return false on
if(HAL_FLASH_Program(FLASH_TYPEPROGRAM_WORD((i+StartVirtualAddress)*4)+_EEPROM_FLASH_PAGE_ADDRESS,(uint64_t)Data[i])!=HAL_OK)
which is on line 172 of eeprom.c
what could be the cause of the problem?

Configs for STM32F411

Hello @nimaltd

I am a beginner in STM32 and would like to know the information's that I must add in ee.c to use the library in STM32F411CEUx. The information I would like to know are the parameters (or any way to get it):

_EE_SIZE
_EE_ADDR_INUSE
_EE_FLASH_BANK
_EE_VOLTAGE_RANGE
_EE_PAGE_OR_SECTOR

Thanks for listening!
João Pedro Vilela

"Flash Word" might be 128-bit in some STM32H7 series

I am using the new version of the ee library in my STM32H7B0VBT6 and I noticed that it writes only 16 bytes per operation instead of the expected 32 bytes.

As I mentioned in my title, after checking the datasheet, it says the "Flash Word" is 128bit on my H7B0, so I think more "#if" is required for the writing function for H7.

But I'm not sure if all single-bank H7 follow this special case, it seems that most answers think the flash word is exactly 256-bit for all H7, even the MicroPython source code.

Thanks, nice lib, the datasheet I mentioned is as below:

image

Can you help me use these files in Arduino IDE?

Hello!!!
These files are really helpful for store data into Flash memory which works as EEPROM.
But my question regarding how to deploy these files into my Arduino IDE means using with ref. library in my ide and store data in it.
I know how to add the files but I want to add these files and run my code based on Arduino 32Core selection. I hope you really help me.

STM32F411xE - use lower sector

Hello,

Thanks for this library.

Just a quick question: why do you only allow writing on sectors 5-7 on the device, knowing they're 128Kb each (in my case)? Is it a bad practice to use the lower sectors (say, sector 1, which is 16Kb)?

Thanks!

Build failed for STM32 L476: "PageAddress" member for FLASH_EraseInitTypeDef not applicable

https://github.com/nimaltd/ee/blob/d9f9c7d7ac48163c2c69e4359703ae5de9669f7f/ee.c#L245C19-L245C19

Line 245 of ee.c " flashErase.PageAddress = _EE_ADDR_INUSE; "
Function is ee_format.

References FLASH_EraseInitTypeDef in stm32l4xx_hal_flash.h driver.

The L4 driver's FLASH_EraseInitTypeDef is missing "PageAddress" member.

Directly from the stm32 L4 driver file:


typedef struct
{
  uint32_t TypeErase;   /*!< Mass erase or page erase.
                             This parameter can be a value of @ref FLASH_Type_Erase */
  uint32_t Banks;       /*!< Select bank to erase.
                             This parameter must be a value of @ref FLASH_Banks
                             (FLASH_BANK_BOTH should be used only for mass erase) */
  uint32_t Page;        /*!< Initial Flash page to erase when page erase is disabled
                             This parameter must be a value between 0 and (max number of pages in the bank - 1)
                             (eg : 255 for 1MB dual bank) */
  uint32_t NbPages;     /*!< Number of pages to be erased.
                             This parameter must be a value between 1 and (max number of pages in the bank - value of initial page)*/
} FLASH_EraseInitTypeDef;

STM32F302x8 OK

These worked for me:

ee.c
`
#define PAGE 0
#define SECTOR 1
#define PAGE_NUM 31

#if defined(STM32F302x8)
#define _EE_SIZE 2048
#define _EE_PAGE_OR_SECTOR PAGE
#define _EE_ADDR_INUSE
(((uint32_t)0x08000000) | (_EE_SIZE * _EE_USE_FLASH_PAGE_OR_SECTOR))
#if (_EE_USE_FLASH_PAGE_OR_SECTOR > 31)
#error "Please Enter correct address, maximum is (31)"
#endif
#endif
`

eeConfig.h
#define _EE_USE_FLASH_PAGE_OR_SECTOR (31) #define _EE_USE_RAM_BYTE (1024) #define _EE_VOLTAGE FLASH_VOLTAGE_RANGE_3 // use in some devices

Ciao

Reserve memory for EEPROM emulation

Hello,

It is interesting to have some advice on how to make this memory reserve in the library description, to get more reliability in using this library and to avoid unnecessary rework after realizing that the program is using that memory space.

If the program is too big and the space is not enough, the compiler will return an error due to lack of memory, so the programmer can find another solution, perhaps using external memory, or another microcontroller with more memory capacity.

I found this post below, it might be interesting to reserve the memory so that the program is not written over the area where you intend to use EEPROM emulation:

You can reserve memory by modifying the linker script
Source: https://www.eevblog.com/forum/microcontrollers/eeprom-emulation-stm32f4-flash-vs-external-flash-chip/

In your linker file (*.ld)
Source: https://stackoverflow.com/questions/14666904/reserving-flash-location-for-eeprom-emulation-stm32f4

Maybe like this:
(STM32F407VG: 16K reserve at the beginning of memory)
(STM32CubeIDE file: STM32F407VGTX_FLASH.ld)

MEMORY
{
  CCMRAM    (xrw)    : ORIGIN = 0x10000000,   LENGTH = 64K
  RAM    (xrw)    : ORIGIN = 0x20000000,   LENGTH = 128K
  FLASH    (rx)    : ORIGIN = 0x8000000 + 16K,   LENGTH = 1024K - 16K
}

(STM32F407VG: 256K reserve at end of memory)
(STM32CubeIDE file: STM32F407VGTX_FLASH.ld)

MEMORY
{
  CCMRAM    (xrw)    : ORIGIN = 0x10000000,   LENGTH = 64K
  RAM    (xrw)    : ORIGIN = 0x20000000,   LENGTH = 128K
  FLASH    (rx)    : ORIGIN = 0x8000000,   LENGTH = 1024K - 256K
}

STM32F103 ee_format clears 0'th page

On STM32F1 architecture _EE_PAGE_OR_SECTOR is PAGE, then ee_format instruction:
flashErase.PageAddress = _EE_USE_FLASH_PAGE_OR_SECTOR;
wrongly assigns page number instead of page address and leads to clearing 0'th bank. Corrected line should be:
flashErase.PageAddress = _EE_ADDR_INUSE;

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.