stm32/dac: Fix DAC write for MCUs that have D-Cache.

To prevent wrong DAC output, clean D-cache before starting DMA.

For more details, please refer to the following document:
https://www.st.com/resource/en/application_note/DM00272913.pdf

Signed-off-by: Yuuki NAGAO <wf.yn386@gmail.com>
This commit is contained in:
Yuuki NAGAO 2025-07-27 22:03:42 +09:00 committed by Damien George
parent 152a0782e6
commit 365329cd54

View file

@ -485,6 +485,9 @@ mp_obj_t pyb_dac_write_timed(size_t n_args, const mp_obj_t *pos_args, mp_map_t *
#endif #endif
} }
// To prevent invalid dac output, clean D-cache before starting dma.
MP_HAL_CLEAN_DCACHE(bufinfo.buf, bufinfo.len);
uint32_t align; uint32_t align;
if (self->bits == 8) { if (self->bits == 8) {
align = DAC_ALIGN_8B_R; align = DAC_ALIGN_8B_R;