TCC0 output problem

Hi all.

I have a strange problem on a zero clone that I use for test.
I need 4 PWM output @ 50Hz to drive LEDS. I want to use TCC0 [ 0 to 3 ] for that.

For now, I use this part of code to initialize PWM:

void Init_PWM () {
	REG_GCLK_GENDIV = GCLK_GENDIV_DIV ( 0x40 ) |	// Division de l'horloge par 64 ( 48MHz / 64 = 750kHz ).
			  GCLK_GENDIV_ID ( 0x4 );
	while ( GCLK -> STATUS.bit.SYNCBUSY );

	REG_GCLK_GENCTRL = GCLK_GENCTRL_IDC |
			   GCLK_GENCTRL_GENEN |
			   GCLK_GENCTRL_SRC_DFLL48M |
			   GCLK_GENCTRL_ID ( 0x4 );
	while ( GCLK -> STATUS.bit.SYNCBUSY );

	REG_GCLK_CLKCTRL = GCLK_CLKCTRL_CLKEN |
			   GCLK_CLKCTRL_GEN_GCLK4 |
			   GCLK_CLKCTRL_ID_TCC0_TCC1;
	while ( GCLK -> STATUS.bit.SYNCBUSY );

	REG_TCC0_WAVE |= TCC_WAVE_WAVEGEN_NPWM;
	while ( TCC0 -> SYNCBUSY.bit.WAVE );

	REG_TCC0_PER = 15000;	// Configuration de la période: 750kHz / 15000 = 50Hz !
	while ( TCC0 -> SYNCBUSY.bit.PER );

	REG_TCC0_CC0 = 0;
	while ( TCC0 -> SYNCBUSY.bit.CC0 );
	REG_TCC0_CC1 = 0;
	while ( TCC0 -> SYNCBUSY.bit.CC1 );
	REG_TCC0_CC2 = 0;
	while ( TCC0 -> SYNCBUSY.bit.CC2 );
	REG_TCC0_CC3 = 0;
	while ( TCC0 -> SYNCBUSY.bit.CC3 );

	REG_TCC0_CTRLA |= TCC_CTRLA_PRESCALER_DIV1 |
			  TCC_CTRLA_RUNSTDBY |
			  TCC_CTRLA_ENABLE;
	while ( TCC0 -> SYNCBUSY.bit.ENABLE );
}

and only this to set the output:

PORT -> Group [ g_APinDescription [ LIGHTS ].ulPort ].PINCFG [ g_APinDescription [ LIGHTS ].ulPin ].bit.PMUXEN = 1;
PORT -> Group [ g_APinDescription [ LIGHTS ].ulPort ].PMUX [ g_APinDescription [ LIGHTS ].ulPin >> 1 ].reg = PORT_PMUX_PMUXE_E;

Pin LIGHT is pin D4 ( Port A.08, TCC0[0] ), but nothing on output.
If I use pin A3 ( Port A.04, also TCC0[0] ), the sketch run fine ( sometimes a visual glitch ).
Quickly test with TCC0[0 to 3 ] on pins D4, D3, D10 and D12 ( rewrite sketch to match ), and nothing run.

I dont understand why PWM run on analog pin, and not on digital pin.

do you set the right PORT_PMUX_PMUXE_E, PORT_PMUX_PMUXO_E, PORT_PMUX_PMUXE_F, PORT_PMUX_PMUXO_F for pins?

E is even, O is odd (SAMD pin)

Normaly it's OK.
Fonction E, and if I traduct correctly, A.08 is Even... So PORT_PMUX_PMUXE_E

I have

PORT->Group[pinDesc.ulPort].PINCFG[pinDesc.ulPin].bit.PMUXEN = 1;
PORT->Group[pinDesc.ulPort].PMUX[pinDesc.ulPin >> 1].reg |= PORT_PMUX_PMUXE_F; // pin 6

with |=

Yes, but I want to use pin 4.
Pin 6 is TCC0/WO[6] on function F, port A.20 on my SAMD21.
Pin 4 is TCC0/WO[0] on function E, port A.08.

I also try the |=,
try PORT_PMUX_PMUXE_E | PORT_PMUX_PMUXO_E,
try to modify the variant.cpp to disable extra functions { PORTA, 8, PIO_DIGITAL, (PIN_ATTR_DIGITAL), No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NMI }, // TCC0/WO[0]
But no output.
TCC is correctly configured, but I think I have a trouble with the multiplexing.

OK, it's run...
Chinese clone with chinese shematics...
Sold as M0, and on shematics seems to have the zero pinout. I have changed the bootloader, but the schematics was wrong. It's a M0 !
TCC0[0] is on pin 2...

Sorry !

Black_Wolf:
OK, it's run...
Chinese clone with chinese shematics...
Sold as M0, and on shematics seems to have the zero pinout. I have changed the bootloader, but the schematics was wrong. It's a M0 !
TCC0[0] is on pin 2...

Sorry !

that what be my next bet

M0 TCC0 pins 2,3,6,7 TCC1 pins 8,9
Zero TCC0 pins 4,3,6,7,12 TCC1 8,9
MKR (Zero) TCC0 pins A3,A4,6,7 TCC1 2,3