2023-07-04 11:30 PM
I am trying to use the DAC feature of Nucleo-H503.
Pinned the cube MX and wrote the code.
However, the program does not work after entering the MX_DAC1_Init() function, created by Cube MX.
I checked in debug mode and found an error in the syntax below.
///////////////////////////////////////////////////////////////////////////////////////
HAL_StatusTypeDef HAL_DAC_ConfigChannel(DAC_HandleTypeDef *hdac,
const DAC_ChannelConfTypeDef *sConfig, uint32_t Channel)
{
....
#if !defined(TIM8)
/* 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
information, please refer to the Reference Manual) */
const __IO uint16_t *tmp_package = (uint16_t *)PACKAGE_BASE;
if ((*(tmp_package) & 0x1FUL) == 0x0FUL) /// ERROR ///
{
if ((Channel == DAC_CHANNEL_1)
&& ((sConfig->DAC_ConnectOnChipPeripheral == DAC_CHIPCONNECT_EXTERNAL)
|| (sConfig->DAC_ConnectOnChipPeripheral == DAC_CHIPCONNECT_BOTH)))
{
/* Update return status */
status = HAL_ERROR;
/* Change the DAC state */
hdac->State = HAL_DAC_STATE_ERROR;
/* Update error code */
SET_BIT(hdac->ErrorCode, HAL_DAC_ERROR_INVALID_CONFIG);
}
}
#endif /* Devices STM32H503xx */
///////////////////////////////////////////////////////////////////////////////////////
When the program enters the #if syntax, it is unable to exit the infinite loop after going from "if (*(tmp_package) & 0x1FUL) == 0x0FUL)" to "HardFault_Handler()"
In my project's MCU Selector, I chose Board Selector > NUCLEO-H503RB. On the other hand, STM32H503RBTx is selected instead of Board in ST example project.
Is the DAC feature not available on the NUCLEO-H503RB Board?
Solved! Go to Solution.
2023-07-05 12:19 AM
Hello,
There is DAC in this MCU. The issue you are observing is related to the ICache activity on read-only part of the memory (package information). To solve the issue you can either disable ICache or disable cacheability of this region. Please have a look at reference manual RM0492, point 7.3.2, page 118:
“By default, all the AHB memory range is cacheable. For regions where caching is not practical (OTP, RO), MPU has to be used to disable local cacheability.”.
2023-07-05 12:19 AM
Hello,
There is DAC in this MCU. The issue you are observing is related to the ICache activity on read-only part of the memory (package information). To solve the issue you can either disable ICache or disable cacheability of this region. Please have a look at reference manual RM0492, point 7.3.2, page 118:
“By default, all the AHB memory range is cacheable. For regions where caching is not practical (OTP, RO), MPU has to be used to disable local cacheability.”.
We’re moving the ST Community to a new platform to give you a better and more reliable community experience.