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

Add STM32 peripheral RCC enable bit enums #76

Open
benedekkupper opened this issue Nov 3, 2021 · 4 comments
Open

Add STM32 peripheral RCC enable bit enums #76

benedekkupper opened this issue Nov 3, 2021 · 4 comments

Comments

@benedekkupper
Copy link

One of the most important thing for any peripheral driver is to be able to enable the root clock for the peripheral. On STM32's this is done via RCC A[H/P]nBENR registers. It would be nice if the database contained an enum like in https://github.com/IntergatedCircuits/STM32_XPD/blob/master/STM32F0_XPD/inc/xpd_rcc.h#L78, where the position consists of a register offset from the lowest A[H/P]nBENR register, and a bit offset within the register. Then the appropriate enum values should be bound to the peripheral instances, allowing a peripheral driver to call a uniform RCC driver API to enable/reset/enable in sleep mode a peripheral.

@salkinium
Copy link
Member

You can derive this from parsing the CMSIS-SVD files. modm parses the CMSIS header files for STM32 (since the SVD files are less accurate) and uses that to provide such an API. However, some manual fixing is still required as the mapping is a little fuzzy.

@salkinium
Copy link
Member

We've integrated bit fields before for the STM32F1 AFIO remap groups, so moving the RCC bit fields into here would probably be useful.

@benedekkupper
Copy link
Author

Yes, so basically what I'm asking is the same as what's already suggested in the modm parser/generator.

@salkinium
Copy link
Member

Just FYI: I'm currently writing my master's thesis so I don't have the head space to refactor this. I'm happy to review pull requests though, if you want to give it a shot.

There is an effort by me to add a much better, proper Python API to this repo, but it hasn't been a big enough priority for me to finish it: #35

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants