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
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions Src/stm32h5xx_hal_dac.c
Original file line number Diff line number Diff line change
Expand Up @@ -1226,6 +1226,7 @@ HAL_StatusTypeDef HAL_DAC_ConfigChannel(DAC_HandleTypeDef *hdac,
uint32_t tickstart;
uint32_t hclkfreq;
uint32_t connectOnChip;
uint32_t isIcacheEn;

/* Check the DAC peripheral handle and channel configuration struct */
if ((hdac == NULL) || (sConfig == NULL))
Expand Down Expand Up @@ -1347,6 +1348,13 @@ HAL_StatusTypeDef HAL_DAC_ConfigChannel(DAC_HandleTypeDef *hdac,
/* Configure for the selected DAC channel: mode, buffer output & on chip peripheral connect */

#if !defined(TIM8)
/* For flash regions where caching is not practical, ICACHE has to be disable before access them */
isIcacheEn = HAL_ICACHE_IsEnabled();
if (isIcacheEn != 0UL)
{
HAL_ICACHE_Disable();
}

/* Devices STM32H503xx */
/* On STM32H503EB (package WLCSP25) DAC channel 1 connection to GPIO is not available and should not be configured.
Package information is stored at the address PACKAGE_BASE, WLCSP25 correspond to the value 0xF (For more
Expand All @@ -1368,6 +1376,12 @@ HAL_StatusTypeDef HAL_DAC_ConfigChannel(DAC_HandleTypeDef *hdac,
SET_BIT(hdac->ErrorCode, HAL_DAC_ERROR_INVALID_CONFIG);
}
}

/* Re-enable ICACHE if need */
if (isIcacheEn != 0UL)
{
HAL_ICACHE_Enable();
}
#endif /* Devices STM32H503xx */


Expand Down