-
Notifications
You must be signed in to change notification settings - Fork 7.4k
drivers: stm32_temp stm32h5 device must disable icache to access cal #57178
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
Merged
carlescufi
merged 3 commits into
zephyrproject-rtos:main
from
tu-brian:fix_stm32_tempsensor
May 2, 2023
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know it should be enabled, but... shouldn't be restored to original state? (i.e. enabled if was enabled, but disable if it was disabled)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I Get your point, but for this fix I simply ported what was done in 8d5ff8c to here. When searching the codebase for LL_CACHE I can't find any other place where the check before enable is implemented
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok I see. Sorry for the noise. By the way, another point... This is instruction cache, so what does it mean reading 0x8fff814-0x8fff818 addresses? Is it some code fetched from that location? Can you comment about it a little bit more in the commit header? Sorry again if the question is pointless...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@FRASTM Can you please explain why the fix you did in 8d5ff8c solved the bus error on reading the read-only area?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I remember, I got the idea from https://github.com/STMicroelectronics/STM32CubeH5/tree/main/Projects/NUCLEO-H563ZI/Examples_LL/UTILS/UTILS_ReadDeviceInfo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(For future readers)
On STM32H5, the ICACHE block is interposed on C-bus between Cortex-M33 and FLASH. (See RM0492 §2.1.1
Fast C-bus
)The ICACHE determines whether an access is cacheable or not based on the AHB attribute, which depends on MPU configuration. (§8.4.6
Cacheable and non-cacheable traffic
).When a cacheable transaction is received from the Cortex-M33, if the requested data is not present in cache, a cache miss occurs and a cache line refill (128-bit access via burst) is performed (§8.4.7
Cacheable accesses
).However, all accesses to OTP and RO regions must be done with caching disabled (§7.3.2
FLASH signals
); indeed, accesses to this region must be 16 or 32-bit sized, or a bus error is raised (§7.5.9One-time-programmable and read-only memory protections
- table 38OTP/RO access constraints
).By disabling the ICACHE, we ensure the manufacturing (RO) flash region is accessed by 16/32-bit size as it should.