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.

MSP-EXP430FR2433: Reset Timer without clearing initialization setting via driverlib

Part Number: MSP-EXP430FR2433
Other Parts Discussed in Thread: MSP430FR2433

Hello,

I have an application which I am waiting for character string from eUSCI_A1 in UART mode.

In my case, waiting for /r or /r/n is not practical to determine whether all string is received; so I decided to use timer for this very purpose.

My intention is to initialize Timer1_A3 in up mode, start the Timer1_A3 when I receive the first char via eUSCI_A1 and restart the timer (counting from zero) each new char is received. I will set CCR to a value which will let the timer overflow when about 25ms passed and I will set a flag in CCR overflow interrupt indicating the string has been received fully.

Basically I want to measure the time between two receive events and if it reaches to 25ms, this will mean receive is completed.

The problem is, I did not see an option to restart timer from zero explicitly. TACLR is not a very good option since it also clears theinitializon of other Timer parameters like count direction, prescaler etc.

Any ideas?

P. S. Any advice through driverlib is appreciated. I don't like working with register names very much.

Thanks in advance.

  • The function Timer_A_clear() appears to do this. It uses "|=" so it doesn't clear the other bits in TAxCTL.

    void Timer_A_clear (uint16_t baseAddress)
    {
        HWREG16(baseAddress + OFS_TAxCTL) |= TACLR;
    }

  • Actually I don't think so, as per document TACLR itself clears all configuration.

    From TAxCTL register definition from MSP430FR2433 User's Guide Section 13.3.1

    Timer_A clear. Setting this bit resets TAxR, the timer clock divider logic (the divider setting remains unchanged), and the count direction. The TACLR bit is automatically reset and always reads as zero.

  • I'm not sure which part of this description you're concerned about.

    "|=" sets the indicated bit(s) without altering the others. TACLR clears by itself, so you don't have to.

    TACLR resets the prescaler counter (internal), but not the prescaler setting (ID). This is is part of what it means to set the timer to 0.

    It also clears the count direction, which is only relevant to Up/Down mode, and again is part of what it means to set the timer to 0.

  • Oh. My. God!

    Thank you very much for helping me understand my huge misinterpretation of the statement. The tricky point was "prescaler counter", I misinterpret it as "prescaler setting" itself.

    Thank you again.

**Attention** This is a public forum