Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By woodwax
#35148 Hello, I have an other problem, what if the NUMBER is too big and struct Watering_valve doesnt fit into one sector(>4096bytes). I tried to save and read like this:

spi_flash_read(mem_sector0,(uint32_t *)&watering_valve[0],4096);
spi_flash_read(mem_sector1,(uint32_t *)&watering_valve[0]+4096,NUMBER*sizeof(watering_valve[0])-4096);

spi_flash_erase_sector(mem_sector0>>8);
spi_flash_write(mem_sector0,(uint32_t *)&watering_valve[0],4096);
spi_flash_erase_sector(mem_sector1>>8);
spi_flash_write(mem_sector1,(uint32_t *)&watering_valve[0]+4096,NUMBER*sizeof(watering_valve[0])-4096);