Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parameter saving functionality #19

Closed
andre-nguyen opened this issue Aug 11, 2014 · 11 comments
Closed

Parameter saving functionality #19

andre-nguyen opened this issue Aug 11, 2014 · 11 comments

Comments

@andre-nguyen
Copy link

If I recall correctly,
there isn't a driver written yet to use the on board eeprom (microchip 24FC128??) to be able to save parameters. I would be interested to try my hand at writing it now that I'm back from competition.

Any tips would be appreciated.

@LorenzMeier
Copy link
Member

Hi,
Rather than going for the EEPROM, I suggest using the flash:
https://github.com/pavel-kirienko/px4esc/blob/master/firmware/src/config/flash_storage.c
https://github.com/pavel-kirienko/px4esc/blob/master/firmware/src/config/config.c

@pavel-kirienko Could you maybe provide some additional guidance? @dominiho This is the flash based param storage I was referring to.

@andre-nguyen
Copy link
Author

I think you meant to tag @pavel-kirienko.

@LorenzMeier
Copy link
Member

Thanks, indeed!

@andre-nguyen andre-nguyen changed the title EEPROM driver Parameter saving functionality Aug 11, 2014
@andre-nguyen
Copy link
Author

Cool, I'll see what I can do. Hopefully this isn't too critical and I can take my time on this.

@andre-nguyen
Copy link
Author

Just to be sure I'm going down the right path with this. So the px4esc uses ChibiOS so I can't just shove those files into the px4flow code as is. But I should be able to implement a similar structure using the functions defined in https://github.com/PX4/Flow/blob/master/lib/STM32F4xx_StdPeriph_Driver/inc/stm32f4xx_flash.h is this correct?

@pavel-kirienko
Copy link
Member

Yes, you'll need to replace the calls specific to ChibiOS, which is easy to do. I think you only need to replace these:

  • chMtxInit() - inits a mutex (can be removed if thread safety is not required)
  • chMtxLock() - locks a mutex
  • chMtxUnlock() - unlocks a mutex
  • chSysLock() - disables IRQ
  • chSysUnock() - enables IRQ

But I should be able to implement a similar structure using the functions defined in https://github.com/PX4/Flow/blob/master/lib/STM32F4xx_StdPeriph_Driver/inc/stm32f4xx_flash.h is this correct?

I highly recommend you to stay away from STM32's SPL, it's virtually unusable. You can use https://github.com/pavel-kirienko/px4esc/blob/master/firmware/src/config/flash_storage.c if you provide needed register definitions, like https://github.com/ChibiOS/ChibiOS-RT/blob/stable_2.6.x/os/hal/platforms/STM32F1xx/stm32f10x.h#L916.

@LorenzMeier
Copy link
Member

@andre-nguyen Any news on this? 8). Seems like a popular feature request.

@andre-nguyen
Copy link
Author

Sadly no :(
So busy with the start of the school year with all the funding reports I have to write and the recruitment of new team members. It's still in the pipeline though since were investigating the possibility setting up a project for someone to attempt to fuse two optical flows. I can also say that there won't be progress for probably the next 2 weeks.

@angelsantamaria
Copy link

Hi guys,
I was dealing with the same problem, and finally in my case I changed the firmware with the parameters that I want and I flashed the sensor with the bootloader (i.e. in the "settings.c" file). In my case, it works because I don't need to change too much those parameters once set.

@LorenzMeier
Copy link
Member

@jgoppert In case you're tired resetting parameters all the time - could be actually quite quick.

basil-huber added a commit to lis-epfl/Flow that referenced this issue Mar 9, 2015
Parameters are now saved automatically to flash when sent to PX4Flow.
If no parameters are saved, it falls back to default parameters (as defined in settings.c)
I moved the setting of the parameters from 'communication.c:handle_mavlink_message' to 'settings.c:set_global_data_param', since it concerns the settings and not the communcication.
This allows to set parameters easily during runtime.
Parameters are only saved if sent via mavlink, not if they are setted using 'set_global_data_param(..)'.
We could also changed this...
Added basic functions to write to flash memory ('flash.c')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants