SAMA5D2. Fix DEBUGASSERT triggered in sam_updhs.c #14128
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
When trying CDC/NCM I found that a debug assert was triggered. Initially I commented out the offending DEBUGASSERT and found the code worked just fine.
I don't know why the assert was placed there - perhaps with other uses of this driver there would always be data in the receive queue - so I moved the assignment to the places that actually needed and used the variable.
I have checked that not only CDC/NCM (now) works but also that RNDIS still behaves as before, so it seems like a "safe" fix.
Impact
None expected, but maybe reviewers with USB and DMA knowledge can comment.
Testing
Custom board with SAMA5D27C-D1G, using either CDC/NCM or RNDIS connectivity.