Page 1 of 1

MFS using internal Flash

Posted: Fri Mar 15, 2019 3:45 pm
by 0x3333
In my first project using Chibios I have to store some parameters, small structure, containing 5 uint16_t entries., 10 bytes in total.

I'd like to use the internal flash to store these data, I'm using a STM32F103, so I don't want to attach a serial EEPROM or something. These parameters will not change for several months, eventually, it will, so internal flash seems a good option. STM32F103 has 128 pages(some 64 pages) with 1Kb each, so don't need to erase a big sector on writing.

I reserved the sectors on flash:

First 8KB bootloader, DAPBoot
Second 8KB Virtual EEPROM
The rest to Chibios app

Code: Select all

MEMORY
{
    boot    : org = 0x08000000, len = 8K
    flash0  : org = 0x08004000, len = 112K
    eeprom  : org = 0x0801E000, len = 8K
...


I'm using a "driver" to write to flash, that I borrow from BOOTLOADER. So far so good.

I found out that Chibios has MFS, but using external flash chips, is there anyone that tried using internal flash? Is that a bad decision? Seems trivial to use it, just point functions to config and good to go.

In the weekend I'll try to workout something, but if is there anything that could go wrong, would be good to know in advance... :)

Thanks

Re: MFS using internal Flash

Posted: Fri Mar 15, 2019 5:24 pm
by Giovanni
Hi,

It should be able to work with internal flash but I need to integrate the flash driver first.

Anyway, use the MFS in trunk because I am still working on it and made fixes and improvements, it is not yet back-ported to 19.1.

Giovanni

Re: MFS using internal Flash

Posted: Fri Mar 15, 2019 7:30 pm
by 0x3333
No problem, I'm working in trunk. I'm using Alex mirror in GitHub.

I'll try using my "driver", if it works, I'd like to ask some directions to write a STM32 internal flash driver if you believe is the right path.

Thanks again.

Re: MFS using internal Flash

Posted: Fri Mar 15, 2019 7:48 pm
by faisal
0x3333 wrote:No problem, I'm working in trunk. I'm using Alex mirror in GitHub.

I'll try using my "driver", if it works, I'd like to ask some directions to write a STM32 internal flash driver if you believe is the right path.

Thanks again.


Check this out: viewtopic.php?f=3&t=3524&start=10

It follows the BaseFlash abstraction that MFS uses, so should theoretically be compatible.

Re: MFS using internal Flash

Posted: Fri Mar 15, 2019 8:47 pm
by 0x3333
faisal wrote:
0x3333 wrote:No problem, I'm working in trunk. I'm using Alex mirror in GitHub.

I'll try using my "driver", if it works, I'd like to ask some directions to write a STM32 internal flash driver if you believe is the right path.

Thanks again.


Check this out: viewtopic.php?f=3&t=3524&start=10

It follows the BaseFlash abstraction that MFS uses, so should theoretically be compatible.


Great, I'll take a look. I'll probably adapt to F1, as it is a little simpler. Thanks!

Re: MFS using internal Flash

Posted: Fri Mar 15, 2019 8:56 pm
by faisal
0x3333 wrote:
faisal wrote:
0x3333 wrote:No problem, I'm working in trunk. I'm using Alex mirror in GitHub.

I'll try using my "driver", if it works, I'd like to ask some directions to write a STM32 internal flash driver if you believe is the right path.

Thanks again.


Check this out: viewtopic.php?f=3&t=3524&start=10

It follows the BaseFlash abstraction that MFS uses, so should theoretically be compatible.


Great, I'll take a look. I'll probably adapt to F1, as it is a little simpler. Thanks!


Sure, go ahead and add support for the F1 to that driver. Post patches to the forum if you do :)

Re: MFS using internal Flash

Posted: Wed May 01, 2019 3:10 am
by 0x3333
Just to inform, the patch with F1 flash driver support has been merged.

viewtopic.php?f=3&t=4323&start=30#p35276