Skip to content

data not written on stm32f103c8t6? #23

@TecDroiD

Description

@TecDroiD

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
`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions