I found that if I made the change highlighted below (suggested to me by an ATMEL factory rep) to my TC1 init routine, then TC1's RB compare interrupt started working. I've been struggling with trying to understand how this change should've been able to have any effect on this problem. As best as I can tell from reading the datasheet, the output of the MUX affected by the below change has no electrical or logical connection to the RB compare interrupt. To further muddy the waters, my init code sets up this MUX so that it's output is not routed anywhere.
Code:
TC1_CMR = TCn_CMR_WM_BSWTRG(TCn_CMR_WM_EFFECT_NONE)
| TCn_CMR_WM_BEEVT(TCn_CMR_WM_EFFECT_NONE)
| TCn_CMR_WM_BCPC(TCn_CMR_WM_EFFECT_NONE)
| TCn_CMR_WM_BCPB(TCn_CMR_WM_EFFECT_NONE)
| TCn_CMR_WM_ASWTRG(TCn_CMR_WM_EFFECT_NONE)
| TCn_CMR_WM_AEEVT(TCn_CMR_WM_EFFECT_NONE)
| TCn_CMR_WM_ACPC(TCn_CMR_WM_EFFECT_NONE)
| TCn_CMR_WM_ACPA(TCn_CMR_WM_EFFECT_NONE)
| TCn_CMR_WM_MODE_WAVEFORM
| TCn_CMR_WM_WAVESEL_UP_WITH_AUTO_TRIGGER
| TCn_CMR_WM_EEVT_XC0 // <--- suggested change by ATMEL
| TCn_CMR_WM_ENETRG(0)
| TCn_CMR_WM_EEVTEDG_NONE
| TCn_CMR_WM_CPCDIS(0)
| TCn_CMR_WM_CPCSTOP(0)
| TCn_CMR_WM_BURST_GATE_NONE
| TCn_CMR_WM_CLKI(0)
| TCn_CMR_WM_TCCLKS_TC3
;
In case you're interested, here's the .H code associated with the above code snippet.
Code:
//========================================================================================
// BIT DEFINITIONS FOR AT91SAM7 TC'n' CHANNEL MODE REGISTERS (TCn_CMR_WM) IN WAVEFORM MODE
//========================================================================================
#define TCn_CMR_WM_EFFECT_NONE ((unsigned int) 0) // values for below 'effect' fields
#define TCn_CMR_WM_EFFECT_SET ((unsigned int) 1)
#define TCn_CMR_WM_EFFECT_CLEAR ((unsigned int) 2)
#define TCn_CMR_WM_EFFECT_TOGGLE ((unsigned int) 3)
#define TCn_CMR_WM_BSWTRG(x) ((unsigned int)(x) << 30) // software trigger effect on TIOB field
#define TCn_CMR_WM_BEEVT(x) ((unsigned int)(x) << 28) // external event effect on TIOB field
#define TCn_CMR_WM_BCPC(x) ((unsigned int)(x) << 26) // RC compare effect on TIOB field
#define TCn_CMR_WM_BCPB(x) ((unsigned int)(x) << 24) // RB compare effect on TIOB field
#define TCn_CMR_WM_ASWTRG(x) ((unsigned int)(x) << 22) // software trigger effect on TIOA field
#define TCn_CMR_WM_AEEVT(x) ((unsigned int)(x) << 20) // external event effect on TIOA field
#define TCn_CMR_WM_ACPC(x) ((unsigned int)(x) << 18) // RC compare effect on TIOA field
#define TCn_CMR_WM_ACPA(x) ((unsigned int)(x) << 16) // RA compare effect on TIOA field
#define TCn_CMR_WM_MODE_WAVEFORM ((unsigned int)(1) << 15) // enables waveform mode
#define TCn_CMR_WM_WAVESEL_UP_WITHOUT_AUTO_TRIGGER ((unsigned int) 0 << 13) // WAVESEL field
#define TCn_CMR_WM_WAVESEL_UPDOWN_WITHOUT_AUTO_TRIGGER ((unsigned int) 1 << 13)
#define TCn_CMR_WM_WAVESEL_UP_WITH_AUTO_TRIGGER ((unsigned int) 2 << 13)
#define TCn_CMR_WM_WAVESEL_UPDOWN_WITH_AUTO_TRIGGER ((unsigned int) 3 << 13)
#define TCn_CMR_WM_ENETRG(x) ((unsigned int)(x) << 12) // ENETRG field
#define TCn_CMR_WM_EEVT_TIOB ((unsigned int) 0 << 10) // EEVT field
#define TCn_CMR_WM_EEVT_XC0 ((unsigned int) 1 << 10)
#define TCn_CMR_WM_EEVT_XC1 ((unsigned int) 2 << 10)
#define TCn_CMR_WM_EEVT_XC2 ((unsigned int) 3 << 10)
#define TCn_CMR_WM_EEVTEDG_NONE ((unsigned int) 0 << 8) // EEVTEDG field
#define TCn_CMR_WM_EEVTEDG_RISING ((unsigned int) 1 << 8)
#define TCn_CMR_WM_EEVTEDG_FALLING ((unsigned int) 2 << 8)
#define TCn_CMR_WM_EEVTEDG_EACH ((unsigned int) 3 << 8)
#define TCn_CMR_WM_CPCDIS(x) ((unsigned int)(x) << 7) // counter clock disable with RC compare field
#define TCn_CMR_WM_CPCSTOP(x) ((unsigned int)(x) << 6) // counter clock stopped with RC compare field
#define TCn_CMR_WM_BURST_GATE_NONE ((unsigned int) 0 << 4) // BURST field
#define TCn_CMR_WM_BURST_GATE_XC0 ((unsigned int) 1 << 4)
#define TCn_CMR_WM_BURST_GATE_XC1 ((unsigned int) 2 << 4)
#define TCn_CMR_WM_BURST_GATE_XC2 ((unsigned int) 3 << 4)
#define TCn_CMR_WM_CLKI(x) ((unsigned int)(x) << 3) // CLKI field
#define TCn_CMR_WM_TCCLKS_TC1 ((unsigned int) 0) // TC1 = MCK / 2
#define TCn_CMR_WM_TCCLKS_TC2 ((unsigned int) 1) // TC2 = MCK / 8
#define TCn_CMR_WM_TCCLKS_TC3 ((unsigned int) 2) // TC3 = MCK / 32
#define TCn_CMR_WM_TCCLKS_TC4 ((unsigned int) 3) // TC4 = MCK / 128
#define TCn_CMR_WM_TCCLKS_TC5 ((unsigned int) 4) // TC5 = MCK / 1024
#define TCn_CMR_WM_TCCLKS_XC0 ((unsigned int) 5)
#define TCn_CMR_WM_TCCLKS_XC1 ((unsigned int) 6)
#define TCn_CMR_WM_TCCLKS_XC2 ((unsigned int) 7)
Can anyone point me to something in the datasheet that shows how this change was required in order to enable the RB compare interrupt? My project is not using the TIOA or TIOB outputs of this TC, and there's no signal applied to XC0 on my board.
Puzzled...
Seadog.