@@ -131,7 +131,9 @@ bool PPAAccelerator::scaleRotateImage(uint16_t* srcPixels, int16_t srcWidth, int
131131 memcpy (ppa_src_buffer, srcPixels, srcSize);
132132
133133 // Ensure cache coherency for DMA operations
134- esp_cache_msync (ppa_src_buffer, srcSize, ESP_CACHE_MSYNC_FLAG_DIR_C2M );
134+ // Size must be aligned to cache line size (64 bytes)
135+ size_t srcSizeAligned = (srcSize + 63 ) & ~63 ;
136+ esp_cache_msync (ppa_src_buffer, srcSizeAligned, ESP_CACHE_MSYNC_FLAG_DIR_C2M );
135137
136138 // Configure PPA scaling and rotation operation
137139 ppa_srm_oper_config_t srm_oper_config = {};
@@ -184,7 +186,9 @@ bool PPAAccelerator::scaleRotateImage(uint16_t* srcPixels, int16_t srcWidth, int
184186 }
185187
186188 // Ensure cache coherency for reading results
187- esp_cache_msync (ppa_dst_buffer, dstSize, ESP_CACHE_MSYNC_FLAG_DIR_M2C );
189+ // Size must be aligned to cache line size (64 bytes)
190+ size_t dstSizeAligned = (dstSize + 63 ) & ~63 ;
191+ esp_cache_msync (ppa_dst_buffer, dstSizeAligned, ESP_CACHE_MSYNC_FLAG_DIR_M2C );
188192
189193 // Copy result to destination buffer
190194 memcpy (dstPixels, ppa_dst_buffer, dstSize);
0 commit comments