Fully implement DSU features (Including for D21/D11)#998
Fully implement DSU features (Including for D21/D11)#998rnd-ash wants to merge 17 commits intoatsamd-rs:masterfrom
Conversation
|
I suppose this supercedes #925 ? |
|
I guess so.....but, I completely forgot about @kyp44 PR for the DSU. I can update mine so we have clock V2 for D5x as well |
|
@sajattack I updated my code based on the PR @kyp44 did, so we now have Clock V2 for the d5x implementation of the DSU |
|
Alright, got everything to build OK - Had to migrate 1 Example for featherm4 to clock V2 API |
jbeaurivage
left a comment
There was a problem hiding this comment.
This isn't a super in-depth review yet, but I had some observations that I wanted to write down as I glanced over the PR
| pub fn is_completed(&self) -> bool { | ||
| self.dsu.is_done() | ||
| } |
There was a problem hiding this comment.
Suggestion: use nb's primitives instead, so that users may use nb::block!. This way the blocking memory_test method can also use it and avoid code duplication
There was a problem hiding this comment.
Not 100% familiar with nb's API, but I think this is now implemented correctly using it
| /// Releases the DSU peripheral | ||
| #[hal_cfg(any("dsu-d21", "dsu-d11"))] | ||
| pub fn free(self) -> pac::Dsu { | ||
| self.dsu | ||
| } | ||
|
|
||
| /// Releases the DSU peripheral | ||
| #[hal_cfg(any("dsu-d5x"))] | ||
| pub fn free(self) -> (pac::Dsu, DsuAhbClk, DsuApbClk) { | ||
| (self.dsu, self.ahb, self.apb) | ||
| } |
There was a problem hiding this comment.
Based on the conclusions we come to in #1000, do we need to swreset and/or stop mclk? Same for new is a swreset necessary?
There was a problem hiding this comment.
Now this is a good question. I think we should leave the peripheral however it was by default. On our devices, the DSU is enabled by default (MCLK), so I think we should leave it untouched.
Also, since the DSU touches the debugger, I think its best to NOT modify it when we free the DSU Peripheral, in case this harms debug sessions.
|
If this is merged, will it also close #925? |
See here #998 (comment) |
Summary
This PR adds the DSU Peripheral implementation to the D21 and D11 series of chips, and adds the following methods for all chip families:
is_debugger_presentfunction to check the presence of a debuggermemory_testfunction to run the MBIST test (Marked as unsafe due to it overwriting RAM)Background memory testing
Using the
PollingMemoryTeststructure, andDsu::polling_memory_test, its now possible to run a memory test in the background when the CPU is asleep, and abort the memory test, if it isn't completed yet, when the CPU wakes up.I've added an example to the
PollingMemoryTestdocumentation on how this can be used to check RAM in the background on an RTIC application, in the same way this is done on ECUs.Additional notes
The CRC32 algorithm has also been updated for the D21 specifically for an errata note when calculating in RAM space on silicon revisions A-D