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.

MSP430FR5969 UART overrun problem

Other Parts Discussed in Thread: MSP430FR5969

Hello,

i'm new to using msp430fr5969 i'm trying to transmit data using a bluetooth module (pan1026).

whenever i try to send a bit sequence from my processor to the bluetooth module (in order to set it up) i get the flag overrun error set.

would it be possible to help me control the flag to create a delay between sent bits.

#include "driverlib.h"
unsigned char TCU_HCI_RESET_REQ[4] = {0x01, 0x03, 0x0c, 0x00};

void main(void) {          
          P2SEL1 |= BIT5| BIT6;                    // Configure UART pins
	  P2SEL0 &= ~(BIT5| BIT6);

	  // Disable the GPIO power-on default high-impedance mode to activate
	  // previously configured port settings
	  PM5CTL0 &= ~LOCKLPM5;

	  // Startup clock system with max DCO setting ~8MHz
	  CSCTL0_H = CSKEY >> 8;                    // Unlock clock registers
	  CSCTL1 = DCOFSEL_3 | DCORSEL;             // Set DCO to 8MHz
	  CSCTL2 = SELA__VLOCLK | SELS__DCOCLK | SELM__DCOCLK;
	  CSCTL3 = DIVA__1 | DIVS__1 | DIVM__1;     // Set all dividers
	  CSCTL0_H = 0  ;                           // Lock CS registers

	  // Configure USCI_A1 for UART mode
	  UCA1CTLW0 = UCSWRST;                      // Put eUSCI in reset
	  UCA1CTLW0 |= UCSSEL__SMCLK;               // CLK = SMCLK
	  UCA1BR0 = 4;                             // 8000000/16/115200
	  UCA1BR1 = 0x00;
	  UCA1MCTLW |=0x55; //UCOS16 | UCBRF_1;
	  UCA1CTLW0 &= ~UCSWRST;                    // Initialize eUSCI
	  UCA1IE |= UCRXIE;                         // Enable USCI_A0 RX interrupt

          
          USART1_SendData(TCU_HCI_RESET_REQ,4);
          while(1);
}
void USART1_SendByte (unsigned char data) {
	while(!(UCA1IFG & UCTXIFG));
	UCA1TXBUF = data;

}
void USART1_SendData (unsigned char data[], unsigned char length) {

	unsigned char i;
           for(i=0; i<length; i++) {
          USART1_SendByte(data[i]);
          }

}

  • I guess you mean the ‘UCOE’ bit, this is the Receiver overrun, probably you receive the transmitted data back and you don’t read ‘UCAxRXBUF’.

    You have enabled ‘UCRXIE’ but I don’t see and ISR for it. In the Receiver_ISR you can read UCAxRXBUF.
  • thx you for your answer,

    to read what is there in the register I put directly

    unsigned char receive []=UCA1RXBUF

    this is what I understood
    #include "driverlib.h"
    unsigned char TCU_HCI_RESET_REQ[4] = {0x01, 0x03, 0x0c, 0x00};
    
    void main(void) {          
              P2SEL1 |= BIT5| BIT6;                    // Configure UART pins
          P2SEL0 &= ~(BIT5| BIT6);
    
          // Disable the GPIO power-on default high-impedance mode to activate
          // previously configured port settings
          PM5CTL0 &= ~LOCKLPM5;
    
          // Startup clock system with max DCO setting ~8MHz
          CSCTL0_H = CSKEY >> 8;                    // Unlock clock registers
          CSCTL1 = DCOFSEL_3 | DCORSEL;             // Set DCO to 8MHz
          CSCTL2 = SELA__VLOCLK | SELS__DCOCLK | SELM__DCOCLK;
          CSCTL3 = DIVA__1 | DIVS__1 | DIVM__1;     // Set all dividers
          CSCTL0_H = 0  ;                           // Lock CS registers
    
          // Configure USCI_A1 for UART mode
          UCA1CTLW0 = UCSWRST;                      // Put eUSCI in reset
          UCA1CTLW0 |= UCSSEL__SMCLK;               // CLK = SMCLK
          UCA1BR0 = 4;                             // 8000000/16/115200
          UCA1BR1 = 0x00;
          UCA1MCTLW |=0x55; //UCOS16 | UCBRF_1;
          UCA1CTLW0 &= ~UCSWRST;                    // Initialize eUSCI
          UCA1IE |= UCRXIE;                         // Enable USCI_A0 RX interrupt
    
              
              USART1_SendData(TCU_HCI_RESET_REQ,4);
              while(1);
    }
    void USART1_SendByte (unsigned char data) {
        while(!(UCA1IFG & UCTXIFG));
        UCA1TXBUF = data;
       __bis_SR_register(CPUOFF + GIE); // Enter LPM0 w/ int until Byte RXed
    }
    void USART1_SendData (unsigned char data[], unsigned char length) {
    
        unsigned char i;
    
    for(i=0; i<length; i++) {
    USART1_SendByte(data[i]);
    }
    
    }
    #pragma vector=USCIAB0RX_VECTOR 
    __interrupt void USCI0RX_ISR(void) 
    { 
    usigned char receive[]=UCA1RXBUF;
    }

  • You can’t use an Array that way, just use “usigned char receive = UCA1RXBUF;”.

**Attention** This is a public forum