EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

[msp430] problems setting 8MHz CPU frequency

Started by Oskar April 21, 2008
Hi,

I'm trying to clock the CPU (MSP430F1611) to 8,000,000 Hz and I've run
into
some problems. Making the CPU to actually run at 8MHz was easy enough:

  DCOCTL = DCO0 + DCO1 + DCO2; /* 0xE0 */
  BCSCTL1 = XT2OFF + RSEL0 + RSEL1 + RSEL2; /* 0x87 */

However, the UART1 stopped working. What I've got so far is:

  void uart1_init( unsigned int ubr )
  {
    /* RS232 */
    P3DIR &= ~0x80;         /* Select P37 for input (UART1RX) */
    P3DIR |=  0x40;         /* Select P36 for output (UART1TX) */
    P3SEL |=  0xC0;         /* Select P36,P37 for UART1{TX,RX} */

    UCTL1 = SWRST | CHAR;   /* 8-bit character, UART mode */

    U1RCTL &= ~URXEIE;      /* even erroneous characters trigger
interrupts */

    UTCTL1 = SSEL1;         /* UCLK = MCLK */

    /* ubr is 8000000/baud */
    UBR01 = ubr;        /* assuming 19200 bps: UBR01 = 0xA0; */
    UBR11 = ubr >> 8;   /* assuming 19200 bps: UBR11 = 0x01; */

    /* UMCTL1 calculated using http://mspgcc.sourceforge.net/baudrate.html
*/
    UMCTL = 0x5B; /* assuming 19200 bps */

    ME2 &= ~USPIE1;           /* USART1 SPI module disable */
    ME2 |= ( UTXE1 | URXE1 ); /* Enable USART1 TXD/RXD */

    UCTL1 &= ~SWRST;

    IE2 |= URXIE1;            /* Enable USART1 RX interrupt  */
  }

What am I missing here? Any help appreciated!

--
Oskar
On Apr 21, 1:10 pm, Oskar <oskar.nordqu...@gmail.com> wrote:

> I'm trying to clock the CPU (MSP430F1611) to 8,000,000 Hz and I've run > into > some problems. Making the CPU to actually run at 8MHz was easy enough:
> However, the UART1 stopped working.
Speaking generally rather than about your specific chip: Try writing a loop to send a character on the serial endlessly, and then looking at the serial output timing on a scope. You could also look at the timing values that worked at the old clock rate and proportionally correct for the new one, but someones the dividers get interesting (programmed value + 1 for example) such that it won't quite be a linear ratio. There's always reading the manual, but sometimes the value of the other approaches is catching misunderstandings of what the manual was trying to say.
On 21 Apr, 18:21, cs_post...@hotmail.com wrote:
> On Apr 21, 1:10 pm, Oskar <oskar.nordqu...@gmail.com> wrote: > > > I'm trying to clock the CPU (MSP430F1611) to 8,000,000 Hz and I've run > > into > > some problems. Making the CPU to actually run at 8MHz was easy enough: > > However, the UART1 stopped working. > > Speaking generally rather than about your specific chip: > > Try writing a loop to send a character on the serial endlessly, and > then looking at the serial output timing on a scope. > > You could also look at the timing values that worked at the old clock > rate and proportionally correct for the new one, but someones the > dividers get interesting (programmed value + 1 for example) such that > it won't quite be a linear ratio. > > There's always reading the manual, but sometimes the value of the > other approaches is catching misunderstandings of what the manual was > trying to say.
'U' is a good value to send (alternating 1s and 0s). Leon
Un bel giorno Oskar digit&#4294967295;:

> some problems. Making the CPU to actually run at 8MHz was easy enough: > > DCOCTL = DCO0 + DCO1 + DCO2; /* 0xE0 */ > BCSCTL1 = XT2OFF + RSEL0 + RSEL1 + RSEL2; /* 0x87 */ > > However, the UART1 stopped working. What I've got so far is:
The safe operating frequency of the MSP430 depends on the supply voltage; in order to run it safely at 8 MHz you need to apply the maximum specified voltage, i.e. 3.6 V. Maybe you are using a lower supply voltage? -- emboliaschizoide.splinder.com
On Apr 21, 7:21 pm, cs_post...@hotmail.com wrote:
> On Apr 21, 1:10 pm, Oskar <oskar.nordqu...@gmail.com> wrote: > > > I'm trying to clock the CPU (MSP430F1611) to 8,000,000 Hz and I've run > > into > > some problems. Making the CPU to actually run at 8MHz was easy enough: > > However, the UART1 stopped working. > > Speaking generally rather than about your specific chip: > > Try writing a loop to send a character on the serial endlessly, and > then looking at the serial output timing on a scope. > > You could also look at the timing values that worked at the old clock > rate and proportionally correct for the new one, but someones the > dividers get interesting (programmed value + 1 for example) such that > it won't quite be a linear ratio. > > There's always reading the manual, but sometimes the value of the > other approaches is catching misunderstandings of what the manual was > trying to say.
I don't have a scope available at the moment, I will have to match a set of characters and try different register settings using some automation technique. Now, what registers are actually frequency dependant besides UBR01, UBR11, and UMCTL1?
On Apr 22, 8:53 am, Oskar <oskar.nordqu...@gmail.com> wrote:

> > Try writing a loop to send a character on the serial endlessly, and > > then looking at the serial output timing on a scope.
> I don't have a scope available at the moment
Too bad 19200 Hz is probably beyond the range of hearing, otherwise I'd suggest audibly comparing the bit clock (use the 'U' suggestion) to a PC endlessly sending the same thing. Maybe wire up a divider IC to knock down the frequency? (Yeah, I realize this may not be the best course of action... but it would be FUN!)
On Apr 22, 6:51=A0pm, cs_post...@hotmail.com wrote:
> On Apr 22, 8:53 am, Oskar <oskar.nordqu...@gmail.com> wrote: > > > > Try writing a loop to send a character on the serial endlessly, and > > > then looking at the serial output timing on a scope. > > I don't have a scope available at the moment > > Too bad 19200 Hz is probably beyond the range of hearing, otherwise > I'd suggest > audibly comparing the bit clock (use the 'U' suggestion) to a PC > endlessly sending > the same thing. > > Maybe wire up a divider IC to knock down the frequency? > > (Yeah, I realize this may not be the best course of action... but it > would be FUN!)
Err.. Reversals at 19200 baud gives 9600 Hz. But talking of using a PC one could record the signal with a program such as CoolEdit and use the FFT function to check the frequency. Rocky
On Tue, 22 Apr 2008 10:48:55 -0700 (PDT), Rocky <RobertGush@gmail.com>
wrote:

>On Apr 22, 6:51&#4294967295;pm, cs_post...@hotmail.com wrote: >> On Apr 22, 8:53 am, Oskar <oskar.nordqu...@gmail.com> wrote: >> >> > > Try writing a loop to send a character on the serial endlessly, and >> > > then looking at the serial output timing on a scope. >> > I don't have a scope available at the moment >> >> Too bad 19200 Hz is probably beyond the range of hearing, otherwise >> I'd suggest >> audibly comparing the bit clock (use the 'U' suggestion) to a PC >> endlessly sending >> the same thing. >> >> Maybe wire up a divider IC to knock down the frequency? >> >> (Yeah, I realize this may not be the best course of action... but it >> would be FUN!) > >Err.. Reversals at 19200 baud gives 9600 Hz. But talking of using a PC >one could record the signal with a program such as CoolEdit and use >the FFT function to check the frequency. >Rocky
If you send 0xF0, there will be five "0"-bits (start bit+4 data bits) and five "1" bits (4 data bits+stop bit) in 8N1 format, so you have a 1920 Hz square wave. Paul

The 2024 Embedded Online Conference