cc26x2_cc13x2: trim device registers on cpu_init.#13816
cc26x2_cc13x2: trim device registers on cpu_init.#13816benpicco merged 10 commits intoRIOT-OS:masterfrom
cpu_init.#13816Conversation
fef6f74 to
313a92b
Compare
benpicco
left a comment
There was a problem hiding this comment.
Looks good at a first glance.
I suppose all those register offset calculations are just like that in the vendor code?
Yes, they're the same |
|
I have some issues, with the code right now, I'm investigating. I'll mark it as WIP. |
cpu_init.cpu_init.
This function is needed to setup the AUX operational mode at startup, also used for managing low-power states. Signed-off-by: Jean Pierre Dudey <[email protected]>
- Fixes padding. - Updates documentation. - Removes documentation longer than 80-chars for the registers values. Signed-off-by: Jean Pierre Dudey <[email protected]>
Signed-off-by: Jean Pierre Dudey <[email protected]>
- Updated documentation - Fixed register bank name - Added missing field Signed-off-by: Jean Pierre Dudey <[email protected]>
- Changed "meh" to "Reserved". - Renamed CTL to CFG to match SDK/TRM name. - Added constants for VIMS and FLASH necessary to trim registers. Signed-off-by: Jean Pierre Dudey <[email protected]>
These are necessary to trim some registers at startup. Signed-off-by: Jean Pierre Dudey <[email protected]>
Add some register values needed to trim registers. Signed-off-by: Jean Pierre Dudey <[email protected]>
- Updated documentation. - Fixed offset of JTAGUSERCODE. - Added necessary register values to perform startup trims. Signed-off-by: Jean Pierre Dudey <[email protected]>
- Added ADI instruction offsets - Added register banks and address bases for masked access (writes). Signed-off-by: Jean Pierre Dudey <[email protected]>
This function trims the necessary registers for the device to operate normally. Signed-off-by: Jean Pierre Dudey <[email protected]>
932b0b8 to
951a99d
Compare
cpu_init.cpu_init.
|
This is ready for review again, works correctly and matches original implementation 1 to 1. Some registers were fixed in the process (probably the reason of the brick I got previously) and all of the new are correctly defined (and on the correct address). |
benpicco
left a comment
There was a problem hiding this comment.
Looks good to me.
As far as I understand, those functions are not used yet but follow-up PRs make use of them?
Yes you're right, in this PR only Thanks for the review! |
Contribution description
This is a very stripped-down port from the TI SDK of the
SetupTrimDevicefunction which must be called on CPU initialization.It sets configurations from the CCFG (Customer Configuration Area), most
of the code is already implemented in the ROM and we use that API.
More importantly, these ROM functions aren't present on
cc26x0devicesand must be implemented manually on these to just implement
SetupTrimDevice, so I opted out on writing a more generalimplementation as the code for that is quite big and the review effort
for that kind of code is simply too much (more than writing it IMHO), it
also happens that I don't have one of these to test.
This function is important because it allows us to change the
SCLK_HFclock source to the external HF XOSC, without this, the MCU simply halts
when performing the switch due to a bad state on the MCU registers.
Also this function sets some
FLASHregisters to a working state, so wecan write in the future a MTD driver for it.
There's room for improvement in this port, mainly refactorings, but as
documentation is scarse I tried to do a one-to-one port without changing
the logic too much, even some variables don't make sense, or some code
blocks. Unbelievably, it's much worse on the TI SDK, of course we have
the opportunity to change that on RIOT 😉.
Feel free to criticize the code, as I personally think that can be improved,
but I need some opinions though.
Testing procedure
Issues/PRs references
Needed for #13295.
Fixes one item on #13635.