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

msp430 clock module

$
0
0

Dear All

i am trying to learn msp430g2553  i have a basic question ,


how to route the internal clock generated to an output pin for testing the frequency


DAC161S997EVM Debug ISSUE

$
0
0

Hi

I am having trouble programming the MSP430G2553 ucontroller on the DAC161S997EVM board. I started to write some code to toggle the LEDs and setup ADC on the uC. I programmed the EVM via the JTAG using a MSP-FET430UIF tool. My project was running along smoothly as gradually started to build up the code, adding feature by feature. I reached a point yesterday where I was ready to start testing the DAC on the EVM. This is programmed via the uC over the SPI comms. I added the code below to setup the SPI comms on the MSP430G2553 on the DACEVM.

void SPI_Initialise(void)                                                      
{
  P2OUT |= BIT0;
  P1SEL = BIT5 | BIT6 | BIT7;
  P1SEL2 = BIT5 | BIT6 | BIT7;

  UCB0CTL1 = UCSWRST;
  UCB0CTL0 |= UCCKPH + UCMSB + UCMST + UCSYNC; // 3-pin, 8-bit SPI master
  UCB0CTL1 |= UCSSEL_2; // SMCLK
  UCB0BR0 |= 0x02; // /2
  UCB0BR1 = 0; //
  UCB0CTL1 = ~UCSWRST; // **Initialize USCI state machine**
}

After adding this I downloaded and debugged the code to the uC on the EVM. I am now unable to write any new code to the uC. Everytime I attempt to download the code (IAR) I get the fllowing error

Wed Jun 15, 2016 09:32:08: Security Fuse has been blown : (OpenDevice) , Device=MSP430G2xx3, PwLength=0x0

Wed Jun 15, 2016 09:32:09: Fatal error: Could not find device (or device not supported)   Session aborted!

Now I am fairly new to MSP430's and this is the first time I have used this DAC161S997EVM, but would I be correct in assuming this issue is to do with the fact that the SPI comms lines are shared with the JTAG pins? This makes sense as the code loaded first time (after the addition of the SPI setup) but hasn't been able to communicate since.

Are there any other reasons why the security fuse would blow? I was reading that it is usually to do with a timeout issue, which again points to the shared JTAG/SPI lines.

I am new to this so please be kind, but I can't understand why the JTAG lines would be shared with SPI lines needed to communicate with the on board DAC? If that is the reason ofc for my issues

Any help would be appreciated

 

Dave

Msp432 interfacing with kentec4.3'' display issue

$
0
0

Hello;

Sir;

This is Pratik Debnath working on Msp432p401r ...Recently I have finished with Kentec3.5'' display(BOOSTXL-K350QVG-S1) using Grlib example given in Mspware...

Now I am trying to interface msp432 with Kentec4.3'' display(k430wqc_v3_ff) in 8bit mode....I have downloded its library from ek-tm4c123gxl-boost-l35...I have edited the files I have downloaded Kentec480x272x16_SSD1963_8bit.c and Kentec480x272x16_SSD1963_8bit.h...

But I am not able to get any display output...Though I dont have any backlight driver I used BOOSTXL-K350QVG-S1 backlight driver to test that 4.3'' display is working or not and it's backlight is working..

Sir please varify my code with wiring diagram I have attached and correct me where I am worng..

Please help me...Please ..

Regards

Pratik Debnath

8655919874(Please visit the site to view this file)

Micro controller and Microprocessor

$
0
0

what is the difference between Micro controller and Microprocessor?

microcontroller

$
0
0

dear all

what is the maximum supply voltage of msp 430

msp 430 code for blinking led

$
0
0

hi i am new in using msp430 launchpad anybody give the ccs code

How to Implement a software timer on msp430 ?

$
0
0

Hello,

I would like to know how to implement and use a Software timer on msp430.

I've been using msp430f5529

Thank You

MAVRK source code

$
0
0

I can not get the source code of the MAVRK from the server for it is not active.so anyone can share it with me.


/* ABORT - ABNORMAL PROGRAM TERMINATION. CURRENTLY JUST HALTS EXECUTION. */

$
0
0

Hello

I am talking to an IMU (BNO05) via MSP430 launchpad. they are connected via the UART. Below is the code that I use to read the acceleration data. However, when I press the pause
buttom then I get ABNORMAL PROGRAM TERMINATION, given that I am getting the data. Why is that? is it because I am using the __bic_SR_register_on_exit(LPM0_bits); in the
RX ISR and __bic_SR_register_on_exit(LPM3_bits+GIE); in the main?

Another question:

If I used while(1) in the main as below, i.e., no __bis_SR_register(LPM0_bits); in the RX ISR, then how will the program leave the ISR (based on what condition)?


Thank you

#include "msp430g2553.h"
char xLSB;
char xMSB;
char yLSB;
char yMSB;
char zLSB;
char zMSB;
typedef struct uart                        // UART
{   char *bufTXpnt;                        // UART TX buffer pointer
    unsigned int TXbuflen;                  // the lenght of TX block
    char *bufRXpnt;                       // UART RX buffer pointer

    unsigned int RXbuflen;                  // the lenght of RX block
    char TXbuffer[20];
    char RXbuffer[20];
} uartstruct;

   void setMSP430Pins() {
	   	   //--------- Setting the UART function for P1.1 & P1.2 --------//

	         P1SEL  |=  BIT1 + BIT2;  // P1.1 UCA0RXD input
	         P1SEL2 |=  BIT1 + BIT2;  // P1.2 UCA0TXD output
	         return;
   }

   void set_UCS() {
	   //------------------- Configure the Clocks -------------------//

	  //   DCOCTL  = 0;             // Select lowest DCOx and MODx settings
	     BCSCTL1 = CALBC1_12MHZ;   // Set range
	     DCOCTL  = CALDCO_12MHZ;   // Set DCO step + modulation

   }

void uart_init(void){
  IE2 &= ~(UCA0TXIE | UCA0RXIE | UCB0TXIE | UCB0RXIE); // Disable all USCIx0 TX & RX interrupts
  UCA0CTL1|=UCSWRST;   
  UCA0CTL1|= UCSSEL_2; 
   //------------ Configuring the UART(USCI_A0) ----------------//
    // 115200 BAUD, CLK=12MHz
    		  UCA0BR0 = 6; //this is working
    		  UCA0BR1 = 0; //this is working
    		//*ours: UCBRF = 8, UCBRS = 0, UCOS16 = 1
    		  // UCBRF = 11, UCBRS = 0, UCOS16 = 1
    		  // BITS| 7 6 5 4 | 3 2 1  |   0    |
    		  // UCAxMCTL = | UCBRFx  | UCBRSx | UCOS16 |
    		  UCA0MCTL = 0x81; //this works fine

    UCA0CTL1 &= ~UCSWRST;             // Clear UCSWRST to enable USCI_A0-UART

  IFG2 |= UCA0TXIFG;            // preset IFG flag always left on

  IE2|=UCA0RXIE; 
}

#define   TXSTRING(pnt) (TXdata((pnt), sizeof(pnt)-1)) // cool macro to get string and string len
uartstruct uart;                 // declare a struct from typedef uartstruct

void TXdata( char* pnt, unsigned int len){
  uart.bufTXpnt = pnt;
  uart.TXbuflen = len;
  uart.bufRXpnt = uart.RXbuffer;         // reset it to beginning of ram buffer

  IE2 |= UCA0TXIE + UCA0RXIE;            // enable USCI_A0 TX & RX interrupt

}

//¦----------------------------- US0TX ISR  ---------------------------------------¦
#pragma vector=USCIAB0TX_VECTOR
__interrupt void USCIAB0TX(void)                    // Shared A0/B0 TX IRQ vector
{
  if (IFG2 & UCA0TXIFG){                            // check for UART TX

    if (uart.TXbuflen){                               // if not zero
      UCA0TXBUF = *uart.bufTXpnt++;
      --uart.TXbuflen;
    }
    else IE2 &= ~UCA0TXIE;                          // suspend IE if zero
  }
  else IFG2 &= ~UCA0TXIFG;                          // clear a false UCB0 trigger
}

//¦----------------------------- US0RX ISR  ---------------------------------------¦
#pragma vector=USCIAB0RX_VECTOR
__interrupt void USCIAB0RX(void)                     // A0/B0 RX IRQ vector
{
 if (IFG2 & UCA0RXIFG){                              // check for UART RX

   *uart.bufRXpnt++ = UCA0RXBUF;                     // copy data byte
   if (uart.bufRXpnt == uart.RXbuffer+8 && uart.RXbuffer[0]==0xBB)           // got 8 bytes in yet?  <<<<
	   uart.RXbuflen=uart.RXbuffer[1];
   __bic_SR_register_on_exit(LPM0_bits);   // wakeup main              <<<<
     
  }
 else IFG2 &= ~UCA0RXIFG;
}

//¦----------------------------- Main  -------------------------------------------¦
void main(void) {
	WDTCTL = WDTPW + WDTHOLD; // Stop the Watch dog
	setMSP430Pins();
	set_UCS();
	uart_init();

//    The following is OK to get the sensors activated and getting the data

	TXSTRING("\xAA\x00\x3E\x01\x00");      // Normal Power mode
	
	TXSTRING("\xAA\x00\x3D\x01\x07");    // Send this to the BNO055 to set up the AMG mode
	TXSTRING("\xAA\x01\x08\x06");
    	__bis_SR_register(LPM3_bits + GIE);

}



#include "msp430g2553.h"
char xLSB;
char xMSB;
char yLSB;
char yMSB;
char zLSB;
char zMSB;
typedef struct uart                        // UART
{   char *bufTXpnt;                        // UART TX buffer pointer
    unsigned int TXbuflen;                  // the lenght of TX block
    char *bufRXpnt;                       // UART RX buffer pointer

    unsigned int RXbuflen;                  // the lenght of RX block
    char TXbuffer[20];
    char RXbuffer[20];
} uartstruct;

   void setMSP430Pins() {
	   	   //--------- Setting the UART function for P1.1 & P1.2 --------//

	         P1SEL  |=  BIT1 + BIT2;  // P1.1 UCA0RXD input
	         P1SEL2 |=  BIT1 + BIT2;  // P1.2 UCA0TXD output
	         return;
   }

   void set_UCS() {
	   //------------------- Configure the Clocks -------------------//

	  //   DCOCTL  = 0;             // Select lowest DCOx and MODx settings
	     BCSCTL1 = CALBC1_12MHZ;   // Set range
	     DCOCTL  = CALDCO_12MHZ;   // Set DCO step + modulation

   }

void uart_init(void){
  IE2 &= ~(UCA0TXIE | UCA0RXIE | UCB0TXIE | UCB0RXIE); // Disable all USCIx0 TX & RX interrupts
  UCA0CTL1|=UCSWRST;   
  UCA0CTL1|= UCSSEL_2;  
   //------------ Configuring the UART(USCI_A0) ----------------//
    // 115200 BAUD, CLK=12MHz
    		  UCA0BR0 = 6; //this is working
    		  UCA0BR1 = 0; //this is working
    		//*ours: UCBRF = 8, UCBRS = 0, UCOS16 = 1
    		  // UCBRF = 11, UCBRS = 0, UCOS16 = 1
    		  // BITS| 7 6 5 4 | 3 2 1  |   0    |
    		  // UCAxMCTL = | UCBRFx  | UCBRSx | UCOS16 |
    		  UCA0MCTL = 0x81; //this works fine

    UCA0CTL1 &= ~UCSWRST;             // Clear UCSWRST to enable USCI_A0-UART

  IFG2 |= UCA0TXIFG;            // preset IFG flag always left on

  IE2|=UCA0RXIE;  ///today added
}

#define   TXSTRING(pnt) (TXdata((pnt), sizeof(pnt)-1)) // cool macro to get string and string len
uartstruct uart;                 // declare a struct from typedef uartstruct

void TXdata( char* pnt, unsigned int len){
  uart.bufTXpnt = pnt;
  uart.TXbuflen = len;
  uart.bufRXpnt = uart.RXbuffer;         // reset it to beginning of ram buffer

  IE2 |= UCA0TXIE + UCA0RXIE;            // enable USCI_A0 TX & RX interrupt

}

//¦----------------------------- US0TX ISR  ---------------------------------------¦
#pragma vector=USCIAB0TX_VECTOR
__interrupt void USCIAB0TX(void)                    // Shared A0/B0 TX IRQ vector
{
  if (IFG2 & UCA0TXIFG){                            // check for UART TX

    if (uart.TXbuflen){                               // if not zero
      UCA0TXBUF = *uart.bufTXpnt++;
      --uart.TXbuflen;
    }
    else IE2 &= ~UCA0TXIE;                          // suspend IE if zero
  }
  else IFG2 &= ~UCA0TXIFG;                          // clear a false UCB0 trigger
}

//¦----------------------------- US0RX ISR  ---------------------------------------¦
#pragma vector=USCIAB0RX_VECTOR
__interrupt void USCIAB0RX(void)                     // A0/B0 RX IRQ vector
{
 if (IFG2 & UCA0RXIFG){                              // check for UART RX

   *uart.bufRXpnt++ = UCA0RXBUF;                     // copy data byte
   if (uart.bufRXpnt == uart.RXbuffer+8 && uart.RXbuffer[0]==0xBB)           // got 8 bytes in yet?  <<<<
	   uart.RXbuflen=uart.RXbuffer[1];

  }
 else IFG2 &= ~UCA0RXIFG;
}

//¦----------------------------- Main  -------------------------------------------¦
void main(void) {
	WDTCTL = WDTPW + WDTHOLD; // Stop the Watch dog
	//uart.RXbuflen=8;
	setMSP430Pins();
	set_UCS();
	uart_init();

while(1){

//    The following is OK to get the sensors activated and getting the data


	TXSTRING("\xAA\x00\x3E\x01\x00");      // Normal Power mode
	
	TXSTRING("\xAA\x00\x3D\x01\x07");    // Send this to the BNO055 to set up the AMG mode

	TXSTRING("\xAA\x01\x08\x06");

    	__bis_SR_register(LPM3_bits + GIE);

	}
}

CC430 external 32KHz crystal configuration

$
0
0

Hi,

I'm trying to configure the clock with an external 32KHz crystal. Here is the code

 /* Configure CPU clock for 16MHz */

	// Initialize LFXT1

	P5OUT &= 0x03;
	P5DIR &= ~(BIT0 + BIT1);

	P5SEL |= 0x03;								// Select XT1
	UCSCTL6 |= XCAP_3;							// Internal load cap

	// Loop until XT1 fault flag is cleared
	do {
		UCSCTL7 &= ~XT1LFOFFG;				  	// Clear XT1 fault flags
	} while (UCSCTL7 & XT1LFOFFG);			   	// Test XT1 fault flag

	__bis_SR_register(SCG0);				  	// Disable the FLL control loop
	UCSCTL0 = 0x0000;                       // Set lowest possible DCOx, MODx
	UCSCTL1 = DCORSEL_5;                    // Select DCO range 16MHz operation
	UCSCTL2 = FLLD__1 | 487; 				// Set FLL loop divider to 2 and
											// required DCO multiplier
	__bic_SR_register(SCG0);				  	// Enable the FLL control loop

	// Worst-case settling time for the DCO when changing the DCO range bits is:
	// 32 x 32 x MCLK / ACLK
	__delay_cycles(((32 * 16 * 1000000) / 0x8000) * 32);

	// Loop until XT1,XT2 & DCO fault flag is cleared
	do {
		UCSCTL7 &= ~(XT2OFFG + XT1LFOFFG + XT1HFOFFG + DCOFFG);
		// Clear XT2,XT1,DCO fault flags
		SFRIFG1 &= ~OFIFG;					  // Clear fault flags
	} while (SFRIFG1 & OFIFG);				   // Test oscillator fault flag

I have ACLK (sourced by XT1 as default) clock output on one of the output pins and I can measure the clock frequency with a scope. I have two issues:

1. The frequency doesn't seems to be very stable as I would expect from a clock crystal with 20ppm. The scope is giving me alternate values 32.67-32.78 KHz

2. As you may notice I'm using internal load caps :

UCSCTL6 |= XCAP_3;

which gives 12pF load. The crystal needs 12.5pF, I assume it's still correct since the parasitic capacitance could vary anyway. The problem is that if I change in the code XCAP_3 with XCAP_0 (which gives 2pf load instead of 12) nothing seems to happen. I would expect that the measured frequency gets a significant change. Is it something wrong with the code?

P.S. I don't have external capacitors mounted. My understanding is that if the crystal asks 12.5 pf load capacitance I can use the internal capacitance that gives me 12pf so no external capacitors are needed,

Thanks,

Dragos

msp430 f5529 adc12 with timerb trigger

$
0
0

hi,

I am a newcomer to msp430 platform.I am trying to implement  a project in which timerb0 controls sampling sequence of adc12.

Timerb0 works in upmode and in the first half of the period a pulse is generated and when CCR1 hits the half period pulse is stopped.

What I want to do is start sampling after  certain clock cycles when the pulse is stopped.Following is my code.My problem is adc12 isr is never triggered .

void main(void){
WDT_A_hold(WDT_A_BASE);
isPulseHigh=false;
initPorts();
initAdc12();
initPwm();
while(1)
{
// Enable GIE
__bis_SR_register(LPM0_bits+GIE);
__no_operation();
}
}
void initPorts(){
PULSE_PORT_DIR = BIT0+BIT2;                       
PULSE_PORT_OUT=BIT0+BIT2;
}
void initPwm(){
//Set up Timer B in continuous mode for multiple time base PWMs
 TBCCTL0 =OUTMOD_4+CCIE;               
 TBCCTL1 =OUTMOD_4 + CCIE;              
 TBCCTL2 =OUTMOD_4 + CCIE;               
 TBCCTL3 = OUTMOD_4 + CCIE;               
 
 TBCCR0=200;   /
 TBCCR1=100;
 TBCCR2=110;
 TBCCR3=120;
 TBCTL = TBSSEL_2 + MC_1 + TBIE;
__bis_SR_register(LPM0_bits + GIE);     
__no_operation();                        
}
void initAdc12(){
P6SEL |= 0x01;                            // Enable A/D channel A0
ADC12CTL0 = ADC12ON+ADC12SHT0_8+ADC12MSC; // Turn on ADC12, set sampling time
// set multiple sample conversion
ADC12CTL1 = ADC12SHP+ADC12CONSEQ_2;       // Use sampling timer, set mode
ADC12IE = 0x01;                           // Enable ADC12IFG.0
//ADC12CTL0 |= ADC12ENC;                    // Enable conversions
//ADC12CTL0 |= ADC12SC;                     // Start conversion
__bis_SR_register(LPM0_bits + GIE);       // Enter LPM4, Enable interrupts
   __no_operation();
}
void startConversion(){
ADC12CTL0 &= ~ADC12ENC;
ADC12IE = 0x01;                           // Enable ADC12IFG.0
ADC12CTL0 |= ADC12ENC;                    // Enable conversions
ADC12CTL0 |= ADC12SC;                     // Start conversion
}
void stopConversion(){
ADC12CTL1&= ~ADC12CONSEQ_2;
ADC12CTL0 &= ~ADC12ENC;
ADC12CTL0 |= ADC12ENC;
}
#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
#pragma vector=ADC12_VECTOR
__interrupt void ADC12ISR (void)
#elif defined(__GNUC__)
void __attribute__ ((interrupt(ADC12_VECTOR))) ADC12ISR (void)
#else
#error Compiler not supported!
#endif
{
  static unsigned char index = 0;
  switch(__even_in_range(ADC12IV,34))
  {
  case  0: break;                           // Vector  0:  No interrupt
  case  2: break;                           // Vector  2:  ADC overflow
  case  4: break;                           // Vector  4:  ADC timing overflow
  case  6:                                  // Vector  6:  ADC12IFG0
    results[index] = ADC12MEM0;             // Move results
    index++;                                // Increment results index, modulo; Set Breakpoint1 here
    if (index == 8)
    {
      index = 0;
    }
    __bic_SR_register_on_exit(LPM0_bits+GIE);
    break;
  case  8: break;                           // Vector  8:  ADC12IFG1
  case 10: break;                           // Vector 10:  ADC12IFG2
  case 12: break;                           // Vector 12:  ADC12IFG3
  case 14: break;                           // Vector 14:  ADC12IFG4
  case 16: break;                           // Vector 16:  ADC12IFG5
  case 18: break;                           // Vector 18:  ADC12IFG6
  case 20: break;                           // Vector 20:  ADC12IFG7
  case 22: break;                           // Vector 22:  ADC12IFG8
  case 24: break;                           // Vector 24:  ADC12IFG9
  case 26: break;                           // Vector 26:  ADC12IFG10
  case 28: break;                           // Vector 28:  ADC12IFG11
  case 30: break;                           // Vector 30:  ADC12IFG12
  case 32: break;                           // Vector 32:  ADC12IFG13
  case 34: break;                           // Vector 34:  ADC12IFG14
  default: break;
  }
}
// Timer B0 interrupt service routine
#pragma vector=TIMERB0_VECTOR
__interrupt void TIMERB0_ISR (void)
{
PULSE_PORT_OUT=BIT0+BIT2;
__bic_SR_register_on_exit(LPM0_bits+GIE);
}
// Timer_B1 Interrupt Vector (TBIV) handler
#pragma vector=TIMERB1_VECTOR
__interrupt void TIMERB1_ISR(void)
{
switch(__even_in_range(TBIV,14))
{
case 0: break;
case 2:
PULSE_PORT_OUT ^=BIT0;     //Pulse is stopped
__bic_SR_register_on_exit(LPM0_bits+GIE);
break;
case 4:                                            //Here conversion should  start
PULSE_PORT_OUT ^=BIT2;
startConversion();
__bic_SR_register_on_exit(LPM0_bits+GIE);
break;
case 6:
stopConversion();        //Here conversion should  stop
__bic_SR_register_on_exit(LPM0_bits+GIE);
break;
case 14:
break;
default: break;
}
}

Can I load a text file into unused flash?

$
0
0

I would like to load a text file into unused flash in an MSP430F5529. The text file is intended to serve as documentation for the device, which can send it out a serial port on demand. It seems like converting the text and downloading it in TI-TXT format would be an easy way to do this, but I haven't found a way to do it. Is anything like this possible? 

MPPT based battery charging profile management using msp430g2553

$
0
0

Hi,

I am in process of implementing MPPT based charge controller and thus have gone through the TI reference design PMP7605.

Some part of the code used in reference design is NOT clear to me.

I am using lead acid battery and normally these types of battery should be charged in 3 steps.

<1> Constant Current  <2> Constant Voltage and <3> Reduced Constant voltage i.e. Float charge

Switching from one mode to other depends on threshold voltage and type of battery used.

MPPT Part is clear to me but once battery threshold is reached for 2nd step, i am feeling difficulty in understanding the code for 2nd and 3rd step as i am NOT able to correlate it with the theory.

Code is written below:


/**********************Needs to be changed with different Batteries************************************/
unsigned int CC_LIMIT = 300;                                            // 210 - 10A, 300 - 15A, 350 - 20A
unsigned int CC_TO_CV_LIMIT = 305 ;                          // 305 - 14.2 , 610 - 28.4
unsigned int FLOAT_VOLTAGE = 295 ;                          // 295 - 13.8 , 590 - 27.6
unsigned int BATTERY_CUTOFF = 220 ;                        // 220 - 10.2 , 440 - 20.4
unsigned int BATTERY_RECONNECT = 240;               // 240 - 11.2 , 480 - 22.4
/******************************************************************************************************/

/* Once CC limit or CC_To_CV_limit are exceeded,variable MPPT_Loop is reset and there after this function will be called instead of MPPT function
* Here duty is adjusted such that CC_Limit,CC_To_CV_Limit,Float voltage are all maintained according to the battery state */


void Battery_Charge_Profiling (void)
{
if ((Battery_Voltage <= CC_TO_CV_LIMIT)&& (!CV_Mode_ON))
{

if (Battery_Current < CC_LIMIT)
{
Duty--;
if (Duty < 30)
{
Duty = 30;

CC_Loop_Exit_Counter ++;
if (CC_Loop_Exit_Counter > LOOP_EXIT_LIMIT)
{
MPPT_Loop = 1;
MPP_Loop_Exit_Counter = 0;
CC_Loop_Exit_Counter = 0;
POB_Direction = 1;
Duty = 210;
}
}


}
else
{
Duty ++;
if (Duty > 680) Duty = 680;
CC_Loop_Exit_Counter = 0;
}

}
else
{
CV_Mode_ON = 1;
Charging_Voltage_Reqd = CC_TO_CV_LIMIT;

if (Battery_Voltage < Charging_Voltage_Reqd)
{
Duty--;
if (Duty < 30) Duty = 30;
}
else
{
Duty ++;
if (Duty > 680) Duty = 680;

}

if (Battery_Voltage < FLOAT_VOLTAGE - 20)
{
CC_Loop_Exit_Counter ++;
if (CC_Loop_Exit_Counter > LOOP_EXIT_LIMIT)
{
MPPT_Loop = 1;
MPP_Loop_Exit_Counter = 0;
CC_Loop_Exit_Counter = 0;
POB_Direction = 1;
Duty = 210;
}
}
}
}

NOTE: I am NOT able to understand the BOLD part of the code.

Please help.

MSP430G2553 RST short to GND

$
0
0

I've been using the MSP430G2553 for a while without any problems.

Then suddenly it won't come out of reset. Turns out that the RST pin has suddenly a very low impedance to GND. I could still get it out of reset by using the programmer but then after a while the RST pin tied itself hard to GND.

I've replaced the chip with another one which thten worked for a short while. Then the same problem. It's again tied hard to GND.

Any ideas? It's been working fine before for months.

CC430 Timer Capture Mode trapped in ISR

$
0
0

Hi,

I'm using cc430 timer capture mode to do some signal frequency measurement experiments.

I set up TA0 and CCR as following register values:

    TA0CTL|=TACLR+TASSEL__TACLK+ID_0+MC__CONTINUOUS; 
    TA0CCTL2|=CCIS_1+CAP+SCS+CM_1+CCIE;     
    TA0CCTL3|=CCIS_1+CAP+SCS+CM_1+CCIE;     

The Timer input is an external 10MHz clock source, CCR2|CCI2B input is ACLK/2 which is about 16kHz, CCR3|CCI3B input is GDO1 clk, which is about 135kHz.

The interrupt trigger a TA0CCRx register value reading on every 320 captures, which prolonged the measurement period. The interrupt service code is following:

static int Captures=0;
static int Captures1=0;
#define NCAPTURES 320
#define NCAPTURES1 320
#define FACLK 1.027//0.2925
#pragma vector=TIMER0_A1_VECTOR
__interrupt void TimerA(void)
{
//	 TA0CTL|=TACLR;//TASSEL__INCLK+ID_0+MC__CONTINUOUS;
   switch(__even_in_range(TA0IV,8))
   {
      case 4:
             switch(Captures){
             case 0:
                   starttime=TA0CCR2;
                   Captures=NCAPTURES;
                   break;
             case 1:
                   num1=TA0CCR2;
                   TA0CTL|=TACLR;
                   Captures=0;
                   sprintf(buffer1,"1 %lu\n",num1);
		putstr(buffer1); 
                   break;
             default:
                    Captures--;
                    break;

             }
      case 6:
             switch(Captures1){
             case 0:
                   starttime1=TA0CCR3;
                   Captures1=NCAPTURES1;
                   break;
             case 1:
                   num2=TA0CCR3;
                   TA0CTL|=TACLR;
                   Captures1=0;
		sprintf(buffer2,"2 %lu\n",num2);
		putstr(buffer2);                   
                break;
             default:
                    Captures1--;
                    break;

             }
      default:break;
   }
   __bic_SR_register_on_exit(LPM3_bits);


}

When I have only CCR2 enabled and CCR3 disabled, everything works fine. Once I enable CCR3 both capture interrupts works fine but the program trapped in the Timer interrupt and cannot jump back to the main loop. I am wondering why this happened, possible reason might be the frequency of CCR3 input is faster than the system main clock?

Thanks in advance!


EVM430-F6736 Energy meter Slaa517

$
0
0

Hi , 

Regarding to EVM430-F6736 Energy meter, I have a few problem here,

1, I can't use the PC Gui calibration in Slaa517. Any driver need? I using window 7. The Gui Close during open it.

2. Can we use converter rs232 to usb ?

Thanks regard ,

Khidhir

Problem on using MSP430F5635 I2C on UCB0

$
0
0

Hi,

I have a code used in MSP430F5438, I2C reading  FOSX8700 absolutely fine.  Then after I change the chip to MSP430F5635,   It could not even read a byte from 8700.  

I use UCB0 and interrupt.  P2.1 as data and P2.2 as CLK, After MSP430F5438 sent out the I2C address, it do not have the /ACK back from 8700.   However, I also try using Arduino I2C to send same address to 8700 ( same hardware baord), it does able  to get /ACK back.  That mean the 8700 board work fine.  Just  MSP430F5438 seem output high by itself on data bus.  

Wonder if it need special setting in  5438 to let I2C work?   That seem very strange?

Thanks in advance.

return statement inside isr

$
0
0

Hi all,

Do anyone know what happened if we use return statement inside isr.

isr()

{

 some codes..;

 return;

}

Also can we pass any arguments in isr function?

MSP432P401RIRGC availability

$
0
0

Iam designing a profibus PA temperature transmitter and I would like to use MSP432P401RIRGC because it has enough memory that I need and fit in my PCB area. But there is no sample and no date to have it in distribuitor. Can I consider MSP432P401RIRGC in my design to test next month?

Regards

Edson Emboaba

Fluctuation in generating four 20kHz PWM signal at 8Mhz clock

$
0
0

Hi,

I am generating 4 PWM signals of 50% dutycycle and 20kHz frequency using timer A0 and 8Mhz clock to the timer module. But I am getting fluctuation of around 120Hz periodicaly.

I am not able to identify the reason of it. Can any one please suggest a sollution to this problem? Why this is happening?

Below is the part of my code:-

intmain(void)

{

/* Set UCS clock system */

vUcsInitClock(); //ACLK is 8Mhz

P1DIR |= BIT2+BIT3+BIT4+BIT5; // P1.2 and P1.3 output

P1SEL |= BIT2+BIT3+BIT4+BIT5; // P1.2 and P1.3 options select

TA0CCR0 = 399; // PWM Period

TA0CCTL1 = OUTMOD_7; // CCR1 reset/set

TA0CCR1 = 199; // CCR1 PWM duty cycle

TA0CCTL2 = OUTMOD_7; // CCR2 reset/set

TA0CCR2 = 199; // CCR2 PWM duty cycle

TA0CCTL3 = OUTMOD_7; // CCR1 reset/set

TA0CCR3 = 199; // CCR1 PWM duty cycle

TA0CCTL4 = OUTMOD_7; // CCR2 reset/set

TA0CCR4 = 199; // CCR2 PWM duty cycle

TA0CTL = TASSEL_1 + MC_1 + TACLR; // ACLK, up mode, clear TAR

}

Viewing all 21980 articles
Browse latest View live


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