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

MSP430FG477 writing to internal flash only succeeds if I erased the whole segment immediately before

$
0
0

Hello everybody,

I have the problem that I cannot update the content in my internal flash without erasing the whole segment before the write operation. This requires me to store the whole segment beforehand, updating the content in the buffer and then writing back the whole segment.

The segment I am writing to is in information memory defined by (I typecast it to a pointer later):

const static uint16_t FLASH_SEGMENT_1 =         0x1000;

so it should not be a problem with LOCKA.

The functions that I am using are:

// inits the flash
void Internal_Flash::init()
{
	FCTL2 = FWKEY + FSSEL0 + FN1;// + FN3; // FLASH CLK= MCLK/3 = 1200/3 = 400 KHZ : MSP430AFE233
}

// erases a flash segment
void Internal_Flash::erase_sector(uint8_t* const address)
{
	FCTL3 = FWKEY;                      // Clear Lock bit
	FCTL1 = FWKEY + ERASE;              // Set Erase bit
	*address = 0;                // Dummy write to erase Flash seg
	FCTL1 = FWKEY;                            // Clear WRT bit
	FCTL3 = FWKEY + LOCK;             // Set LOCK bit
}

// writes bytes to flash
void Internal_Flash::write(uint8_t* address, const uint8_t* buf, const uint8_t len)
{
//	_DINT();
	// assert that buffer is not too large
	assert(len <= FLASH_SEGMENT_SIZE);

	FCTL3 = FWKEY;                      // Clear Lock bit 
	FCTL1 = FWKEY + WRT;                      // Set WRT bit for write operation
	for (uint8_t i = 0; i < len; i++)
	{
		*address++ = *buf++;          		// Write value to flash
	}

	FCTL1 = FWKEY;                            // Clear WRT bit
	FCTL3 = FWKEY + LOCK;             // Set LOCK bit
//	_EINT();
}

Calling erase_sector() always succeeds, but the write() command only updates the flash if erase_sector() was called before, e.g.:

            // erase flash segment
            int_flash->erase_sector((uint8_t*)Internal_Flash::FLASH_SEGMENT_1);

            // write device name
            int_flash->write((uint8_t*)Internal_Flash::FLASH_SEGMENT_1, "TEST", 4);

I already tried to disable enable interrupts while calling write() and I switched the clock timing for the flash, but nothin seems to work.


Thank you a lot for any help!

Stefan


UART of MSP430F5529

$
0
0

Is data send through UART can be visible in CCS?

Am doing a biomedical project. I want to see the data send through UART of my MSP430. Is it possible to see in CCS window itself???

The value which i have to see is the digitised  version of EEG signal.

Parameter adjustment of CAPTIVATE-PHONE

$
0
0

Dear Sirs:

We have to evaluate placing a 2mm thick acrylic plate on CAPTIVATE-PHONE of the evaluation board.
Sensitivity must not may adjust the parameters.

Would you please advise the adjustment point?

Best regards,
PAN-MARO.

timer

$
0
0

hey , iam new to microcontroller. .  i am using msp430g2553 launchpad . when i try to run basic programs like blinking of led , it works perfectly fine . but when i do this by using timer , it doesn.t work as i desire. even when i tried the sample code  for blinking of led from TI website , it doesn't  works like it should. 

please help

How to correct flash the LED in MSP430F6438 with SPPLEDemo_Lite ?

$
0
0

Hi , I am developing in MSP430F5335 + CC2564 with IAR SPPLEDemo_Lite project.

I use the following code to change the LED state.

void Toggle6438LED(void)
{
    if(P9OUT & BIT4)
        P9OUT &= ~BIT4; 
    else
        P9OUT |= BIT4; 
}

I want to control LED via BLE , for example

1. When I send start command(ex:0x01) to device , it will start flash the LED and change the state to 1 via the following code:

state = 1;

while(state == 1)
{
  Toggle6438LED();
  BTPS_Delay(200);
  Toggle6438LED();
  BTPS_Delay(1200);
}

2. When I send stop command(ex:0x02) to device , it will stop flash the LED via change the state to 0. 

state = 0;

But It doesn't receive the stop command(ex:0x02) after the while loop is running.

It seems the code is blocked by while loop. 

How to correct flash the LED and does not affect the other operation in MSP430F6438 with SPPLEDemo_Lite ?

Thanks in advance.

MSP432 and I2C configuration

$
0
0

Hi, 

I'm using a MSP‑EXP432P401R development board with a booster pack EDU MK II.
I noticed some problem with the example software with the I2C configuration, I had to add some __delay_cycles to make it work.

Someone know why ?

Thank you

After:

/* Initialize I2C communication */
    Init_I2C_GPIO();
    __delay_cycles(10000); // bus busy bug
    I2C_init();
    /* Initialize OPT3001 digital ambient light sensor */
    OPT3001_init();
    __delay_cycles(10000);

Before:

/* Initialize I2C communication */
    Init_I2C_GPIO();

    I2C_init();
    /* Initialize OPT3001 digital ambient light sensor */
    OPT3001_init();
    __delay_cycles(100000);

Configuring the UART(USCI_A0)

$
0
0

Hi

Just would like to make sure that I am setting the MSP4302553 UART to 12 MHZ and 115200 bps. So would you please check this code?

IE2 &= ~(UCA0TXIE | UCA0RXIE | UCB0TXIE | UCB0RXIE); // Disable all USCIx0 TX & RX interrupts
//  UCA0CTL1 = UCSWRST;           // Set UCSWRST (hold USCI in Reset state)
  UCA0CTL1 |= UCSSEL_2;                     // CLK = SMCLK

   //------------ Configuring the UART(USCI_A0) ----------------//
    // 115200 BAUD, CLK=12MHz
    		  UCA0BR0 = 6;
    		  UCA0BR1 = 0;
//    		//*ours: UCBRF = 8, UCBRS = 0, UCOS16 = 1
//    		  // BITS| 7 6 5 4 | 3 2 1  |   0    |
    		  // UCAxMCTL = | UCBRFx  | UCBRSx | UCOS16 |
    		  UCA0MCTL = 0x81; 

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

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

  IE2|=UCA0RXIE;  /

MSP4302553 power consumption

$
0
0

Hello


Is there any reason that makes the MSP430 launchpad to draw 8 mAmp? from the datasheet, the max it can draw is 5 mAMP when running at 16 MHz.

I am connecting the launchpad to the BNO055 via UART. I am running at 12 MHz and 115200 bps.

Can a bug in the code cause such a thing or it may be a hardware connection issue?

Thank you


MSP430G2553 UART and GPIO Register

$
0
0

Hello Team, 

Right now am using MSP430G2553 Launch Pad for my project.

I can able to program a led code using code composer studio v4 from given example. i want  to access a UART of that MSP430G2553 . I cant able to find the register description in user guide of MSP430G2553. kindly provide me doc or link where i can find the document UART and other peripheral register description for MSP430G2553

Conflicting mech. info for RHB package in MSP430i20xx datasheet

$
0
0

There are two sets of mechanical dimensions provided for the RHB (VQFN) package at the end of the datasheet for the MSP430i20xx.  They vary in the max. height and the size of the thermal pad.  Which one is correct?

Thanks,

Scott

MPU9250 and MSP430

$
0
0

Hello all,

I’m running the Embedded MotionDriver 6.12 software on MSP430F6638 processor and communicating with a MPU-9250 via I2C. I’m using the DMP to perform 6-axis fusion and the MPL to add in the compass data for 9-axis fusion. I have several questions about the MPL library.

1) How can I determine the status of the compass calibration? Presumably I need to perform some figure-eight patterns but I don’t know how to perform it
2) Is there any documentation on the MPL functions? There was none included in the MotionDriver 6.12 zip file and the header files don’t have any comments.

Thanks
Samir

(MSP430F5659) ADC12, REF and Accuracy

$
0
0


On page 77 of the MSP430F5659 data sheet, below the table "REF, External Reference", are several footnotes.  These seem to suggest that when one uses any external reference below aVcc, accuracy is reduced.  "Lower reference voltage levels may be applied with reduced accuracy requirements."

This statement is puzzling. 

First, I might assume that a 2,5V reference on VeREF+ (with VeREF- at AGND) will yield 12 bits across 0 to 2.5V (610 microvolts/bit).  Whereas, a 3.3V VeREF+ (or using AVCC set at 3.3V) will yield 850 microvolts/bit. 

So, is TI telling us that even if we use a VeREF+ that's lower than aVCC, and can therefore resolve the input to greater resolution, our "accuracy" will be only as good as the full span of aVcc?

Also, puzzlement as to the use of VeREF-.  Is this to allow inputs slightly below aGND?  I thought these were illegal and would violate pin voltage limits.  What other purpose might VeREF- serve?

MSP430AFE221 minimal circuit

$
0
0

Hello,

I am new to MSP430 microcontrollers. What is the  minimal circuit for MSP430AFE221? I soldered it on a TSSOP do DIP adapter and I want to be sure that it survived soldering process. 

Is it enough if I connect Vcc, Vss, SBWTCK and SBWTDIO to programmer? Can the programmer recognize and read some calibration registers or serial number?

Which software do you recommend for only flashing of microcontroller?

Thanks.

"CS Reset Status" and "CS Reset Status Clear" registers not documented in the MSP432P4xx Family Technical Reference Manual SLAU356A

$
0
0

When looking at the MSP432 Reset Controller (RSTCTL) registers in the CCS 6.1.3 debugger to investigate the cause of a reset notice there are two "CS Reset Status" and "CS Reset Status Clear" registers displayed:

But the MSP432P4xx Family Technical Reference Manual SLAU356A doesn't list the  "CS Reset Status" and "CS Reset Status Clear" registers:

Is the description of the "CS Reset Status" and "CS Reset Status Clear" registers missing from the MSP432P4xx Family Technical Reference Manual SLAU356A due to a documentation error, or are these registers not supposed to be used?

Why the timer did not working in MSP430 with SPPLEDemo_Lite ?

$
0
0

Hi , I am developing in MSP430F5335 + CC2564 with IAR SPPLEDemo_Lite project.

In the SPPLEDemo_Lite. It use the Timer like the following in HAL.c :

static void ConfigureTimer(void)
{
/* Ensure the timer is stopped. */
TA1CTL = 0;

/* Run the timer off of the ACLK. */
TA1CTL = TASSEL_1 | ID_0;

/* Clear everything to start with. */
TA1CTL |= TACLR;

/* Set the compare match value according to the tick rate we want. */
TA1CCR0 = ( ACLK_FREQUENCY_HZ / MSP430_TICK_RATE_HZ ) + 1;

/* Enable the interrupts. */
TA1CCTL0 = CCIE;

/* Start up clean. */
TA1CTL |= TACLR;

/* Up mode. */
TA1CTL |= TASSEL_1 | MC_1 | ID_0;
}

#pragma vector=TIMER1_A0_VECTOR
__interrupt void TIMER_INTERRUPT(void)
{


++MSP430Ticks;

// Exit from LPM if necessary (this statement will have no effect if
// we are not currently in low power mode).
LPM3_EXIT;
}

And I want to add the another for flash the LED with P9.4 , so I use the following code of the timer.

static void ConfigureTimerForLED(void)
{
P9SEL &= ~BIT4;
P9DIR |= BIT4; // P9.4 output
TA0CCTL0 = CCIE; // CCR0 interrupt enabled
TA0CCR0 = 50000;
TA0CTL = TASSEL_2 + MC_1 + TACLR; // SMCLK, upmode, clear TAR

}

#pragma vector=TIMER0_A0_VECTOR
__interrupt void TIMER0_A0_ISR(void)
{
P9OUT ^= BIT4; // Toggle P1.0
TA1CCR0 += 50000; // Add Offset to CCR0

}

The Bluetooth is working fine if I do not use the ConfigureTimerForLED. When I use the ConfigureTimerForLED , the Bluetooth can not working. And the timer of ConfigureTimerForLED also not working...

I just want to use another timer for flash the LED.

Did I missing something ?


ACLK slows to a crawl during debug

$
0
0

Hello, I'm using a MSP430G2955 in a MSP-TS430DA38 with a 32.768 crystal. I have the program using the using the using the crystal to generate the ACLK and the DCO generating the MCLK and SMCLK at 8Mhz. I am outputting the ACLK on P2.0 and I can see it starts up just fine when I don't have the debugger on. As soon as I try to debug the ACLK slows way down inconsistently (sometimes 1kHz, sometimes 70Hz). I'm using Code Composer Studio 6.1.3.00033 and an old MSP-FET430UIF. I feel like I have the configuration correct because the ACLK starts up reliably if I cycle power but don't run the debugger. Any ideas what this might be?

[MSP430FR2533/CapTIvate] Confirm the detectable maximum button number at the same time.

$
0
0

Hi TI Experts,

Please let me confirm the following question.
[Question]
Would you please teach me that how many buttons can MSP430FR2533 detect at once with mutual and self type?
I would like to know the detectable maximum button number at the same time of this device.

If you have any questions, please let me know.
Best regards.
Kaka

Problem in MSP430fr5949 I2C Master Mode Automatic STOP Generation

$
0
0

Hi,

I set MSP430fr5949 to master mode and activated the automatic stop generation function, then transmitted  a sequence of  command bytes to slave device.

The sequence should be Start -> Slave address -> Command code -> stop.

However, my program held on the command "__bis_SR_register(LPM0_bits | GIE);" after set start condition.

It may be related to the wrong configuration  that I used. Please help.

My code was posted below, CCS editor were used.

int main(void) {
    int initial_loop = 0;

    WDTCTL = WDTPW | WDTHOLD;    // Stop watchdog timer

    P1SEL1 |= BIT6 | BIT7;                            // I2C pins - P1.6 SDA, P1.7 SCL
    PM5CTL0 &= ~LOCKLPM5;                              // Disable the GPIO power-on default high-impedance mode to activate
    UCB0CTLW0 |= UCSWRST;                            // Software reset enabled
    UCB0CTLW0 |= UCMODE_3 | UCMST | UCSSEL__SMCLK;     // I2C master mode, SMCLK, Software reset enabled
    UCB0CTLW1 |= UCASTP_2;                            // Automatic stop generated

    UCB0I2CSA = LED_Driver_SlaveAddress;            // configure slave addressUCB0I2CSA = SlaveAddress;
    UCB0BRW = 0x2710;                               // fSCL = SMCLK/10000 = ~100Hz; HT16K33V110 maximun clock frequency = 400kHz
    UCB0TBCNT = 0x01;                                // number of bytes to be received

    UCB0CTLW0 &= ~UCSWRST;                            // clear reset register
    UCB0IE |= UCTXIE0 | UCNACKIE;                     // transmit and NACK interrupt enable

    //Tx_Initial`
    TXByteCtr = Num_Initial_Bytes;
    Copy_Array_Content(TxTempBuff, LED_Driver_Initialisation, TXByteCtr);
    for(;initial_loop < Num_Initial_Bytes; initial_loop++)
    {
        while(UCB0CTLW0 & UCTXSTP);                // Ensure stop condition sent
        UCB0CTLW0 |= UCTR | UCTXSTT;            // I2C TX, start condition
        __bis_SR_register(LPM0_bits | GIE);     // Enter LPM0 w/ interrupts Remain in LPM0 until all data is TX'd
    }

    UCB0CTLW1 |= UCASTP_0;                        // Turn off Automatic stop generated

    __no_operation();
}

#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
#pragma vector = USCI_B0_VECTOR
__interrupt void USCI_B0_ISR(void)
#elif defined(__GNUC__)
void __attribute__ ((interrupt(USCI_B0_VECTOR))) USCI_B0_ISR (void)
#else
#error Compiler not supported!
#endif
{
  switch(__even_in_range(UCB0IV, USCI_I2C_UCBIT9IFG))
  {
    case USCI_NONE:          break;         // Vector 0: No interrupts
    case USCI_I2C_UCALIFG:   break;         // Vector 2: ALIFG
    case USCI_I2C_UCNACKIFG:                // Vector 4: NACKIFG
      UCB0CTLW0 |= UCTXSTT;                 // resend start if NACK
      break;
    case USCI_I2C_UCSTTIFG:  break;         // Vector 6: STTIFG
    case USCI_I2C_UCSTPIFG:  break;         // Vector 8: STPIFG
    case USCI_I2C_UCRXIFG3:  break;         // Vector 10: RXIFG3
    case USCI_I2C_UCTXIFG3:  break;         // Vector 12: TXIFG3
    case USCI_I2C_UCRXIFG2:  break;         // Vector 14: RXIFG2
    case USCI_I2C_UCTXIFG2:  break;         // Vector 16: TXIFG2
    case USCI_I2C_UCRXIFG1:  break;         // Vector 18: RXIFG1
    case USCI_I2C_UCTXIFG1:  break;         // Vector 20: TXIFG1
    case USCI_I2C_UCRXIFG0:  break;         // Vector 22: RXIFG0
    case USCI_I2C_UCTXIFG0:                 // Vector 24: TXIFG0
      {
          if (TXByteCtr)                        // Check TX byte counter
          {
              TXByteCtr--;                        // Decrement TX byte counter
              UCB0TXBUF = TxTempBuff[TXByteCtr];    // Load TX buffer
          }
          else
          {
              UCB0CTLW0 |= UCTXSTP;               // I2C stop condition
              UCB0IFG &= ~UCTXIFG;                // Clear USCI_B0 TX int flag
              __bic_SR_register_on_exit(LPM0_bits); // Exit LPM0
          }
      }
      break;
    default: break;
  }
}

Thank you.

Regards,

Sungming

MSP430F247 SMPS Power Supply

$
0
0

Hi,

We are designing power supply for MSP430F247 - used in one of our Smart Energy Measurement applications. A single 12V 5A SMPS will power up the on-board TPS560200 to provide 3.3V 200mA output for MSP430F247& other board components. From the WEBENCH simulations, we observe 0.014V ripple on the TPS560200 output voltage. We are further smoothing this ripple out using 10uF & 100nF capacitors on each MSP430F247 supply pins. However, we still are worried whether the voltage ripples might interfere with the MSP430F247 operation.

Could someone please suggest if the above power supply configuration works good for MSP430F247? Please also let us know if there is a better way of approaching voltage ripples above. No RF components on board. MCU operating at 14MHz.


Regards,

Ravi

When is TI going to get serious with MSP430 FET?

$
0
0

Latest (unhelpfully named) FET is still flakey - after how many years?

I appreciate that a lot of that is due to the difficult environment of interfacing to unknown, often dodgy hardware.

But a lot is just down to TI laziness.

For example, MSP430Flasher often fails to communicate, outputs hundreds of copies of this

# ERROR: Internal error
* Resetting device (RST/NMI)...done
* Starting target code execution...
# Exit: 10


and eventually crashes hard. 

Seriously.  This is just poor programming by someone at TI

Viewing all 21965 articles
Browse latest View live


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