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

MSP430 GCC execute custom code just before any bss_init o similar

$
0
0

Hi!


I was searching how to do this from gcc documentation but I couldn't make it work.


I need to disable the Watchdog just after the reset ocurr (before bss_init or any other routine included by the compiler).


How can I do that?

I am using the last MSP430 GCC version and using the MSP430F5529

thanks in advance!

Franco


Using GCC with code composer studio

$
0
0

Hello!

I'm trying to use GCC with CCS (MSP432). The target board is the MSP432 launchpad.
I program in C++. It compiles fine with TI's compiler, it doesn't with GCC.
The error I get is:
undefined reference to `operator delete(void*)'

Is there a quick fix for that kind of problem?

Thanks,

Pascal

Same interrupt occurance during the execution of the interrupt

$
0
0

Hi all,

I am using msp430f5338. I have a query releated to the interrupt. Say for example an interrupt 'X' is occured and the corresponding ISR will be executed.
During the execution of this ISR, if the same interrut 'X' will be occurred means what will be the result? As per my understanding during the execution of ISR
GIE bit is disabled and it won't allow any other interrupts, but still it allows the same interrupt occurance. Is this correct?

could any one help me to understand this?

Thanks in advance.

RAM usage in MSP430F5310

$
0
0

Dear all,

  Recently I am developing a product based on MSP320F5310IPT MCU and after compilation of trhe code using CCS the following message arrives:

MSP430: Loading complete. There were 14470 (code) and 46 (data) bytes written to FLASH/FRAM. The expected RAM usage is 7779 (uninitialized data + stack) bytes.


I am worried that since this MCU has only 6 KB of RAM, will my program run properly on execution. I have run my code in the MCU and its running fine, but I want to know what does expected RAM usage means ? Will there be a stack crash ? Also if the internal RAM is 6 kB, How come it is running a code of 7779 bytes ?

problem reading adc12 memory

$
0
0

Hi,

when I set a break point in the  adc12_ISR fro repeated single channel memory I get Following values for  ADC12MEM0

Name : ADC12MEM0
Default:0x000720
Hex:0x000720
Decimal:1824
Octal:03440
Binary:000000000000011100100000

when I try to isolate lower 12 bits I always get 0.

case 6: //Vector 6: ADC12IFG0
adcResult[index] =(ADC12MEM0 & 0x0fff); // keep only low 12 bits

index++;
isConversionComplete=FALSE;
if (index == 40)
{
index = 0;
isConversionComplete=TRUE;

}

__bic_SR_register_on_exit(LPM0_bits+GIE);
break;

Any help will be highly appreciated,

Thanks

GSM module libraries

$
0
0

Hey there,

I'm developing on SIM800 GSM module.

Do we have any open  GSM libraries for MSP430 ?

I want functions like SMS,GPRS,CALL etc.

Thanks.

ADC10 issue in MSP430G2553

$
0
0

Hi,

I want to trigger ADC10 using Watchdog timer every 2 msec and want the average value of 64 samples. Once the average is obtained, i want to reflect same in the duty cycle of TIMER_A1 . The change in the duty cycle can be seen as the LED brightness change connected to P2.1.

But, when i am running the code, it is toggling between 

if(ADC_flag)   AND     if (Reading_Captured)


Please see what may be the issue with the code. I am NOT able to find out the solution ever after giving so much try.

void main(void)

{
WDTCTL = WDTPW + WDTHOLD; // Stop WDT

CLOCK_Init(); // Initialize clocks for 16 MHz

__delay_cycles (80000000); 

ConfigPins();

__delay_cycles (500); //Random delay

Timer_Init();

__bis_SR_register(GIE); // Enable global interrupt

WDT_Init();

ADC_Init();

while(1)
{

if(ADC_flag)
{
ADC_flag=0;
__bis_SR_register(CPUOFF);                                              // MSP430 waits in LPM0 to save power until ADC10 conversion complete
                                                                                                   // ADC10_ISR will force exit from any LPMx on return.
while (ADC10CTL1 & ADC10BUSY);                               //Wait for conversion. 13 ADC10CLK cycle = 2.6 usec
ADC10SA = (unsigned int)&ADC_Readings;                 // Transfer adc readings to an array
ADC10CTL0 &= ~ENC;                                                      //The ENC bit must be clear so that most bits in ADC10CTL0 and ADC10CTL1 can be changed.

// sequence of conversions complete
Voltage_Sum += ADC_Readings;
Reading_Captured = 1;
Avg_ctr ++;
}

if (Reading_Captured)    
{
Reading_Captured = 0;
if (Avg_ctr == ctr_th)
{

ADC_Update();
if(Voltage > 0)
{
Duty = Voltage;
// P1OUT |= BIT0;
}
}

// Reset all the ADC values
Avg_ctr = 0;
Voltage_Sum = 0;
}
}

}

void CLOCK_Init(void)
{
//if we want DCO=MCLK=SMCLK,then just configure DCOCTL and BCSCTL1
//16Mhz @ maximum device frequency

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 range
DCOCTL = CALDCO_16MHZ; // Set DCO step + modulation*/
}

void ConfigPins(void)
{

  P1DIR |= BIT0;   // output

  P1OUT = 0;         // clear output pin

}

void ADC_Init(void)
{

ADC10CTL0 = ADC10SHT_2 + ADC10ON + ADC10IE;
ADC10CTL1 = INCH_1 + SHS_0 + ADC10SSEL_0 + ADC10DIV_0 + CONSEQ_0;
ADC10AE0 |= BIT1;                        // Select port pins function as input Analog channels
ADC10DTC1 = 0x001;                    // 1 conversion per sequence
}

void WDT_Init (void)
{
// Watchdog timer is used to generated interrupts for taking ADC readings
// DCO/SMCLK clock source used in this example for the WDT clock source
WDTCTL = WDT_MDLY_32; // WDT 32ms, for SMCLK = 1Mhz,here SMCLK = 16Mhz so timer interval = 2ms
IE1 |= WDTIE; // Enable WDT interrupt
}

// Watchdog Timer interrupt service routine
#pragma vector = WDT_VECTOR
__interrupt void WDT_ISR(void)
{
/* Here for each interrupt, it triggers ADC to take readings
* WDTIFG interrupt flag is automatically cleared */
ADC10CTL0 |= ENC + ADC10SC; // Sampling and conversion start
ADC_flag =1; //set ADC flag to process adc data
}

// ADC10 interrupt service routine
#pragma vector=ADC10_VECTOR
__interrupt void ADC10_ISR (void)
{
//ADC10IFG interrupt flag is automatically cleared
__bic_SR_register_on_exit(CPUOFF); // Clear CPUOFF bit from 0(Status Register)
}

void Timer_Init(void)
{
/*TIMER_A1 as PWM generation
*/

P2DIR |= BIT1|BIT2;                      //set as output pin
P2SEL |= BIT1|BIT2;                      //pin selected for pwm operations (P2.1/TA1.1) and (P2.2/TA1.1)
TA1CTL |= TASSEL_2 + MC_1;  //SMCLK and up mode count till ccr register
TA1CCR0 |= 1600 - 1;                         //pwm frequency 10 khz; DCO = MCLK = SMCLK = 16 Mhz
TA1CCR1 |= Duty;                           //Duty cycle 
TA1CCTL1 |= OUTMOD_7;                   //set/reset mode

//_BIS_SR(LPM0_bits + GIE); //For low power mode and global interrupt
// TAKE DUTY AS A VARIBLE TO CHANGE THE DUTY CYCLE
}

void ADC_Update(void)
{

/* Here ctr_th = 64 . i.e average of 64 ADC readings is calculated.
* Once is every 1 ms a set of ADC readings is taken
* So loop time is approximately 64 * 2 = 128 ms
*/

Voltage = Voltage_Sum / ctr_th;

}

THANK YOU ....

 

Breakpoints in GDB with MSP432P401R board

$
0
0

Hello,

I'm trying to get GDB working in Linux (Ubuntu 14.04) with the MSP432P401R board using the instructions in SLAU688 -- GCC ARM Embedded Toolchain for MSP432 MCUs.

I can build the blinking light example using gcc, I can attach to the device using the gdb agent from the XDS software package (processors.wiki.ti.com/.../XDS_Emulation_Software_Package), and I can run the code successfully.

However, I'm unable to set and use breakpoints.

This is what the GDB terminal looks like:

(gdb) monitor reset
CPU has been reset
(gdb) break main
Breakpoint 1 at 0x4ea: file msp432p401_cs.c, line 88.
(gdb) c
Continuing.
Warning:
Cannot insert breakpoint 1.
Cannot access memory at address 0x4ea

This is what the GDB-agent terminal looks like:

Successfully configured xds110_msp432_jtag.dat
CPU Name             Port
--------             ----
cortex_m4_0         :55000

Starting all cores
CPU Name             Status
--------             ------
cortex_m4_0          Waiting for client
cortex_m4_0          Client connected...Connecting to Target
cortex_m4_0 - Processor type =CORTEX_MXX (Little endian)
cortex_m4_0 - Target device is connected
Unable to load libctools.so,  Hardware breakpoints not available.
Target connected...Starting server
FAILED! GTI_SETBP_EX(hpid=0x8c40e38,addr=0x4ea,type=0,count=1,access=0)=ffffffff
(Error -1066 @ 0x4EA)
Unable to set/clear requested breakpoint. Verify that the breakpoint address is in valid memory.
(Emulation package 6.0.228.0)

ERROR: set_breakpoint() backend call returned 64

I noticed the line about unable to load libctools.so, so I also tried taking a copy of libctools.so from a CCS install and making it available to this process (from information here: e2e.ti.com/.../456749).

This is what the GDB-agent terminal looks like if I include the libctools from CCS in my LD_LIBRARY_PATH:

Successfully configured xds110_msp432_jtag.dat
CPU Name             Port
--------             ----
cortex_m4_0         :55000

Starting all cores
CPU Name             Status
--------             ------
cortex_m4_0          Waiting for client
cortex_m4_0          Client connected...Connecting to Target
cortex_m4_0 - Processor type =CORTEX_MXX (Little endian)
cortex_m4_0 - Target device is connected
Target connected...Starting server
FAILED! GTI_SETBP_EX(hpid=0x8dd9e38,addr=0x4ea,type=0,count=1,access=0)=ffffffff
(Error -1066 @ 0x4EA)
Unable to set/clear requested breakpoint. Verify that the breakpoint address is in valid memory.
(Emulation package 6.0.228.0)

ERROR: set_breakpoint() backend call returned 64

My gcc is version 5.3.1 20160307 (from launchpad.net/gcc-arm-embedded) and my gdb is 7.10.1.20160210-cvs.

Any ideas? Debugging works inside CCS, I'd just much rather use the command line tools if I possible.

Thanks!

Ben


Discrete Wavelet Transform(dB4)

$
0
0

Hi, I want to know whether we can do Discrete wavelet transform (dB4) in MSP430F5529? If yes what is the code to do it? Is any inbuilt function in C language to do the same?

DTC , ADC10 and TIMER_A1 issue

$
0
0

hI,

I am trying to change the duty cycle of the Timer_A1 by reading ADC value using DTC.

But i found that if i assign the source address directly to TA1CCR1, then duty cycle is changing as can be seen by led brightness.

if(ADC_flag)
{
         ADC_flag=0;

         ADC10SA = (unsigned int)&TA1CCR1;               // Transfer adc readings to an array
         ADC10CTL0 |= ENC + ADC10SC;                      // Start sampling
         __delay_cycles (48);

        // sequence of conversions complete
        ADC10CTL0 &= ~ENC;

}

void Timer_Init(void)
{

P2DIR |= BIT1|BIT2;                                   //set as output pin

P2SEL |= BIT1|BIT2;                                 //pin selected for pwm operations (P2.1/TA1.1) and (P2.2/TA1.1)

TA1CTL |= TASSEL_2 + MC_1;              //SMCLK and up mode count till ccr register

TA1CCR0 = 1600 - 1;                               //pwm frequency 10 khz; DCO = MCLK = SMCLK = 16 Mhz

TA1CCR1 = Duty; 

TA1CCTL1 |= OUTMOD_7;                          //set/reset mode

}

 

But if i write the code as below no change in the duty cycle is observed. 

 

unsigned int ADC_Readings;   // global variable

unsigned int Duty = 100;           // global variable

if(ADC_flag)
{
     ADC_flag=0;

    ADC10SA = (unsigned int)&ADC_Readings; // Transfer adc readings to an array

    ADC10CTL0 |= ENC + ADC10SC; // Start sampling
    __delay_cycles (48);

    // sequence of conversions complete
    ADC10CTL0 &= ~ENC;

   Duty = ADC_Readings;

}

void Timer_Init(void)
{

P2DIR |= BIT1|BIT2;                                   //set as output pin

P2SEL |= BIT1|BIT2;                                 //pin selected for pwm operations (P2.1/TA1.1) and (P2.2/TA1.1)

TA1CTL |= TASSEL_2 + MC_1;              //SMCLK and up mode count till ccr register

TA1CCR0 = 1600 - 1;                               //pwm frequency 10 khz; DCO = MCLK = SMCLK = 16 Mhz

TA1CCR1 = Duty; 

TA1CCTL1 |= OUTMOD_7;                          //set/reset mode

}

Thank you..!!

TSC2013EVM Motor

$
0
0

Hi,

One of my customer purchased TSC2013EVM

The user manual of the above EVM includes BOM. BOM lists LRA Motor with part no AAC1030.

But customer didn't receive the above motor. Kindly help whether the EVM comes with motor.

Also user manual says "an LRA motor is attached as an actuator" what does it mean?

what's the core of msp430f5172? msp430 or msp430x? how to configure the ccs complier?

$
0
0

I build a project by the CCSv5 in which the IQmath library is used. It runs smoothly while configuring the complier options in default as below:

But there are errors as below if selecting the 'silicon version' to 'msp' not 'mspx'.

'_IQ22frac'   '_IQ22toF'

error #10234-D: unresolved symbols remain'

I know that msp430 is for 16bit address and msp430x is for 20bit address but as the datasheet of msp430f5172 shows it seems that the chip is msp430 core not msp430x because the memory address is from 0x0000 to 0xFFFF, is it?

How to continuous blink the LED and do not effect the operation of original code ?

$
0
0

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

 When the device is power on , I want the LED will continuous blink when the BT or BLE has not been connected.

And the LED will turn on after the BT or BLE has been connected.

I try to use the following code to  blink the LED.

voidtoggleLED( void)
{
  P6OUT ^= BIT6;
}
When the BT or BLE has not been connected , I use the following code to blink the LED.
while( connectMode == 0 ){
  toggleLED();
  BTPS_Delay(500);
}
The connectMode is set to 0 at the begin before the BT or BLE has been connected.
When the BT or BLE has been connected , set the connectMode to the 1.
But it seems can not out of the while function , when I try to connect to the device via BLE.
How to blink the LED via thread or Timer and do not effect the operation of original code ?
But it will not break

how to count half an hour with msp430

$
0
0

hello ;

am using msp430 connected with atmel processor through spi . I need to detect the power failure of the processor to reset the msp430 but there is no way to do that , the only choice is to approximate the total time needed for the process  and if exceeded  reset the msp430 by wdt . My problem is that i found the appropriate time the process taken to be successfully executed is half an hour , which is not supported by the wdt intervals choices , and if i decided to use one of the msp430 timers there will be another problem that the maximum count value of the 16 bit count register is 65535 which means that even if i use the minimum frequency i will only get two minutes as maximum.

any one have an idea please !!!

432 wdt configuration

$
0
0

Hi,

  I am trying to configure the WDT based on the examples provided, wdt_interval_mode, and wdt_service_the_dog

   The 432 examples don't change the core frequency, which I guess is 3Mhz. 

   I readjusted the core frequency to 48Mhz, and to no surprise, the timeout occurs too quickly. 

   I figured I would just increase the WDT_A_CLOCKITERATIONS_x value by 12, however, on referencing the source code I see that WDT_A_CLOCKITERATIONS_x is a coded value and not a count.

Rather than iteratively try the different and see what happens, does anyone here have a  equation for converting code to seconds timeout per core frequency? 

These are the choices:

WDT_A_CLOCKITERATIONS_512K -> the wdt example. 

WDT_A_CLOCKITERATIONS_8192K 

WDT_A_CLOCKITERATIONS_128M 

WDT_A_CLOCKITERATIONS_2G


Looking for a micro-controller for my portable audio device

$
0
0

Dear all,

I am looking for a micro-controller for my portable audio device.

I am currently have a 10W amplifier 2 channels (TI: tpa3140d2) and Bluetooth module (Laird Technology: BTM511).

I want the controller to do the following:

1.control bluetooth function (pairing stage, connected stage) with sound indicator using push button.

2.control led for bluetooth status

3.control on-off switch with sound indicator

4.control led for battery fuel gauge (plan to use TI: bq40z50-r1).

5.control volumn up-down

6.Other function (pickup-end call)

Please suggest the micro-controller.

"MSP-EXP430F5529LP it is not connecting in Windows 7 Professional service pack1, 32 Bit using CCS 6.0.1 . my system is latching up and I am not able to do further operation. If I connect same MSP-EXP430F5529LP in Windows 8.1 pro system it is connecti

$
0
0

MSP-EXP430F5529LPLaunchPad Queries:

 

  • MSP-EXP430G2, MSP-EXP430FR5969 LaunchPads are connecting and I am able to do demo example programs using CCS 6.0.1 on Windows 7 Professional service pack1, 32 Bit.
  • But with same system configuration if I connect MSP-EXP430F5529LP it is not connecting, system is latching up and I am not able to do further operation.
  • If I connect same MSP-EXP430F5529LP in Windows 8.1 pro system it is connecting.
  • Please provide a solution

Get formula out of a table of values (Volts = formula (a/d reading))

$
0
0

Long time ago I was using an Windows Application that was taking a table of value and was giving you different algebra formula to achieve it. I have a/d reading (0-4095) values for different voltage input (0-36Volts).

Volts = formula (A/D reading)

Does anyone know an application that can do this?

MSP430 I2C Communication Using USCI Hardware and TI I2C Library

$
0
0
I've been trying to communicate with the VNCL3020 via I2C using an msp430g2755 and TI's I2C master library. I'm seeing a NACK from the VNCL3020 but the MSP430 isn't writing after so I think it's most likely that I have written some code incorrectly. My code has been tested with 4 VNCL3020 modules so the odds of them all being DOA are basically nonexistent, the SDA and SCL line are held high, I've tried multiple prescale values, and I've contacted Vishay to confirm that I have the module properly connected and that I am properly interacting with it. Attached are pictures of the oscilloscope readings associated with my code and a circuit diagram of how the VNCL3020 is connected.

Communication Protocol:
I am trying to read from register 81h
Here is my code:

#include <msp430.h>
#include "TI_USCI_I2C_master.h"

#define IR_ADDRESS 0x13
#define IR_REGISTER_PRODUCT_ID 0x81
#define PRESCALE 0x44

unsigned char registerAddress = 0x81;
unsigned char productID = 0;


void main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop WDT

BCSCTL1 = CALBC1_8MHZ;
DCOCTL = CALDCO_8MHZ;

_EINT();

//write register address
TI_USCI_I2C_transmitinit(IR_ADDRESS, PRESCALE); // init transmitting with
while ( TI_USCI_I2C_notready() ); // wait for bus to be free
TI_USCI_I2C_transmit(1, &registerAddress); // start transmitting

//read from register
TI_USCI_I2C_receiveinit(IR_ADDRESS, PRESCALE); // init receiving with USCI
while ( TI_USCI_I2C_notready() ); // wait for bus to be free
TI_USCI_I2C_receive(1,&productID);
while ( TI_USCI_I2C_notready() ); // wait for bus to be free

LPM3;

}



Any advice, suggestions, or resources would be greatly appreciated.
Thanks,

Christian

MSP430F5247 Reset problem

$
0
0

Hi,

We are using MSP430F5247 microcontroller in our project. When we touch its TEST/SBWTCK pin (SPY BI WIRE Interface), MCU resets. We have given wire on test point. Sometimes MCU resets even without touching this wire. This pin is internally pull down but we have tried another pull down too. Can you please help us to know root cause of this issue ?

Viewing all 21972 articles
Browse latest View live


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