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.

MSP430FR2433: Not able to send char array of more than 17 length using UART in RTC_ISR.

Part Number: MSP430FR2433

Hi,

I am trying to run the MSP430FR2433 MCU in LPM3.5 and wake it up using RTC every 1s. It is waking up properly, but whenever it wakes up I am trying to do some calculation and send that char data of 19 length using UART. I am able to get char data of max around 17 length. After that data is not received and next packet starts coming in the next RTC interrupt wakeup.

I am not able to understand why this is happening, can anyone help me to understand this and help me to fix this?

RTC clock source: XT1CLK

I am also attaching full code for reference.

Thanks

Jeevant Sah

6242.main.c
Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <msp430.h>
#include <stdint.h>
#include "RTC_Calendar.h"
/**
* main.c
*/
#define SMCLK_115200 0
#define SMCLK_9600 1
#define UART_MODE SMCLK_115200//SMCLK_9600//
uint16_t mid_second,mid_minute,mid_hour,mid_day,mid_month,mid_year;
void print(char *text)
{
unsigned int i = 0;
while(text[i] != '\0')
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • Problem solved, before writing to the uart tx register I was not checking the tx status buffer properly and was not waiting enough before writing another byte of data.

    It worked after updating print function like this:

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    void print(char *text)
    {
    unsigned int i = 0;
    while(text[i] != '\0')
    {
    while (UCA0STATW & UCBUSY)
    ;
    while (!(UCA0IFG & UCTXIFG))
    ;
    UCA0TXBUF = text[i]; // TX -> Received Char + 1
    while (UCA0STATW & UCBUSY)
    ;
    i++;
    }
    }
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • it usually suffices to wait (spin) for UCBUSY once, after you exit the while() loop. This will assure the UART internal buffers are clear before you go back to sleep (which turns off the UART clock).

**Attention** This is a public forum