MFS using internal Flash

Discussions and support about ChibiOS/HAL, the MCU Hardware Abstraction Layer.
0x3333
Posts: 57
Joined: Thu Mar 07, 2019 10:19 pm
Has thanked: 7 times
Been thanked: 6 times

MFS using internal Flash

Postby 0x3333 » Fri Mar 15, 2019 3:45 pm

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

User avatar
Giovanni
Site Admin
Posts: 14457
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1076 times
Been thanked: 922 times
Contact:

Re: MFS using internal Flash

Postby Giovanni » Fri Mar 15, 2019 5:24 pm

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

0x3333
Posts: 57
Joined: Thu Mar 07, 2019 10:19 pm
Has thanked: 7 times
Been thanked: 6 times

Re: MFS using internal Flash

Postby 0x3333 » Fri Mar 15, 2019 7:30 pm

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.

faisal
Posts: 374
Joined: Wed Jul 19, 2017 12:44 am
Has thanked: 44 times
Been thanked: 60 times

Re: MFS using internal Flash

Postby faisal » Fri Mar 15, 2019 7:48 pm

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.

0x3333
Posts: 57
Joined: Thu Mar 07, 2019 10:19 pm
Has thanked: 7 times
Been thanked: 6 times

Re: MFS using internal Flash

Postby 0x3333 » Fri Mar 15, 2019 8:47 pm

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!

faisal
Posts: 374
Joined: Wed Jul 19, 2017 12:44 am
Has thanked: 44 times
Been thanked: 60 times

Re: MFS using internal Flash

Postby faisal » Fri Mar 15, 2019 8:56 pm

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 :)

0x3333
Posts: 57
Joined: Thu Mar 07, 2019 10:19 pm
Has thanked: 7 times
Been thanked: 6 times

Re: MFS using internal Flash

Postby 0x3333 » Wed May 01, 2019 3:10 am

Just to inform, the patch with F1 flash driver support has been merged.

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


Return to “ChibiOS/HAL”

Who is online

Users browsing this forum: No registered users and 26 guests