the timers mentioned above in topic title are initialized to be used as PWM ports and are running internally as configured by Arduino IDE core code. I am not using these ports as PWM pins using the PWM APIs offered by the Arduino IDE core in my application.
the Other Arduino IDE core timing functions mainly use TIMERA and TCB3.
So in my application, i intend to use TCB0,1,2 timers for my application differently. Clk source is CLKPER/2 ~ 8Mhz
So when i reinitialize the peripherals as i want them and enable the timers via the CTRLA register for TCB0,1,2 the application crashes....Any help is gr8ly appreciated. here is the snippet of code as per my needs to re-initialize TCB0,1 and re-enable it..
PORTMUX.TCBROUTEA = 0x01 ; // TCB0 o/p routed to PF4/D6 - Arduino port
TCB0.CTRLA = 0x02 ; // CLKPER/2 Chosen - 8Mhz, but TCB disabled still
//TCB0.CTRLA = 0x00 ; // CLKPER Chosen - 16Mhz, but TCB disabled still
TCB0.CTRLB = 0x07 ; // 8 bit PWM mode chosen for TCB0 timer
TCB0.CCMPL = TOPPWMVALUE ;
TCB0.CCMPH = DUTYVALUE ;
TCB0.INTCTRL = 0x01 ; // interrupt enabled in 8bit PWM mode
//TCB0.CTRLA = 0x03 ; // TCB0 enabled - 8Mhz mode
//TCB0.CTRLA = 0x01 ; // TCB0 enabled - 16Mhz mode
// general-ISR timer generation only - No waveform
//TIMER TCB1 SET UP
//timer TCB0 -- interrupt @xxuS
TCB1.CTRLA = 0x02 ; // CLKPER/2 Chosen - 8Mhz, but TCB disabled still
//TCB1.CTRLA = 0x00 ; // CLKPER Chosen - 16Mhz, but TCB disabled still
TCB1.CTRLB = 0x0 ;
// default interuptonly mode @ reset TCB1 timer
// fix based off CLKPER/2 = isr FREQUENCY 8Mhz/65536(0xFFFF) = 8.192mS interrupt
TCB1.CCMP = (unsigned int)TOP16BITVALUE ;
TCB1.INTCTRL = 0x01 ; // interrupt enabled
//TCB1.CTRLA = 0x03 ; // TCB0 enabled - 8Mhz mode
//TCB1.CTRLA = 0x01 ; // TCB0 enabled - 16Mhz mode
TCB1.CTRLA |= 0x01 ;
TCB0.CTRLA |= 0x01 ;
1 post - 1 participant