So I was trying this code I got right off a book but changing the pin where I should have the PWM signal output... but it is not working... any guesses why?... PD: I can't do debugging because I have a strange error on executing the ELF file. Wrote this code on and did the programming on atmel studio 7 with the atmel - ice.
#include "sam.h" unsigned char* ARRAY_PORT_PINCFG0 = (unsigned char*)®_PORT_PINCFG0; unsigned char* ARRAY_PORT_PMUX0 = (unsigned char*)®_PORT_PMUX0; int main(void) { REG_GCLK_CLKCTRL = 0x401A; //TCC0 para PWM en GCLK0 REG_PM_APBCMASK |= 0x00000100; //Enable TCC0, es la funcion F para el pin PA17 REG_TCC0_CTRLA = 1; //Reset al registro while(REG_TCC0_CTRLA & 1){} //Esperar hasta sincronizar REG_TCC0_WAVE = 2; // Modo PWM normal REG_TCC0_PER = 16666-1; REG_TCC0_CC0 = 5555-1; REG_TCC0_CTRLA |= 2; ARRAY_PORT_PINCFG0[17] |= 1; //Activa el multiplexor a perifericos ARRAY_PORT_PMUX0[8] = (0x5<<4); while (1) { } } |