Quantcast
Channel: MSP low-power microcontroller forum - Recent Threads
Viewing all 22733 articles
Browse latest View live

MSP430FR6047: MSP430FR6047: Suitable max pipe size? & Max TOF?

$
0
0

Part Number:MSP430FR6047

Hello,

I would like to know some specific performance statistics.

1 - What is the maximum possible pipe size this Microcontroller is suitable for?

2 - What is the maximum TOF, DTOF it is possible to measure?

Regards,

Jadhav 


CCS/MSP430G2553: MSP430 I2C and UART not working together

$
0
0

Part Number:MSP430G2553

Tool/software: Code Composer Studio

Hello friends, I am trying to communicate the MSP430 with CI DS1307 (RTC) via I2C, and send their data via UART. But I can not read via I2C and send through the UART at the same time. I2C works normally without the UART, and the UART works normally without the I2C, but they do not work together.
 
This is my code:
 
#define SLA_ADR 0x68
unsignedchar dados[8];
unsignedchar control = 0;
int I2C_WRITE_READ = 1;                        //0 - IDLE; 1 - WRITING; 2 - READING
int I2C_STATE = 0;
int Num;
int new_hex;
int A;
int B;                          //{reset, segmin, hora, d_se, d_me,  mesano, confi}
unsignedchar relogio_buffer[9] = {0x00, 0x30, 0x32, 0x21, 0x07, 0x05, 0x10, 0x18, 0x10};
unsignedchar relogio_buffer_leitura[7] = {0, 0, 0, 0, 0, 0, 0};
structtime {
    unsignedshortintmilis;               //milisegundo
    unsignedcharsec;                      //segundo
    unsignedcharmin;                      //minuto
    unsignedcharhour;                     //hora
    unsignedchardate;                     //data
    unsignedcharday;                      //dia
    unsignedcharmon;                      //mes
    unsignedcharyear;                     //ano
} relogio = {0,0,0,0,0,0,0,0};
  
intmain(void)
{
    Clock_Config();
GPIO_Config();
    UART_Config();
    I2C_Config();
    __enable_interrupt();
 
    while(1)
    {
        //*****************************----------------------------***********************
        //*****************************-----------RTC--------------***********************
        //*****************************----------------------------***********************
 
        if(I2C_WRITE_READ == 0) I2C_WRITE_READ = 2;
 
        if((I2C_WRITE_READ == 2) && (I2C_STATE == 0))
        {
            I2C_STATE = 19;
            I2C_Read();
        }
        elseif(I2C_STATE >= 19)
        {
            I2C_Read();
        }
        elseif((I2C_STATE < 19) && ((I2C_WRITE_READ == 1) || (I2C_STATE > 0)))
        {
            I2C_Write();
        }
 
        //*****************************----------------------------***********************
        //*****************************----------------------------***********************
        //*****************************----------------------------***********************
    }
}
 
#pragma vector = USCIAB0TX_VECTOR
__interruptvoidUSCIAB0TX_ISR(void)
{
    if (IFG2 & UCB0TXIFG)
    {
        IFG2 &= ~UCB0TXIFG;
        I2C_STATE++;
    }
 
    if (IFG2 & UCB0RXIFG)
    {
        IFG2 &= ~UCB0RXIFG;
        if (I2C_STATE == 22)
        {
            relogio.sec = ((UCB0RXBUF & 0xF0) >> 0x04)*10;     //Read seconds
            relogio.sec += (UCB0RXBUF & 0x0F);
            IE2 |= UCA0TXIE;
            UCA0TXBUF = relogio.sec;
            I2C_STATE = 23;
        }
        elseif (I2C_STATE == 24)
        {
            relogio.min = ((UCB0RXBUF & 0xF0) >> 0x04)*10;     //Read minutes
            relogio.min += (UCB0RXBUF & 0x0F);
            UCA0TXBUF = relogio.min;
            I2C_STATE = 25;
        }
        elseif (I2C_STATE == 26)
        {
            relogio.hour = ((UCB0RXBUF & 0xF0) >> 0x04)*10;     //Read hours
            relogio.hour += (UCB0RXBUF & 0x0F);
            UCA0TXBUF = relogio.hour;
            I2C_STATE = 27;
        }
        elseif (I2C_STATE == 28)
        {
            relogio.date = ((UCB0RXBUF & 0xF0) >> 0x04)*10;     //Read days
            relogio.date += (UCB0RXBUF & 0x0F);
            UCA0TXBUF = relogio.date;
            I2C_STATE = 29;
        }
        elseif (I2C_STATE == 30)
        {
            relogio.day = ((UCB0RXBUF & 0xF0) >> 0x04)*10;     //Read dates
            relogio.day += (UCB0RXBUF & 0x0F);
            UCA0TXBUF = relogio.day;
            I2C_STATE = 31;
        }
        elseif (I2C_STATE == 32)
        {
            relogio.mon = ((UCB0RXBUF & 0xF0) >> 0x04)*10;     //Read months
            relogio.mon += (UCB0RXBUF & 0x0F);
            UCA0TXBUF = relogio.mon;
            I2C_STATE = 33;
        }
        elseif (I2C_STATE == 34)
        {
            relogio.year = ((UCB0RXBUF & 0xF0) >> 0x04)*10;     //Read years
            relogio.year += (UCB0RXBUF & 0x0F);
            UCA0TXBUF = relogio.year;
            I2C_STATE = 35;
        }
        elseif (I2C_STATE == 36)
        {
            control = ((UCB0RXBUF & 0xF0) >> 0x04)*10;          //Read control
            control += (UCB0RXBUF & 0x0F);
            UCA0TXBUF = control;
            IE2 &= ~UCA0TXIE;
            I2C_STATE = 37;
        }
    }
}
voidClock_Config(void)
{
    WDTCTL = WDTPW + WDTHOLD;                 // Stop WDT
    if (CALBC1_16MHZ==0xFF)                   // If calibration constant erased
    {
        while(1);                             // do not load, trap CPU!!
    }
    DCOCTL = 0;                               // Select lowest DCOx and MODx settings
    BCSCTL1 = CALBC1_16MHZ;                   // Set DCO
    DCOCTL = CALDCO_16MHZ;
}
 
void GPIO_Config(void)
{
    P1DIR |= BIT0 + BIT6 + BIT7;
    P2DIR |= BIT0 + BIT1 + BIT3;
    P1REN |= BIT3 + BIT4;
    P1OUT |= BIT3 + BIT4 + BIT6 + BIT7;
    P1OUT &= ~BIT0;
}
voidUART_Config(void)
{
    P1SEL |= BIT1 + BIT2;                     // P1.1 = RXD, P1.2=TXD
    P1SEL2 |= BIT1 + BIT2;                    // P1.1 = RXD, P1.2=TXD
    UCA0CTL1 |= UCSWRST;
    UCA0CTL0 |= UCMODE_0;
    UCA0CTL1 = UCSSEL_2 + UCSWRST;            // UCSSEL_2 = SMCLK; UCSWRST = Reset
    UCA0BR0 = 104;                            // 16MHz 9600
    UCA0BR1 = 0;                              // 16MHz 9600
    UCA0MCTL = UCBRF2 + UCBRF1 + UCOS16;      // Modulation UCBRSx = 0, UCBRFx = 3, UCOS16 = 1
    UCA0CTL1 &= ~UCSWRST;                     // **Initialize USCI state machine**
    IE2 |= UCA0RXIE;
}
 
voidI2C_Config(void)
{
    P1SEL |= BIT6 + BIT7;                   //BIT6 = SCL; BIT7 = SDA
    P1SEL2 |= BIT6 + BIT7;                  //BIT6 = SCL; BIT7 = SDA
    UCB0CTL1 |= UCSWRST;                    //Reset
    UCB0CTL0 |= UCMST + UCMODE_3 + UCSYNC;   //UCMST = Modo Master; UCMODE_3 = Modo I2C; UCSYNC = ModoSincrono
    UCB0CTL1 = UCSSEL_2 + UCSWRST;          //UCSSEL_2 = SMCLK; UCSWRST = Reset
    UCB0BR0 = 160;                          //UCBR0 = 160
    UCB0BR1 = 0;                            //UCBR1 = 0; (UCBR0 + UCBR1*256) = prescaler
    UCB0I2COA = 0;                          //I2COA0 = 0; Enderecoproprio
    UCB0I2CSA = SLA_ADR;                    //I2CSA = SLA_ADR
    UCB0CTL1 &= ~UCSWRST;                   //Unreset
    UCB0I2CIE |= UCSTTIE;
    IE2 |= UCB0TXIE + UCB0RXIE;             //UCB0TXIE = Habilitainterrupcao TX I2C;  UCB0RXIE = Habilitainterrupcao RX I2C
}
 
voidI2C_Write(void)
{
    if (I2C_STATE == 0)
    {
        I2C_Config();
 
        UCB0I2CSA = SLA_ADR;                     //SLA_ADR = 0x68
        UCB0CTL0 &= ~UCSLA10;                    //UCSLA10 = Slave adress 7 bits
        UCB0CTL1 |= UCTR + UCTXSTT;              //UCTR = Modotransmissao; UCTXSTT = Transmiteum start condition
        IFG2 &= ~(UCB0TXIFG);                    //Clear any pending interrupts
        IE2 |= UCB0TXIE;                         //Enable TX interrupt
        UCB0TXBUF = 0x00;
        I2C_STATE = 1;
    }
 
    elseif (I2C_STATE == 2)
    {
        Num = relogio_buffer[1];
        A = Num/10;
        B = Num - (A*10);
        new_hex = A*16 + B;
        UCB0TXBUF = relogio_buffer[1];                    //Config seconds
        I2C_STATE = 3;
    }
 
    elseif (I2C_STATE == 4)
    {
        Num = relogio_buffer[2];
        A = Num/10;
        B = Num - (A*10);
        new_hex = A*16 + B;
        UCB0TXBUF = relogio_buffer[2];                  //Config minutes
        I2C_STATE = 5;
    }
 
    elseif (I2C_STATE == 6)
    {
        Num = relogio_buffer[3];
        A = Num/10;
        B = Num - (A*10);
        new_hex = A*16 + B;
        UCB0TXBUF = relogio_buffer[3];                    //Config hours
        I2C_STATE = 7;
    }
 
    elseif (I2C_STATE == 8)
    {
        Num = relogio_buffer[4];
        A = Num/10;
        B = Num - (A*10);
        new_hex = A*16 + B;
        UCB0TXBUF = relogio_buffer[4];                    //Config dates
        I2C_STATE = 9;
    }
 
    elseif (I2C_STATE == 10)
    {
        Num = relogio_buffer[5];
        A = Num/10;
        B = Num - (A*10);
        new_hex = A*16 + B;
        UCB0TXBUF = relogio_buffer[5];                    //Config days
        I2C_STATE = 11;
    }
 
    elseif (I2C_STATE == 12)
    {
        Num = relogio_buffer[6];
        A = Num/10;
        B = Num - (A*10);
        new_hex = A*16 + B;
        UCB0TXBUF = relogio_buffer[6];                    //Config months
        I2C_STATE = 13;
    }
 
    elseif (I2C_STATE == 14)
    {
        Num = relogio_buffer[7];
        A = Num/10;
        B = Num - (A*10);
        new_hex = A*16 + B;
        UCB0TXBUF = relogio_buffer[7];                    //Config years
        I2C_STATE = 15;
    }
 
    elseif (I2C_STATE == 16)
    {
        UCB0TXBUF = 0x10;                       //Config control register
        I2C_STATE = 17;
    }
 
    elseif (I2C_STATE == 18)
    {
        UCB0CTL1 |= UCTXNACK + UCTXSTP;          //UCTXNACK = Generate NACK; UCTXSTP = Generate STOP
        I2C_STATE = 0;
        if (I2C_WRITE_READ == 1)
        {
            I2C_WRITE_READ = 0;
        }
    }
}
 
voidI2C_Read(void)
{
    if (I2C_STATE == 19)
    {
        I2C_Config();
 
        UCB0I2CSA = SLA_ADR;                     //SLA_ADR = 0x68
        UCB0CTL0 &= ~UCSLA10;                    //UCSLA10 = Slave adress 7 bits
        UCB0CTL1 |= UCTR + UCTXSTT;              //UCTR = Modotransmissao; UCTXSTT = Transmiteum start condition
        IFG2 &= ~(UCB0TXIFG + UCB0RXIFG);        //Clear any pending interrupts
        IE2 |= UCB0TXIE;                         //Enable TX interrupt
        UCB0TXBUF = 0x00;                        //Register address
        I2C_STATE = 20;
    }
    elseif (I2C_STATE == 21)
    {
        UCB0I2CSA = SLA_ADR;                     //SLA_ADR = 0x68
        UCB0CTL0 &= ~UCSLA10;                    //UCSLA10 = Slave adress 7 bits
        UCB0CTL1 &= ~UCTR;                       //UCTR = Modorecepcao
        UCB0CTL1 |= UCTXSTT;                     //UCTXSTT = Transmiteum start condition
        IFG2 &= ~(UCB0TXIFG + UCB0RXIFG);        //Clear any pending interrupts
        IE2 |= UCB0RXIE;                         //Enable RX interrupt
        I2C_STATE = 22;
    }
    elseif (I2C_STATE == 23) I2C_STATE = 24;     //Permite Read minutes
    elseif (I2C_STATE == 25) I2C_STATE = 26;     //Permite Read hours
    elseif (I2C_STATE == 27) I2C_STATE = 28;     //Permite Read days
    elseif (I2C_STATE == 29) I2C_STATE = 30;     //Permite Read dates
    elseif (I2C_STATE == 31) I2C_STATE = 32;     //Permite Read months
    elseif (I2C_STATE == 33) I2C_STATE = 34;     //Permite Read years
    elseif (I2C_STATE == 35)
    {
        UCB0CTL1 |= UCTXNACK + UCTXSTP;           //UCTXNACK = Generate NACK; UCTXSTP = Generate STOP
        I2C_STATE = 36;                           //Permite Read control
    }
    elseif (I2C_STATE == 37)
    {
        UCB0CTL1 |= UCTXNACK + UCTXSTP;           //UCTXNACK = Generate NACK; UCTXSTP = Generate STOP
        IFG2 &= ~(UCB0RXIFG);
        IE2 &= ~(UCB0RXIE);
        I2C_STATE = 0;
    }
}

 
Can anybody help me?

int main(void){    Clock_Config();    GPIO_Config();    UART_Config();    I2C_Config();
    P1DIR = 0x41;                             // P1.0 P1.6 output, else input    P1OUT = 0x08;                             // P1.3 set, else reset    P1REN |= 0x08;                            // P1.3 pullup
    __enable_interrupt();       // Enter LPM0, interrupts enabled
    while(1)    {

MSP430F149: Phantom signals seen on the MISO line when operating in 4-pin SPI Slave mode

$
0
0

Part Number:MSP430F149

Hello,

I am trying to communicate with the MSP via an external master. I have managed to get the MOSI signals to work properly and have the MSP respond properly. However, the MISO is not operating as expected. After receiving 5 characters, it is supposed to respond with 2. However, when looking at the oscilloscope, I see that the SPI MISO line is constantly sending a single character (the green signal is MISO, the left yellow is MOSI and the right yellow signal is CLK). I am using USART0 and I have omitted all the code in the TX and RX interrupt, but the problem persists. Additionally, when I sent the characters from the master when the MSP had the MISO functionality disabled and set to the pin to an input, the MISO line saw no response, indicating it has to do with the MSP. Is there a characteristic of the SPI that I am unaware of?

   

CCS/MSP430FR4133: MSP430FR4133

$
0
0

Part Number:MSP430FR4133

Tool/software: Code Composer Studio

Hi

I am taking a course on Udemy called Microcontrollers and c programming language. Its a great course but I have hit a few problems. When buying the development board I didn't buy the exact board they use on the course and I have hit problems with programming the LCD screen. The tutor asks us to download a dropbox file which contains files to make it easier to create a program that interacts with the LCD display on the dev board. However when I try to include these files they are not right because I am using a slightly different dev board to the one they are using. Is there anyone on here that has had this problem or someone that can help me create these files so that it works with my board. The files I am looking to recreate are

myGPIO.h

myClocks.h 

myLcd.h

The board that they use in the course is a MSP430FR6989 DEV Board

If anyone can help me it would be greatly appreciated as I have managed to get so far in the course and don't want to give up now.

MSP430FR5994: LEA to assist voice codec

$
0
0

Part Number:MSP430FR5994

Dear TI DSP experts,

Can someone give me advice, is it possible to implement one of the existent narrowband voice compression codecs using MSP430+LEA? The requirements are: it is in 8kbps-13kpbs data rate range; it is not based on 2-bit ADPCM, preferably it extensively use FFT, convolution, filtering, MAC and other batch processing from LEA module, sample rate 8kHz-12kHz.

Please, give expert response in public or private manner for your choice.

Regards,

Alexey

MSP430F5510: TLV ADC10 Calibration Values

$
0
0

Part Number:MSP430F5510

Hi.

I'm looking to use the internal temperature sensor with the ADC10 to get a rough PCB assembly temperature. Data suggest with the TLV calibration ±3°C is possible. (without ±20°C).

Reading the TLV ADC10 block , I getting the data below (shown in decimal and hex) , but i'm not sure if this looks correct.

Please can someone confirm. I'm using Rowley Crossworks.   I looked on the web and some people were suggesting higher values for the ref 30 and 85°C values.

Regards

Nick

CCS/EVM430-FR6047: EVM430-FR6047 Calibration not working outside USS program

$
0
0

Part Number:EVM430-FR6047

Tool/software: Code Composer Studio

Hi,

I updated to the new version of USS library

But the calibration doesn't work if I use the headers outside the calibration/demo application listed.

My code is based on the same calibration program, it uses the same files and the same routines in the same way, but the result is really not the same.

I did the same with a previous version of the library and calibration/demo program, and it worked just fine. I just want to be able to calibrate defining mutliple ranges.

MSP430FR2355: Output current for Op Amp in SAC

$
0
0

Part Number:MSP430FR2355

What is the output current capability of the Op Amp in each SAC module? 

Also, if the SAC is configured to output onto an OAxO pin, which is internally connected to another module (Comparator, ADC), does this prevent the corresponding pin from being used as a digital pin?


CCS/MSP430FR6989: UCA0 correct comfiguration P4.3 and P4.2

$
0
0

Part Number:MSP430FR6989

Tool/software: Code Composer Studio

I want use UCA0 in port 4 pin 2,3   

and i write this code

 P4SEL0 |=(BIT2 | BIT3); // USCI_A0 UART operation
  P4SEL1 &= ~(BIT2 | BIT3);


UCA0CTLW0 = UCSWRST; // Put eUSCI in reset
UCA0CTLW0 |= UCSSEL__SMCLK; // CLK = SMCLK
UCA0BR0 = 104; // 16000000/16/9600
UCA0BR1 = 0x00;
UCA0MCTLW |= UCOS16 | UCBRF_2 | 0xD600; //0xD600 is UCBRSx = 0xD6
UCA0CTLW0 &= ~UCSWRST;
DE_OFF;
DE_ACTIVE;// Initialize eUSCI
UCA0IE |= UCRXIE;

This is correct configuration

CCS/MSP430FR2355: External Interrupt Problem

$
0
0

Part Number:MSP430FR2355

Tool/software: Code Composer Studio

Hi,

  I'm pretty new to the MSP430. I'm working on a project about MSP430fr2355 and NRF24L01.

  According to NRF24L01 datasheet, when the board receives the data, its RX_DR bit will set high and IRQ pin switch from high to low. I'm sure both functions work well after I testing them.

  The function I want to achieve is when RF24 receives data, it gives an interrupt to MSP430 to execute other things, like increasing a variable, trigger LED on.

//---------------------------------------------------------------------------------------------------------------------------------------------------

Problem1:

  I set a breakpoint in the while loop. But when IRQ pin is from high to low (data come), I resume the program many times, but variable "pin" never increase (I set this variable in Expression in debug mode). Is there something wrong with my ISR(interrupt services routine) or other parts?

Problem2:

  From my perspective, it seems that the breakpoint prevents the program to run the ISR. Is my understanding right?

Problem3:

  When I don't use the breakpoint, after I run the code, the Expressions will show " Could not read 0x2000: execution state prevented access". I wonder if are there any other technologies that can help me to verify whether my ISR work or not. 

If anyone can help me, I’m so grateful!!!   Thank you.

Here is part of code related to the interrupt. IRQ ( Pin 2.0 )

--------------------------------------------------------------------
#include <msp430.h>
#include <stdint.h>
#include <nRF24L01.h>

int i; int pin;

int main(void)
{
    WDTCTL = WDTPW | WDTHOLD;

    //Configure Pin interrupt
    P2DIR &= ~BIT0;
    P2OUT |= BIT0;
    P2REN |= BIT0;
    P2IES |= BIT0;
    P2IE |= BIT0;
    P2IFG &= ~BIT0;

    i = 1000;
    pin = 0;

    while(1){
i--; // I set breakpoint here } } #pragma vector=PORT2_VECTOR __interrupt void Port_2(void) { pin++; P2IFG &= ~BIT0; // Pin 2.0 flag clear }
--------------------------------------------------------------------

CCS/MSP430FR6972: msp430fr6972

$
0
0

Part Number:MSP430FR6972

Tool/software: Code Composer Studio

Hello ,

I am using msp430fr6972.

I am using LCD Program.

After Making the program I check the current,

an I find that it is very high(>250uA).

It is customized board.

And crystal used is 32768.

Lcd : MUX 4 & 22 Pins( upto S22).

My Program is :

LCD FUNCTION  IS =========

void LCD_init(void)
{
unsigned int i;
P6SELC |= 0x7f;

// LCDCCTL0 = LCD4MUX + LCDDIV_26 + LCDPRE1 + LCDLP; //lcd control,lcd divide by 27 ,lcd frequency prescalar divide by2 ......gived 90 uA

// LCDCCTL0 = LCDDIV_26 | LCDPRE1 |LCD4MUX | LCDLP; //lcd control,lcd divide by 27 ,lcd frequency prescalar divide by2

LCDCPCTL0 |= 0xFFFF; // Segments 0-15
LCDCPCTL1 |= 0x007F; // Segments 16-22

LCDCVCTL |= 0x0040; //external connectio0n of lowest lcd voltage, no charge pump as no capacitor connected.
// LCDCCPCTL |= LCDCPCLKSYNC;

LCDCMEMCTL = LCDCLRM; // Clear LCD memory

LCDCCTL0 |= LCDON ;

for(i=0; i<12; i++) LCD[i] = 0x00;

}

 

MAIN FUNCTION WITH TIMER=====================================

char start_condition = 9;
char* LCD = LCDMEM;

const unsigned char lcd_num[12] = {
0xEB, // 0
0x60, // 1
0xAD, // 2
0xE5, // 3
0x66, // 4
0xC7, // 5
0xCF, // 6
0x61, // 7
0xEF, // 8
0xE7, //9
0x6F, // A
};

void LCD_init(void);

int main(void)

{
WDTCTL = WDTPW | WDTHOLD; // stop watchdog timer

//PIN DEFINE===========================================================================

PM5CTL0 &= ~LOCKLPM5; // Disable the GPIO power-on default high-impedance mode

P1DIR= 0xF0 ; P2DIR =0x0F; P3DIR= 0xC0; P4DIR=0xFC; P5DIR=0x80; P7DIR= 0x1F;
P1OUT= 0xF0 ; P2OUT =0x0F; P3OUT= 0xC0; P4OUT=0xFC; P5OUT=0x80; P7OUT= 0x1F;

//TIMER======================================================================================

TA0CCTL0 |= CCIE;
TA0CCR0 = 32767; //1 sec timer
TA0CTL |= TASSEL__ACLK |MC_1 | ID_2 ; //TimerA control register, upto ccr, ID=0,divider1,

LCD_init();
start_condition = 8;
// __bis_SR_register(GIE);


while(1)
{
__bis_SR_register(LPM3_bits+GIE );
}// return 0;

}


/*
* Timer Interrupt====================================================================
*
*/

#pragma vector = TIMER0_A0_VECTOR
__interrupt void Timer0_A0_ISR (void)
{

if (start_condition != 0) {
LCD[0] = lcd_num[start_condition];
// TA0CCR0 = 32767;
start_condition--;
LPM3_EXIT;
}

}

Please check my LCD FUNCTION,

Please help me.

Regards,

Srijit.

MSP430F5438A: MSP430F5438A ADC and UART

$
0
0

Part Number:MSP430F5438A

Hello sir, 

i am using 12 bit adc with ~1khz sampling frequency and uart baudrate of 115200. when receiving the ADC data using uart i am getting an extra character(symbol) as shown in fig. why this is coming along with data is there any mistake in code please check once.

thanks

#include "msp430f5438A.h"
#include<stdio.h>
#include<string.h>
#include <stdint.h>


void adcfunction(void);
void adcInit(void);

char buffer[10] = '\0';
static int SavedADC12MEM1;

#pragma vector=ADC12_VECTOR
__interrupt void ADC12_ISR(void)
{

SavedADC12MEM1 = ADC12MEM0;

P5SEL |= BIT6 + BIT7; 
UCA1CTL1 |= UCSWRST; 
UCA1CTL1 |= UCSSEL__SMCLK ;
UCA1BR0 = 9; 
UCA1BR1 = 0;

UCA1MCTL = UCBRS_0;

UCA1CTL1 &= ~UCSWRST; 

int k=0;

sprintf(buffer,"\r\n%d",SavedADC12MEM1);

while(buffer[k])
{
while(!(UCA1IFG&UCTXIFG));
UCA1TXBUF = buffer[k++];
}

while(!(UCA1IFG&UCTXIFG)); 
UCA1TXBUF='\n';

while(!(UCA1IFG&UCTXIFG)); 
UCA1TXBUF='\r';

__bic_SR_register_on_exit(LPM0_bits);
}

void adcInit(void)
{
P6SEL |= BIT7; 
P6DIR &= ~BIT7;

REFCTL0 |= REFMSTR+REFVSEL_2+REFON+REFTCOFF; 

ADC12CTL0 = ADC12ON + ADC12SHT0_10 + ADC12MSC; 
ADC12CTL1 = ADC12SHP + ADC12CONSEQ_2 + ADC12SSEL_3 + ADC12DIV_1 ; 
ADC12CTL2 = ADC12RES_2; 

ADC12MCTL0 = ADC12INCH_7+ ADC12SREF_1;
ADC12IE = BIT0;
}

void adcfunction(void)
{
ADC12CTL0 |= ADC12ENC | ADC12SC;

__bis_SR_register(LPM0_bits+GIE);
__no_operation();
}


int main(void)
{
WDTCTL = WDTPW + WDTHOLD; 
adcInit();
while(1) 

adcfunction();

__bis_SR_register(LPM0_bits+GIE);

}

}

  

MSP430F5342: USCI Auto-baud detection with IrDA?

$
0
0

Part Number:MSP430F5342

This project uses the USCI with IrDA and we would like to know if it is possible to use auto-baud detection in this mode.  I inconsistently see baud rate register divider (UCAxBR0) get updated, but the register gets updated to a value 1/2 of what we would expect.  A majority of the time, the baud rate is not changed.  In our implementation a 1 bit is high for the entire bit period, but a 0 bit is low for 1/2 a bit period, so it performs what I would call return to 1.  I wondering if this is causing an issue for the auto-baud detection.  Further, I never see the break bit (UCBR) get set.  Should we see this bit get set if the auto-baud detection is working correctly?

Question 1: Does auto-baud rate detection work with IrDA?

Question 2: If the answer to question 1 above is yes, is there something about our implementation that would indicate auto-baud detection won't work for us?

Thank you

Compiler/EVM430-F6779: Help with THD measurements

$
0
0

Part Number:EVM430-F6779

Tool/software: TI C/C++ Compiler

Dear all,

We are using EVM430-F6779 for power metering applications. Although we are getting correct values for Voltage, Current and power, we are facing issues with the VTHD and ITHD measurements. The raw value we are getting for ITHD measurements are 12217. We are unable to interpret the value. Could you please provide support in interpreting this value. Below are the details we are using for the code and application.

Code: TIDM-THDREADING

THD Measurement: IEC_THD_F_SUPPORT

Appliance: Variable Frequency Drives

Code snippet for the THD calculation (Using the default code and no changes were made, File name: metrology-foreground.c)

x = (int64_t) phase->readings.fundamental_V_rms*phase->readings.fundamental_V_rms;
    y = (int64_t) phase->readings.V_rms*phase->readings.V_rms;
    /* Prevent tiny errors in x and y from leading to tiny negative values for THD */
    if (x >= y)
        return 0;
    z = y - x;
#if defined(IEC_THD_F_SUPPORT)
    z = isqrt64(z);
    z /= phase->readings.fundamental_V_rms;
    z *= 10000;
    y = z >> 32;
#endif

Kindly let us know if any information is needed.

MSP430F2619: MSP watchdog interrupt is not enabled but trigger unexpectedly (should cause a device reset instead)

$
0
0

Part Number:MSP430F2619

Hi,

We are running a MSP430F2619 with the watchdog enabled to trigger a reset if not acknowledged.
But we occasionally get a unexpected watchdog interrupt (int26 from address 0FFF4h).

The watchdog is configured like this:

  • WDTHOLD: Watchdog timer+ is running
  • WDTNMIES: NMI on rising edge
  • WDTNMI: Reset function
  • WDTTMSEL: Watchdog mode
  • WDTSSEL: Use ACLK (ACLK speed: 8192 Hz)
  • WDTISx: interval: Watchdog clock source /32768 (4 seconds)

When we are reading registers in that interrupt, we see that:

  • WDTCTL = 0x6904 => the watchdog is still in watchdog mode
  • IFG1 = 0x08 => WDTIFG is not set but a unknown bit is set
  • IE1 = 0x0C => WDTIE is not set but unknown bits are set
  • IFG2 = 0x08 => UCB0TXIFG is set (but the corresponding interrupt is not enabled, we don't use that interrupt)
  • IE2 = 0x00
  • UC1IFG = 0x0A => UCB1TXIFG and UCA1TXIFG are set but only UCB1TXIFG interrupt is enabled
  • UC1IE = 0x0C => UCB1TXIFG and UCB1RXIFG enabled

We use USCI_B1 as a I2C slave and that I2C is running actively while the watchdog interrupt occurs.

So we have a watchdog interrupt but it shouldn't trigger as it is not enabled.

We were also able to ensure that:

  • With the stack data, we found that the watchdog interrupt was called 3/3 times just after a code block that had disabled UCB1TXIFG and UCB1RXIFG interrupts. the watchdog interrupt trigger just after enabling these UCB1TXIFG and UCB1RXIFG interrupts.
  • The stack data shows us that the watchdog interrupt handler is called in an interrupt context (SR and PC appear in the stack were they should be when an interrupt is triggered) and not directly from the main code.
  • The UCB1TXIFG interrupt wasn't called just before the watchdog interrupt (that interrupt does not call the watchdog interrupt handler) (we used a global variable set in the UCB1TXIFG handler to check this).
  • When dumping the UC1IFG register 3 instructions before the watchdog interrupt triggers, we see that bit 4 is changed from 1 to 0 while this bit is declared as unused in the datasheet :
  • Before watchdog interrupt: UC1IFG = 0x1A
  • Inside watchdog interrupt: UC1IFG = 0x0A
  • The MSP never showed issues like random execution, the PC register does not seems to be corrupted someway. We don’t use function pointers nor use the address of the watchdog interrupt handler.

So after investigation, it seems the watchdog interrupt handler is really triggered by a real watchdog interrupt from the MSP itself.

So we have questions about the MSP behavior:

  • Is there any (maybe not documented ?) condition for the watchdog interrupt to trigger even if it is disabled and the watchdog is not in interval timer mode ?
  • What does mean the bit 4 of UC1IFG ? When it is set to 1, and when it is reset to 0 ?
  • What does mean the bit 3 of IFG1 and IE1 ? If it were a valid interrupt it would mean that it is both enabled and triggered, but here that bit is not documented.
  • We don’t think the watchdog counter reach its trigger value when the interrupt appear. Is there a way to retrieve the watchdog counter value or to check that ?
    • We though to run a timer in parallel with the same configuration as the watchdog but did not do this yet.
    • According to errata USCI27, it is possible that the MSP set arbitrary PC to an arbitrary value. We are also using I2C. Could that watchdog interrupt be a consequence of that errata ? (this require PC to not be so arbitrary as it always run from the start of the watchdog handler)

Thanks for your help.

Regards,
Alexis Murzeau

 


Compiler/MSP430F5529: UART problem with Timer

$
0
0

Part Number:MSP430F5529

Tool/software: TI C/C++ Compiler

hello,

im using msp430f5529, Im facing a strange problem where i use UART to send data to ESP8266 wifi module and also receive the same.

my question is while transmitting and receiving data through uart it work properly. but when i used timer in between any function, my transmitting part get stopped when using timer.

my timer is approx 60 sec delay, i.e. my transmitting process holds for 60 sec when timer runs and after that when my timer get suspend the uart start sending data properly.

As we all know our msp430f is a multitasking controller, so why we are facing this problem?

please help me.

here im attatching some uart function and timer function.

//////////// timer function //////////////
void timer()
{
  P4OUT|=BIT0;/// GREEN
  P4OUT&=~BIT1;

  TBCCTL0 = CCIE;                           // TBCCR0 interrupt enabled
  TBCCR0 = 65534;
  TBCTL = TBSSEL_1 + MC_3 + TBCLR;          // SMCLK, upmode, clear TBR

  __bis_SR_register(LPM0_bits + GIE);       // Enter LPM0, enable interrupts
}
//////////////////////// timer interrupt ////////////////////////
#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
#pragma vector=TIMERB0_VECTOR
__interrupt void TIMERB0_ISR (void)
#elif defined(__GNUC__)
void __attribute__ ((interrupt(TIMERB0_VECTOR))) TIMERB0_ISR (void)
#else
#error Compiler not supported!
#endif
{
    if(count_1==5)
    {
        TBCTL &=~ MC_3;
        P4OUT&=~BIT0;   /// GREEN
        count_1=0;

        __bic_SR_register_on_exit(LPM0_bits + GIE);
    }
    count_1++;
}

////////////////////////////////////// UART SEND ////////////////////////////////////////
void send_uart(char *addr)
{
unsigned int i;
__disable_interrupt();
unsigned int size =strlen(addr);
for(i=0;i<size;i++)
{
while(!(UCA0IFG & UCTXIFG));
UCA0TXBUF = addr[i];
}
__enable_interrupt();
}

//////////////////////////////////UART INTERRUPT///////////////////////////////////////
#if defined(__TI_COMPILER_VERSION__)|| defined(__IAR_SYSTEMS_ICC__)
#pragma vector=USCI_A0_VECTOR
__interrupt void USCI_A0_ISR(void)
#elif defined(__GNUC__)
void__attribute__((interrupt(USCI_A0_VECTOR))) USCI_A0_ISR (void)
#else
#error compiler not supported!
#endif
{
switch(__even_in_range(UCA0IV,4))
{
case 0:break;
case 2:
//while(!(UCA0IFG&UCTXIFG));

*tx= UCA0RXBUF;
tx++;



break;

case 4:break;
default:break;
}
}

MSP430FR6989: Getting fatal error assert.h no file or directory on energia when running u8g2 128x64 lcd library for ST7567.

$
0
0

Part Number:MSP430FR6989

hello,

Ive been trying to interface an 128x64 lcd driven by ST7567 using u8g2 library on msp432p401r on energia thanks to this post it worked like a charm ("https://e2e.ti.com/support/microcontrollers/msp430/f/166/p/764653/2830247?tisearch=e2e-sitesearch&keymatch=u8g2#2830247"). But now i tried the same code with MSP430FR6989 same code same display but only changed the board . its says fatal error assert.h no such file or directory i used the hello world code full buffer. Can any body help me out with this.  

CCS/MSP430FR5962: Exit LPM3.5 only works with debugger attached

$
0
0

Part Number:MSP430FR5962

Tool/software: Code Composer Studio

Hi, I have an application requiring LPM3.5 with wakeup from RTC and external Interrupt on Port1. Everything works quite fine as long as the application is run with the debugger attached. I measure some analog voltage and a comperator input is used to start LPM3.5 (disable all peripherals, enable RTC event, enable Port 1 interrupt).

During normal operation the UART is used to communicate with the device as well as some port pins are connected to LED. Running the application from debugger, LPM enter and exit work quite fine and I see as reset reason in status registers the LPM.5 exit. If I start the application from debugger, disconnect the debug session (application still running and working as expected), and enter LPM 3.5 there is no way to reactivate the device with the port interrupt.

What is the difference in the HW if debugger is connected or disconnected and what could be a solution to my problem? An hints wellcome.

Best regards

Christin

CCS/MSP-TS430DA38: MSP430F2252

$
0
0

Part Number:MSP-TS430DA38

Tool/software: Code Composer Studio

HI SIR,

i am used i2c sample code(MSP430f2252) from TI Resource explorer using interrupt... Its possible for without interrupt in I2C? using msp430f2252. if possible can you give sample code...

thanking you

Siranjeevi.M

MSP430FR5989: FRAM correctable and un-correctable error detection checks

$
0
0

Part Number:MSP430FR5989

Hi ,

is there a way for the application to read a location on the device that could cause a voluntary correctable and un-correctable error for the application to do a run time check on the error handling mechanisms (both HW and SW)?

Or is there a way to corrupt a fixed location in FRAM to cause a correctable and uncorrectable error when it is read?

I'm looking for a way to implement something that could test our error handling in application.

Best Regards

Santosh Athuru

Viewing all 22733 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>