Comments (4)
And possibly the issue might be the offset of the register:
struct Peripheral {
struct bxCAN : RegisterPack<0x4000'6400, 1024> {
// Filter initialization mode
// When defining the PackedRegister the offset must be in bits! so (0x200)*8 = 4096
using FINIT =
Field<PackedRegister<bxCAN, RegBitSize::b32, 4096>, 32, 0, read_write>;
};
};
Let me know if that helps.
from cppreg.
I do not have experience with that particular MCU so let me ask a few generic questions :)
-
Which compiler are you using?
-
The cppreg version of your snippet would look like:
void can_t::init_filters_() { Peripheral::bxCAN::FINIT::set(); // ... magic ... // Turn all filters initialization -> active Peripheral::bxCAN::FINIT::clear(); while ( Peripheral::bxCAN::FINIT::is_set()) __nop(); }
right?
-
Any chances you can isolate the generated assembly listing?
Could you try the following and see if that works:
struct Peripheral {
struct bxCAN : RegisterPack<0x4000'6400, 1024> {
// Filter initialization mode
using FINIT =
Field<PackedRegister<bxCAN, RegBitSize::b32, 0x200>, 32, 0, read_write>;
constexpr static auto active_mode = FINIT::type{0x2A1C0E00};
constexpr static auto initialization_mode = FINIT::type{0x2A1C0E01};
};
};
// ...
void can_t::init_filters_() {
Peripheral::bxCAN::FINIT::write<Peripheral::bxCAN::initialization_mode>();
// ... magic ...
// Turn all filters initialization -> active
Peripheral::bxCAN::FINIT::write<Peripheral::bxCAN::active_mode>();
while (Peripheral::bxCAN::FINIT::read() != Peripheral::bxCAN::active_mode) __nop();
}
from cppreg.
Mind the typo in the last snippet ... FINIT
should be:
// width is 1 bit not 32.
using FINIT =
Field<PackedRegister<bxCAN, RegBitSize::b32, 4096>, 1, 0, read_write>;
from cppreg.
// When defining the PackedRegister the offset must be in bits! so (0x200)*8 = 4096
Oh, my! That was it! My eyes blurred after 78 PackedRegister
-- and couldn't see that obvious error of mine! >_<
Thanks for pointing that out!
I should consider a vacation sooner, than later. :-)
Issue closed! Thanks for helping!
from cppreg.
Related Issues (14)
- Document cppreg (zero) impact on performance and code size. HOT 16
- Fails to compile for PowerPC GCC 4.8.5 HOT 5
- Include link to github page in description HOT 1
- Very minor Performance issue in comparison to CMSIS HOT 4
- Writes to read_write fields which fill the size of the register still create a read HOT 11
- Add grouping registers together, like how CMSIS maps a struct of types to a base address HOT 16
- Revise access policies implementation for better performance. HOT 2
- Update documentation to reflect changes from API revision
- Add a list of requirements/limitations to the documentation HOT 1
- Finalize RegisterPack implementation HOT 3
- Toggle-only access policy support? HOT 5
- Documentation should explain how to access whole register memory
- Copy/paste error in register pack example HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cppreg.