Skip to content
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

Disable ICACHE before access flash regions where caching is not pract… #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

xu-yingjing
Copy link

Disable ICACHE before access flash regions where caching is not practical.

@TOUNSTM TOUNSTM self-assigned this Dec 20, 2023
@ALABSTM ALABSTM added enhancement New feature or request hal HAL-LL driver-related issue or pull-request. labels Jan 3, 2024
@TOUNSTM TOUNSTM assigned RJMSTM and unassigned TOUNSTM May 27, 2024
@RJMSTM
Copy link
Contributor

RJMSTM commented Jun 21, 2024

Hello,

Could you provide additional information on why it's necessary to disable the instruction cache (ICACHE) before accessing flash memory regions where caching would be ineffective? What specific issue are you encountering?

Regards,

@RJMSTM RJMSTM added the needs clarification Needs clarification from user label Jun 21, 2024
@xu-yingjing
Copy link
Author

Hello,
The following code is in the function HAL_DAC_ConfigChannel() of the file stm32h5xx_hal_dac.c:

const __IO uint16_t *tmp_package = (uint16_t *)PACKAGE_BASE;

The macro definition PACKAGE_BASE is defined in the stm32h562xx.h file as follows:

#define PACKAGE_BASE            (0x08FFF80EUL) /*!< Package data register base address     */

The address 0x08FFF80E is located at the flash regions where caching is not practical (OTP, RO, data area).
And according to section 7.3.2 of the STM32H5 reference manual(RM0481 Rev 1):

By default, all the AHB memory range is cacheable. For regions where caching is not practical (OTP, RO, data area), MPU must be used to disable local cacheability.

So, when accessing the value at address PACKAGE_BASE, is need to ensure that ICACHE is disabled?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request hal HAL-LL driver-related issue or pull-request. needs clarification Needs clarification from user
Projects
Development

Successfully merging this pull request may close these issues.

4 participants