From bc6dd3857f76e7b21ecde8f363bf0a3f227df3b5 Mon Sep 17 00:00:00 2001 From: David Crocker Date: Wed, 21 Apr 2021 20:57:11 +0100 Subject: [PATCH] Fixed issue with low PWM frequencies causing excessive CPU utilisation --- src/SAME5x_C21/AnalogOut.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/SAME5x_C21/AnalogOut.cpp b/src/SAME5x_C21/AnalogOut.cpp index 448a363e..c8e5e721 100644 --- a/src/SAME5x_C21/AnalogOut.cpp +++ b/src/SAME5x_C21/AnalogOut.cpp @@ -129,8 +129,9 @@ namespace AnalogOut else { // Just update the compare register + // Don't call hri_tccount16_write_CCBUF_CCBUF_bf here! It loops for up to one TC period waiting for sync. const uint16_t cc = ConvertRange(val, tcTop[device]); - hri_tccount16_write_CCBUF_CCBUF_bf(tcdev, output, cc); + tcdev->COUNT16.CCBUF[output].bit.CCBUF = cc; } SetPinFunction(pin, peri);