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/MSP430FR4133: Clock 32k /Baud Rate 9600 / After transferring data by UART, Overrun error occurred when msp430 received UART data

Part Number: MSP430FR4133
Other Parts Discussed in Thread: CC1350,

Tool/software: Code Composer Studio

Hi,

I want 2 devices to communicate by UART. At first, Sub device send data to main. and then main  send data of main sensor to sub after receiving data. and sub send data to main like ACK.

In this case, main device can't receive ACK data from sub. UART overrun error occurred. so if sub sent "ABCDEFGHI" to main, main receive "ABCEFGI".

Uart configuration : Clock source XT1(32k), Baud Rate 9600.  

and i test same operation with Clock source 1M and Baud rate 115200. this worked well .  but i want to operate with Low - power. if i use 1M clock, i can't set power up to  standard what i planned.

  • Hi Kim,

    From the test data of our User's Guide, it can be seen that the communication error of 9600 baud rate is higher when 32768Hz is used as the clock source, so the situation you describe will occur.

    You can reduce the bit error rate of communication by reducing the baud rate.

    And, could you provide more information about the low power requirements in your project?

    Maybe we are able to use a higher frequency clock if you meet your requirements.

    Best Regards

    Johnson

  • Thanks.

    In my project,  i want these to consume 10~20 uA. 

    when i used 1M clock, almost 120 uA but in 32K clock, 17~22uA. 

    and i am trying to reduce baud rate of 32k Clock source(1200, 2400, 4800). but same result for now. 

  • Are you fairly certain the lost bytes are due to overrun (UCOE set)? An actual overrun isn't caused by the clock, rather by software.

    As Johnson pointed out, the fact that this code ran properly with a faster UART clock suggests that it was more likely bytes dropped due to a wobbly clock. But seeing UCOE set would settle the question.

    I'll just mention here: It sounds as though you "own" both ends of the UART link. If so, there's nothing requiring you to stick to "standard" bit rates. You could, e.g. run the UART link at a custom rate of 16.384 kbps (BRW=2) with no modulation and (nominal) 0% error. Within limits, you can even do this with a PC, since (e.g.) PuTTY is fairly flexible in its bit rates.

  • I have found that when using the 32KHz clock for 9600bps between two MSP430's you have to be very careful. Because both are modulating their bit clocks the bit timing is wobbly. They have to both modulate the same way or you could get an error. I  have seen modulation values of 0x4a and 0x92 in MSP430 manuals so there are at least two different values recommended. Add to that the fact that the two clocks are not  synchronized and your margins go to zero.

    If you are not stuck with a "standard" bit rate, choose one with no modulation and an even divisor so that the sampling time is centered.

  • Hi Kim

    How about your issue? Is there any update?

    Best Regards

    Johnson

  • Hi. Johnson. 

    Still not worked well. i can't receive data from other device(CC1350) by UART. The configuration are XT1 clock source(32k) and 9600 Baud rate. 

    when CC1350 device send data to my device(MSP430FR4133), i can receive first thing. and then i will send ACK to that device. and when that device receive my ACK, CC1350 will send other data. In this time, Overrun error occur . so i can't receive second data from CC1350 :(

  • Yes. i checked that Register(UCA0STATW UCOE). it was overrun error.

  • Hi kim,

    If there is an overrun error, as Bruce said, it is probably that this issue cause by software, rather than clock, Is it convenient to post your code about this module?

    Best Regards

    Johnson

  • This is UART interrupt routine of my code. 

    #if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
    #pragma vector=USCI_A0_VECTOR
    __interrupt
    #elif defined(__GNUC__)
    __attribute__((interrupt(USCI_A0_VECTOR)))
    #endif
    void EUSCI_A0_ISR(void)
    {
        switch(__even_in_range(UCA0IV,USCI_UART_UCTXCPTIFG))
        {
               case USCI_NONE: break;
               case USCI_UART_UCRXIFG:
                        rxData = UCA0RXBUF;
                        rcvUARTBuffer[cntUARTRcv] = rxData;
                        cntUARTRcv++;
    //                    EUSCI_A_UART_transmitData(EUSCI_A0_BASE, rxData);
                        if(strstr(rcvUARTBuffer, "\r\n") != 0)
                        {
                                   uartFlag = true;
                                   cntUARTRcv = 0;

                                   __bic_SR_register_on_exit(LPM3_bits);
                         }
                         break;
                case USCI_UART_UCTXIFG:
                         break;
                case USCI_UART_UCSTTIFG:
                         break;
                case USCI_UART_UCTXCPTIFG: break;
           }
    }

    i have checked data CC1350 sent by serial communication program. CC1350 had sent proper data through UART port. but after that UART interrupt routine finished, i have seen that rcvUARTBuffer had lost some data from CC1350. 

    Lines of my code are almost 2000 and  this project is made of 13 files. i can't put that all here. it's too long.  Could you tell me your email address?

  • >  if(strstr(rcvUARTBuffer, "\r\n") != 0)

    Since you haven't NUL-terminated your string (rcvUARTBuffer), this will probably run past the end of your data. The hazard here is false hits from stale data, since it's unlikely to search for a full millisecond before finding a 0 byte. Would it be enough to just check for (rxData=='\n')?

  • Thank you Bruce. 

    My code has initialization routine for that buffer by 0.  so i have NULL-terminated in that buffer. 

    and I already had tried that way what you suggested. but it did not solve my issue. T.T

  • Hi Kim,

    Could you provide some code about UART initialization?

    Best Regards

    Johnson

  • Here Johson

    GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P1, GPIO_PIN0, GPIO_PRIMARY_MODULE_FUNCTION );
    GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P1, GPIO_PIN1, GPIO_PRIMARY_MODULE_FUNCTION );

    EUSCI_A_UART_initParam param = {0};
    param.selectClockSource = EUSCI_A_UART_CLOCKSOURCE_SMCLK;
    param.clockPrescalar = 3;
    param.firstModReg = 0;
    param.secondModReg = 0x92;
    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; // 115200

    EUSCI_A_UART_init(EUSCI_A0_BASE, &param);

    EUSCI_A_UART_enable(EUSCI_A0_BASE);

    EUSCI_A_UART_clearInterrupt(EUSCI_A0_BASE, EUSCI_A_UART_RECEIVE_INTERRUPT);
    EUSCI_A_UART_enableInterrupt(EUSCI_A0_BASE, EUSCI_A_UART_RECEIVE_INTERRUPT);

  • Hi Kim,

    I saw your UART initialization code, and not found any problems, the overrun error may be affected if there are other interrupt programs, the UART can not enter the RX interrupt after receiving the signal, resulting in this error.

    Can you test with our code example, or turn off other functions, leaving only the UART function to test.


    Using the 32768Hz clock to set the baud rate of 9600 is able to normal communication from User' Guide, this error should not be caused by the clock.

    Attach UART code example file link :

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

    Best Regards

    Johnson

  • Hi Kim,

    How about your issue?

    Best Regards

    Johnson

  • Hi Johnson. 

    I tried what you suggested. It works well. so I thought this is not clock issue also. I've thought other interrupt routine interfere UART routine for reading buffer of UART.

    In my project, i have used RTC, Timer0, Timer1, ADC, Port2 and UART interrupt service. so i get rid of other function about this interrupt routines or make simple that. but.... it's not working well. But it show me some clue to solve this issue. i will check more things.  :) Thank you Johnson.

**Attention** This is a public forum