I have an application where I need to start a Chibi-based program while keeping some of the peripherals operational. The main obstacle to this is the fact that everything gets reset in hal_lld.c.
For now I've solved this in an application-specific way (involving some conditionals in hal_lld.c), but a more general way is obviously preferable.
All the affected code is in hal_lld_init(), so maybe a simple solution would to be an option to override this routine with a project-specific one. Or is there a better way?
(I've also disabled much of the clock configuration for now, but that's in board.c so much more controllable)
Selective peripheral reset on startup
- Giovanni
- Site Admin
- Posts: 14455
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: Selective peripheral reset on startup
Hi,
I tried something about this in the H7 clock initialization. It is possible to do not init anything but assume frequencies to be set to specific values. Perhaps the concept could be expanded and back-ported to older devices.
Giovanni
I tried something about this in the H7 clock initialization. It is possible to do not init anything but assume frequencies to be set to specific values. Perhaps the concept could be expanded and back-ported to older devices.
Giovanni
Re: Selective peripheral reset on startup
The clocks are straightforward, because its just a matter of modifying the __early_init() function in board.c (at the simplet level - just remove the call to stm32_clock_init() ).
The I/O and peripherals are more problematic with the existing structure, since they are all reset in hal_lld.c.
I've implemented my idea of making hal_lld_init() a weak function, so that it can be overridden. I think this small change would be useful for the few situations where it matters, while not adding lots of complication for everyone else.
The only other related change is that hal_lld_backup_domain_init() has to be made global, so that it can still be called from an overridden hal_lld_init().
So far, this works well for me (using F767).
The I/O and peripherals are more problematic with the existing structure, since they are all reset in hal_lld.c.
I've implemented my idea of making hal_lld_init() a weak function, so that it can be overridden. I think this small change would be useful for the few situations where it matters, while not adding lots of complication for everyone else.
The only other related change is that hal_lld_backup_domain_init() has to be made global, so that it can still be called from an overridden hal_lld_init().
So far, this works well for me (using F767).
Return to “Development and Feedback”
Who is online
Users browsing this forum: No registered users and 10 guests