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.

MSP430F5419A: MSP430F5419A UART INITIALIZATION WITH 115200BAUD RATE AND 1MHZ FREQUENCY

Part Number: MSP430F5419A
Other Parts Discussed in Thread: MSP430F413, UNIFLASH

Hello ,

   I'm facing a problem with changing baud rate of an UART from 9600 to 115200 with frequency of an 1MHZ 

i have written the below code 

UCA0CTL1 |= UCSWRST; 
UCA0CTL1 |= UCSSEL_2;

UCA0BR0 = 8; // 1MHz 115200 

UCA0BR1 = 0; // 1MHz 115200
// UCA1BR0 = 0; //1MHZ 115200
// UCA1BR1 = 0; //1MHZ 115200
UCA0MCTL = UCBRS_0 + UCBRF_13 + UCOS16; // Modln UCBRSx=0, UCBRFx=0,
UCA0CTL1 &= ~UCSWRST; // **Initialize USCI state machine**
__no_operation();
UCA0IE |= UCTXIE;
UCA0IE |= UCRXIE;

  • Thanks for response its working properly.

  • Hello,

      when i'm using __bis_SR_register(LPM0_bits + GIE) ; for enable interrupt it was not get out from that line.

  • Hi Shreya,

    This code means enter LPM0 mode and enable interruption, after executing this line of code, it will wait for interrupt to exit LPM0 mode.

    Thus you will observed not get out from this line if not any interrupt occur.

    Best Regards

    Johnson

  • Hello Johnson,

     Thanks for response,I will explain you brief about what i'm doing so we have one GSM module(SIM7600E) and Controller MSP430F5419A so i'm sending AT command for TCP/IP connection, in my code there as response buffer to get response of at command ,now i stuck in problem that not able to get response of AT command in response buffer of code but in H-term response of command is OK so i think there is an issue in generate interrupt.so please check it . 

  • Hi shreya,

    It seems that the post you created below describes the same issue as this one, let's discuss it in this post.

    https://e2e.ti.com/support/microcontrollers/msp430/f/166/t/860412

    Best Reagrds

    Johnson

  • Hello Johnson,

      can you please explain me how you calculate the values for UCBRF and UCBRS register ,as i'm trying to find out but getting different values for baud rate 115200 and freq=1MHZ

    N=SMCLK/baud rate=1000000/115200=8.680

    UCBR=INT(N/16)=INT(8.680/16)=0

    UCBRF=INT([(N/16) – INT(N/16)] × 16)

                  INT([(8.68/16)-INT(8.68/16)]*16])

                  INT([(0.542)-INT(0.54 MEANS 0)]*16])

                  INT([0.542]*16])

                  INT(8.672)

                   UCBRF=8

    UCBRS=Fractional part of N=(N-INT(N))

    =(8.68-8)

    =0.68

    bt fractional part si

    UCBRS=0

    please correct me if i'm wrong

  • Hi shreya,

    You use the formula in the oversampling mode. The relevant information can be seen in the user's guide, with some main information attached:

    The most efficient way to get the most appropriate values for these three registers(UCBR, UCBRF, UCBRS) is to look up the data provided in the User's guide, as follows:

    Best Regards

    Johnson

  • thanks for support.

    i tried with it RE: Compiler/MSP430F413: Frequency setting to 1Mhz 

    but I am unable to get 1 microsecond delay. timer running with 10 microseconds

  • Hi Ilensys,

    This delay time not 10 microseconds, this para means cycle of MCLK, thus you need to change this para based on your MCLK.

    Best Regards

    Johnson

  • hello,

    thanks for the support. 

    In my project, I am having a single switch. when I press the switch the PWM speed should be increased up to 5 levels. Is there any reference for this requirement.

  • Hi Ilensys,

    We do not have a Code Example that can directly meet your requirement, but you only need to combine the Port interrupt code and the PWM code.

    Please refer to the following code example to modify the PWM frequency or duty cycle directly in the Port Interrupt service routine.

    http://dev.ti.com/tirex/explore/node?node=AC2IJa0WAdkKd2edtAfDSA__IOGqZri__LATEST

    http://dev.ti.com/tirex/explore/node?node=AA9LnIMUmkY.PGRLoThFKA__IOGqZri__LATEST

    Best Regards

    Johnson

  • hi Johnson,

    thank you for advice. 

    I am trying to debouce the PIN. i wanted to store the pin status (0/1) into my variable. based on the PIN status I need to implement my logic. can you plz help me out for reading GPIO status.

    when I press a button (P2.8) it will change the status from 0 to 1. how can i read that status into a variable.

    Regards,

    RG

  • Hi Ilensys,

    If you would like to read a GPIO status, you can use the follow code to set GPIO as input :

    P2DIR &= ~BIT7;                            // Set P2.7 to input direction
    

     

    And then you can read P2IN register to get the value of P2.7

    Best Regards

    Johnson

  • hi,

    Is there any reference for external interrupt service. Iam new to this microcontroller (MSP430F413). I am trying to do but unable to get exactly. can you plz help me

    When i press the button only interrupt should enable.

  • Hi Ilensys,

    This code example as your reference :

    /* --COPYRIGHT--,BSD_EX
     * Copyright (c) 2012, Texas Instruments Incorporated
     * All rights reserved.
     *
     * Redistribution and use in source and binary forms, with or without
     * modification, are permitted provided that the following conditions
     * are met:
     *
     * *  Redistributions of source code must retain the above copyright
     *    notice, this list of conditions and the following disclaimer.
     *
     * *  Redistributions in binary form must reproduce the above copyright
     *    notice, this list of conditions and the following disclaimer in the
     *    documentation and/or other materials provided with the distribution.
     *
     * *  Neither the name of Texas Instruments Incorporated nor the names of
     *    its contributors may be used to endorse or promote products derived
     *    from this software without specific prior written permission.
     *
     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
     * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
     * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
     * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
     * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
     * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
     * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     *
     *******************************************************************************
     *
     *                       MSP430 CODE EXAMPLE DISCLAIMER
     *
     * MSP430 code examples are self-contained low-level programs that typically
     * demonstrate a single peripheral function or device feature in a highly
     * concise manner. For this the code may rely on the device's power-on default
     * register values and settings such as the clock configuration and care must
     * be taken when combining code from several examples to avoid potential side
     * effects. Also see www.ti.com/grace for a GUI- and www.ti.com/msp430ware
     * for an API functional library-approach to peripheral configuration.
     *
     * --/COPYRIGHT--*/
    //******************************************************************************
    //  MSP430F552x Demo - Software Port Interrupt Service on P1.1 from LPM4 with
    //                    Internal Pull-up Resistance Enabled
    //
    //  Description: A hi "TO" low transition on P1.1 will trigger P1_ISR which,
    //  toggles P1.0. P1.1 is internally enabled to pull-up. Normal mode is
    //  LPM4 ~ 0.1uA. LPM4 current can be measured with the LED removed, all
    //  unused Px.x configured as output or inputs pulled high or low.
    //  ACLK = n/a, MCLK = SMCLK = default DCO
    //
    //               MSP430F552x
    //            -----------------
    //        /|\|              XIN|-
    //         | |                 |
    //         --|RST          XOUT|-
    //     /|\   |                 |
    //      --o--|P1.1         P1.0|-->LED
    //     \|/
    //
    //******************************************************************************
    
    #include <msp430.h>
    
    int main(void)
    {
      WDTCTL = WDTPW + WDTHOLD;                 // Stop watchdog timer
      P1DIR |= BIT0;                            // Set P1.0 to output direction
      P1OUT |= BIT1;                            // Set P1.1 as pull-Up resistance
      P1IES |= BIT1;                            // P1.1 Hi/Lo edge
      P1IFG &= ~BIT1;                           // P1.1 IFG cleared
      P1IE |= BIT1;                             // P1.1 interrupt enabled
    
      __bis_SR_register(LPM4_bits + GIE);       // Enter LPM4 w/interrupt
      __no_operation();                         // For debugger
    }
    
    // Port 1 interrupt service routine
    #if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
    #pragma vector=PORT1_VECTOR
    __interrupt void Port_1(void)
    #elif defined(__GNUC__)
    void __attribute__ ((interrupt(PORT1_VECTOR))) Port_1 (void)
    #else
    #error Compiler not supported!
    #endif
    {
      P1OUT ^= BIT0;                           // P1.0 = toggle
      P1IFG &= ~BIT1;                          // P1.1 IFG cleared
    }
    
    
    

    Best Regards

    Johnson

  • Thanks for the support.

    I need a CCS9.2 installation procedure for Linux. Can u plz help me how to install it.

    Regards,

    RG.

  • Hi Ilensys,

    You can found some information about CCS install in this link :

    http://software-dl.ti.com/ccs/esd/documents/ccs_downloads.html

    And this post is best to discuss only the issues described in your title.

    If there are another issues, you can create a new post so that users can more easily find related issues.

    Best Regards

    Johnson

  • hi,

    I am trying to understand interrupt concept with below code.

    #include <msp430.h>

    int main(void)
    {
    WDTCTL = WDTPW + WDTHOLD; // Stop WDT
    FLL_CTL0 |= XCAP18PF; // Set load cap for 32k xtal
    P5DIR |= 0x02; // Set P5.1 as output
    BTCTL = BTDIV + BT_fCLK2_DIV16; // ACLK/(256*16)
    IE2 |= BTIE; // Enable BT interrupt

    __bis_SR_register(LPM3_bits + GIE); // Enter LPM3, enable interrupts
    }

    // Basic Timer Interrupt Service Routine
    #if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
    #pragma vector=BASICTIMER_VECTOR
    __interrupt void basic_timer_ISR(void)
    #elif defined(__GNUC__)
    void __attribute__ ((interrupt(BASICTIMER_VECTOR))) basic_timer_ISR (void)
    #else
    #error Compiler not supported!
    #endif
    {
    P5OUT ^= 0x02; // Toggle P5.1
    }

    How the system can understand whether it is internal or external interrupt? On what based it will service an interrupt?

  • Hi g,

    This post is best to discuss UART issue.

    If there are another issues, you can create a new post so that users can more easily find related issues.

    Best Regards

    Johnson

  • Hi,

    Iam working on MSP430F413 Microcontroller. When Iam trying to Load image (hex) file to microcontroller, Undefined Record type error it is showing. I tried  with Uniflash tool also. But same error iam seeing. can you please help me why this error is coming and how to resolve it.

  • Hi Ilensys,

    You can create a new thread to discussion your problem so that people in the community can participate in the discussion together.

    Best Regards

    Johnson

**Attention** This is a public forum