Hello,
I did not find the way to report the bug, try to confirm here.
I created a breathing LED lighting program by TCD & RTC together.
I found 2 issues not reasonable.
1) Must define the CMPBCLR even if I just used the CMPA;
In ONE RAMP mode, to set CMPASET & CMPACLR is enough if just using CMPA.
But, refer to the code below,it will not work without "TCD0.CMPBCLR = tcd_CMPBCLR; " for "ebmRed" mode.
void ledBreathingBegin(EbreathMode bm){ breathMode = bm; ledBreathingStop(); if(breathMode==ebmBlue || breathMode == ebmBlueAndRed){ cmpbsetInc = false; cmpbset = 0; TCD0.CMPBSET = cmpValue[cmpbset]; TCD0.CMPBCLR = tcd_CMPBCLR; } if(breathMode==ebmRed || breathMode == ebmBlueAndRed){ cmpasetInc = false; cmpaset = 0; TCD0.CMPBCLR = tcd_CMPBCLR; //???ebmRed will not work without this sentence,why??? TCD0.CMPASET = cmpValue[cmpaset]; TCD0.CMPACLR = tcd_CMPBCLR; } while ((TCD0.STATUS & TCD_CMDRDY_bm) == 0); TCD0.CTRLE |= TCD_SYNC_bm; //sync register values TCD_begin(); RTC_INT_ENABLE; }
2) Can't stop output to pin even if you disable the TCD.
I have to set the CMPxSET to CMPxCLR to stop output before disable TCD.
void ledBreathingStop(void){ RTC_INT_DISABLE; TCD0.CMPBSET = tcd_CMPBCLR; //try to switch off led, can't switch off by OUTCLR command TCD0.CMPASET = tcd_CMPBCLR; while ((TCD0.STATUS & TCD_CMDRDY_bm) == 0); TCD0.CTRLE |= TCD_SYNC_bm; //must send CMD through CTRLE register,otherwise TCD don't sync TCD_stop(); }
I think it is some kind of bug.