This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP430F5510: Using timer B0 Interrupts

Part Number: MSP430F5510

I have already used Timers A0, A1, & A2, and need yet another so assumed I could use the remaining B0 using the newly added code below:

void TI_UART_RX_TimeoutTimer_Init( void )
{
    // Configure Timer Trigger TB.0 
    TB0CCR0 = 200;

    TB0CCTL0 = CCIE;    // Enable Timer interrupt
    TB0CTL = TBSSEL__ACLK + MC__STOP | TBCLR;   // ACLK, stopped
    TI_UART_RX_TIMEOUT_START();		//start timer
}

#pragma vector=TIMER0_B0_VECTOR
__interrupt void TIMER_B0_ISR(void)
{
	TI_UART_RX_TIMEOUT_STOP();
	TB0R = 0;
}
   
When I build this I assumed any build errors would be triggered by the #pragma line and they do but in an odd way - i get this llogical error referencing the uart int vector #59 which was fine up until now:
image.png
 
I guess my question is how do I declare an ISR for TimerB0 if the logical "#pragma" line I use causes such odd problems?
 
Thanks
 
  • Vector 59 isn't for any UART.

    #define USCI_B0_VECTOR          (56)                     /* 0xFFEE USCI B0 Receive/Transmit */
    #define USCI_A0_VECTOR          (57)                     /* 0xFFF0 USCI A0 Receive/Transmit */
    #define WDT_VECTOR              (58)                     /* 0xFFF2 Watchdog Timer */
    #define TIMER0_B1_VECTOR        (59)                     /* 0xFFF4 Timer0_B7 CC1-6, TB */
    #define TIMER0_B0_VECTOR        (60)                     /* 0xFFF6 Timer0_B7 CC0 */
    #define COMP_B_VECTOR           (61)                     /* 0xFFF8 Comparator B */
    

    Double check that UART code.

  • The uart.c code attempts to use Timer0_B to time the gaps between bytes arriving, but declaring the TIMER0_B0_VECTOR in uart.c causes this cryptic build error. 

    According to your reply TIMER0_B0_VECTOR should be using vector #60 anyway so this makes things more confused!

    FYI this codebase uses TI's USB stack and I wonder if timer0/B is already secretly in use?

  • The error message very clearly states that this is defined in two places. Once in TI_USBKBD_main.obg and again here. Get rid of one of them.

  • I think I have found the problem...I suspect the USB stack is secretly using TIMER_B but as this isn't part of the project so CCS cant do 'find in files' hence myself thinking it was available to use.

    Getting rid of this in the USB stack is risky as I dont understand how this stack works well enough to mess with it! 

    I have hacked a workaround by repurposing an existing TIMER_A to perform the task.

**Attention** This is a public forum