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.

CCS/MSP430F67791A: uart

Part Number: MSP430F67791A


Tool/software: Code Composer Studio

hi i am using msp430f67791a

#include "driverlib.h"

uint16_t i;
uint8_t RXData = 0, TXData = 0;
uint8_t check = 0;

void main(void)
{
    // stop watchdog
    WDT_A_hold(WDT_A_BASE);

    //Set external clock frequency to 32.768 KHz
    UCS_setExternalClockSource(32768, 0);
    //Set ACLK=XT1
    UCS_initClockSignal(UCS_ACLK, UCS_XT1CLK_SELECT, UCS_CLOCK_DIVIDER_1);
    //Start XT1 with no time out
    UCS_turnOnLFXT1(UCS_XT1_DRIVE_0, UCS_XCAP_3);

    //Configure UART pins (UCA0TXD/UCA0SIMO, UCA0RXD/UCA0SOMI)
    //Set P3.0 and P3.1 as Module Function Input
    GPIO_setAsPeripheralModuleFunctionInputPin(
        GPIO_PORT_P3,
        GPIO_PIN4 + GPIO_PIN5
        );

    // Configure UART
    EUSCI_A_UART_initParam param = {0};
    param.selectClockSource = EUSCI_A_UART_CLOCKSOURCE_ACLK;
    param.clockPrescalar = 3;
    param.firstModReg = 0;
    param.secondModReg = 92;
    param.parity = EUSCI_A_UART_NO_PARITY;
    param.msborLsbFirst = EUSCI_A_UART_LSB_FIRST;
    param.numberofStopBits = EUSCI_A_UART_ONE_STOP_BIT;
    param.uartMode = EUSCI_A_UART_MODE;
    param.overSampling = EUSCI_A_UART_LOW_FREQUENCY_BAUDRATE_GENERATION;

    if (STATUS_FAIL == EUSCI_A_UART_init(EUSCI_A1_BASE, &param)) {
        return;
    }

    EUSCI_A_UART_enable(EUSCI_A1_BASE);

    EUSCI_A_UART_clearInterrupt(EUSCI_A1_BASE,
                         EUSCI_A_UART_RECEIVE_INTERRUPT);

    // Enable USCI_A0 RX interrupt
    EUSCI_A_UART_enableInterrupt(EUSCI_A1_BASE,
          EUSCI_A_UART_RECEIVE_INTERRUPT);                     // Enable interrupt

    __enable_interrupt();
    while (1)
    {

          // Increment TX data
        // Load data onto buffer
        EUSCI_A_UART_transmitData(EUSCI_A1_BASE,
                           TXData);
        TXData = TXData+1;

        while(check != 1);
        check = 0;
    }
}
//******************************************************************************
//
//This is the USCI_A0 interrupt vector service routine.
//
//******************************************************************************
#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
#pragma vector=USCI_A1_VECTOR
__interrupt
#elif defined(__GNUC__)
__attribute__((interrupt(USCI_A1_VECTOR)))
#endif
void EUSCI_A1_ISR(void)
{
  switch(__even_in_range(UCA1IV,USCI_UART_UCTXCPTIFG))
  {
    case USCI_NONE: break;
    case USCI_UART_UCRXIFG:
       RXData = EUSCI_A_UART_receiveData(EUSCI_A1_BASE);
      if(!(RXData == TXData))                   // Check value
      {
        while(1);
      }
      check =1;
      break;
    case USCI_UART_UCTXIFG: break;
    case USCI_UART_UCSTTIFG: break;
    case USCI_UART_UCTXCPTIFG: break;
  }
}


i am using example code, in this i changed pins and uart channel i am not able to communicate in uart
please suggest me which are the things i need to modify

regards

bindu

  • Hello,

    Could you please provide a little further detail of your issue so that we can provide support? For example:

    - What example code did you start with?

    - What version of driverlib are you using?

    - Have you backtracked the changes you've made from the example code to the current source code to see where the bug is located?

    If you'd like to get a register level UART code example tailored for the MSP430F67791A you can refer to the register level UART code examples provided in the TI Resource Explorer.

    Best regards,

    Matt

  • hi i am using register level program provided in the resource explorer

    in that when i try to debug it is not coming out of the do while loop for clearing  XT1 fault flag
    regards 
    bindu
  • hi i am using register level program provided in the resource explorer
    in that when i try to debug it is not coming out of the do while loop for clearing XT1 fault flag

    regards
    bindu
  • Bindu,

    The example code you pasted in your initial post seems to be from a driverlib example project, not a register level example provided in the TI Resource Explorer.

    When the code is not coming out of the crystal initialization step of an example code it is usually because there is some sort of problem with the crystal circuit. Are you using a target socket board or are you using a custom PCB?

    Best regards,

    Matt

  • sorry i forgot to mention i used both register level and driver level codes

    for driver lever code when i tried to only transmit the data data can be seen in txbuf but not transmitted to terminal window

    regards 

    bindu

  • i am using custom PCB
  • It sounds like the problem currently lies in the crystal initialization portion of the application. To confirm this, please import a tested example that uses the LFXT low frequency crystal module ( i.e. msp430f677xA_ucs_4.c from the TI Resource Explorer linked above ) and check  to see that the application works properly. Note: You may need to modify some GPIO port initialization to meet the needs for your custom PCB.

    If the application is not running properly then you can isolate the problem to the crystal and focus your attention on fixing that aspect of the design. You can refer to the MSP430™ 32-kHz Crystal Oscillators application report for detailed information on proper crystal selection and best practices for layout and implementation. You can also use design kits and EVMs linked in the device's landing page for reference on how the crystal layout is done on those boards.

    Best regards,

    Matt

**Attention** This is a public forum