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

CCS/MSP432E401Y: MSP432E401Y UART DATA TRANSFER

$
0
0

Part Number:MSP432E401Y

Tool/software: Code Composer Studio

Hi,

 I Want to realize  UART daa transfer using the 'uart_datatf_dmareq' program in MSP432E401Y microcontroller launchpad kit. Can anyone suggest me the Jumper settings for this.

Thank you

Regards

Kalyan K.


RTOS/MSP430F5259: TI-RTOS:recompile tidrivers error issue, indicate can't open related header file (gmake -f tirtos.mak drivers)

$
0
0

Part Number:MSP430F5259

Tool/software: TI-RTOS

HI

I tried to port 5529LP's Ti-RTOS project to 5259,  then compile tirtos_msp43x_2_20_00_06 for 5259, according to the ccsv7.4 and UIA installation paths, the tirtos.mak has been modified as follow

DEFAULT_INSTALL_DIR      ?= c:/ti
CCS_COMPILERS_DIR        ?= f:/Program_Files/Code_Composer_Studio/ccsv7/tools/compiler

#
# Enable TI-RTOS to build for CCS.
# Set CCS_BUILD to true and modify path to toolchain
#
CCS_BUILD                     ?= true
TI_INSTALL_DIR                ?= $(CCS_COMPILERS_DIR)
ti.targets.msp430.elf.MSP430X ?= $(TI_INSTALL_DIR)/ti-cgt-msp430_16.9.6.LTS
ti.targets.arm.elf.M4F        ?= $(TI_INSTALL_DIR)/ti-cgt-arm_16.9.8.LTS

#
# Enable TI-RTOS to build for IAR.
# Set IAR_BUILD to true and modify path to toolchain.
#
# The IAR_MSP430/ARM_INSTALL_DIR must be set to point to the
# "Embedded Workbench x.y" directory in IAR Workbench.  This path MUST NOT
# contain spaces.  If using a Windows PC, see the comments above for steps to
# get the DOS path for a directory.
#
IAR_BUILD                        ?= false
IAR_MSP430_INSTALL_DIR           ?= c:/iar
iar.targets.msp430.MSP430X_small ?= $(IAR_MSP430_INSTALL_DIR)/430
IAR_MSP430HEADERS                ?= $(IAR_MSP430_INSTALL_DIR)/430/inc

IAR_ARM_INSTALL_DIR              ?= c:/iar
iar.targets.arm.M4F              ?= $(IAR_ARM_INSTALL_DIR)/arm
IAR_MSP432HEADERS                ?= $(IAR_ARM_INSTALL_DIR)/arm/inc/TexasInstruments

#
# Enable TI-RTOS to build for GCC.
# Set GCC_BUILD to true and modify path to toolchain
#
GCC_BUILD            ?= false
GCC_INSTALL_DIR      ?= $(CCS_COMPILERS_DIR)
gnu.targets.arm.M4F  ?= $(GCC_INSTALL_DIR)/gcc-arm-none-eabi-4_9-2015q3

#
# Enable TI-RTOS to build for MSP430/MSP432 devices.
# Set MSP430_BUILD or MSP432_BUILD to false to skip building TI-RTOS for the
# respective device family.
#
MSP430_BUILD ?= true
MSP432_BUILD ?= false

#
# TI-RTOS and XDCTools settings
#
XDCTOOLS_INSTALL_DIR        ?= $(DEFAULT_INSTALL_DIR)/xdctools_3_32_00_06_core
export XDCTOOLS_JAVA_HOME   ?= $(DEFAULT_INSTALL_DIR)/ccsv7/eclipse/jre

TIRTOS_INSTALL_VER          ?= tirtos_msp43x_2_20_00_06
TIRTOS_INSTALL_DIR          ?= $(DEFAULT_INSTALL_DIR)/$(TIRTOS_INSTALL_VER)
TIDRIVERS_INSTALL_DIR       ?= $(TIRTOS_INSTALL_DIR)/products/tidrivers_msp43x_2_20_00_08
BIOS_INSTALL_DIR            ?= $(TIRTOS_INSTALL_DIR)/products/bios_6_46_00_23
UIA_INSTALL_DIR             ?= $(TIRTOS_INSTALL_DIR)/products/uia_2_00_06_52

MSP430DRIVERLIB_INSTALL_DIR ?= $(TIRTOS_INSTALL_DIR)/products/msp430_driverlib_2_70_01_01a
MSP430GRLIB_INSTALL_DIR     ?= $(TIRTOS_INSTALL_DIR)/products/msp430_grlib_2_00_00_17
MSP430USBLIB_INSTALL_DIR    ?= $(TIRTOS_INSTALL_DIR)/products/msp430_usblib_5_00_01
MSP432DRIVERLIB_INSTALL_DIR ?= $(TIRTOS_INSTALL_DIR)/products/msp432_driverlib_3_21_00_05

MSP430HEADERS               ?= $(DEFAULT_INSTALL_DIR)/ccsv7/ccs_base/msp430/include
MSP432HEADERS               ?= $(DEFAULT_INSTALL_DIR)/ccsv7/ccs_base/arm/include

TIRTOS_PACKAGES_DIR         ?= $(TIRTOS_INSTALL_DIR)/packages
TIDRIVERS_PACKAGES_DIR      ?= $(TIDRIVERS_INSTALL_DIR)/packages
BIOS_PACKAGES_DIR           ?= $(BIOS_INSTALL_DIR)/packages
UIA_PACKAGES_DIR            ?= $(UIA_INSTALL_DIR)/packages


MSP430DEVLIST := MSP430F5929

but when I  recompile(gmake -f tirtos.mak drivers) , the following error occurred(can't open related header file)

obviously , It's the problem of  'include path' ,  and  I guess the path of some environment variable is incorrect. but view the drivers.mak file to find path-related just BIOS_PACKAGES_DIR variables. and my tirtos,.mak file BIOS_PACKAGES_DIR variables is ok, The related header files are also found in BIOS_PACKAGES_DIR (C:\ti\tirtos_msp43x_2_20_00_06\products\bios_6_46_00_23\packages\ti\targets\msp430)  , 

I don't know what to do. I can't add one determine the path for .c file . That's a lot of .c!!!

drivers.mak

best regards

xc.mo

CCS/MSP432P401R: TI RSLK

$
0
0

Part Number:MSP432P401R

Tool/software: Code Composer Studio

Hello, 

I have using the TI RSLK to develop a robot. I have been following the instructions given in the online tutorial. I have a doubt while I was trying to program the motor in Module 12. I have used the code below to run the motor forward. But it is not working properly. Can someone check the code and help me out.

void Motor_InitSimple(void){
// Initializes the 6 GPIO lines and puts driver to sleep
// Returns right away
// initialize P1.6 and P1.7 and make them outputs

P1->SEL0 &= ~0x20;
P1->SEL1 &= ~0x20;
P1->DIR |= 0x20;
P2->SEL0 &= ~0x20;
P2->SEL1 &= ~0x20;
P2->DIR |= 0x20;
P3->SEL0 &= ~0x20;
P3->SEL1 &= ~0x20;
P3->DIR |= 0x20;
P3->OUT &= ~0x20;
}


void Motor_ForwardSimple(uint16_t duty){
// Drives both motors forward at duty (100 to 9900)

P1->OUT &= ~0x20;
P3->OUT |= 0x20;
uint16_t duty1=10000-duty;
while(1){
P2->OUT |= 0x20;
SysTick_Wait10ms(duty);
P2->OUT &= ~0x20;
SysTick_Wait10ms(duty1);
}
}

int main(void){ 
Clock_Init48MHz();
LaunchPad_Init(); 
//Bump_Init(); 
Motor_InitSimple(); 
while(1){
// Pause(); // start on SW1 or SW2
LaunchPad_Output(0x02);
Motor_ForwardSimple(5000);

}

}

RTOS/MSP432E411Y: XDCTools still used in TI-RTOS examples of MSP432?

$
0
0

Part Number:MSP432E411Y

Tool/software: TI-RTOS

Dear TI-Experts,

I'm just comparing Tiva C and SimpleLink for a new project.

After looking at many TI-RTOS examples for the MSP432 processor family I could only very rarely see a .cfg file (which configures XDC as far as I know). (Only exception so far: uart_logging)

Is it possible to use TI-RTOS without the XDC/RTSC environment? (Or is it somehow hidden?)

All Tiva C / TI-RTOS examples I inspected use a .cfg file. Why don't the SimpleLink / TI-RTOS examples? Is TI leaving the XDC approach?

Is Tiva C development ongoing or did TI completely switch to SimpleLink? (In other words: is it wise to base a new project on Tiva C?)

Another concern: Why do all MSP432 TI-RTOS examples reserve half the processor memory as heap in the *.cmd file. Is there a rationale?

Why didn't the Tiva C / TI-RTOS examples?

Please help me in finding the right decision!

MSP430FR5872: WATCHDOG

$
0
0

Part Number:MSP430FR5872

Hi Expert.

In mostly MSP430 example code I am seeing this line in starting of the main loop "WDTCTL = WDTPW | WDTHOLD;  

Can you explain the reason behind this and if we exclude this statement then what could be the consequences?

Thanks In Advance

MSP432E411Y: First Time Programming Device Programming wo JTAG

$
0
0

Part Number:MSP432E411Y

Dear Forum,

is it possible to program a fresh bought MSP432 without special devices and administrative rigths using a Windows host?

(As far as I know it is e.g. for TM4C129 devices possible to program via UART0 and a kind of portable version of LM Flash Programmer.)

MSP430G2755: Analog input pins protection

$
0
0

Part Number:MSP430G2755

Hi,

we are having an internal debate whether additional external protection needs to be added to the analog input pins when measuring 24Vdc, if the micro is powered from 3.3V and we probe through a 10:1 high impedance divider. More details:

-the device is entirely self contained, no external inputs except external 24Vdc from a SMPS brick adapter. All data exchange is wireless.

-this 24V input voltage goes into a linear regulator with LM9076BMA which powers the micro with 3.3V

-the 24V input voltage is also sampled using a 10:1 series divider 44.2k with 4.99k to ground. Another option is to sample through 162k series and 18k to ground.

-Both options give a 10:1 ratio, so the output voltage is 2.4V. Equivalent circuit is a 2.4V supply with an internal resistance of 4.5k in the first case (44k2||4.99) and 16.2k in the second case (162k||18k).

-Datasheet specifies at page 19 Absolute maximum ratings "Voltage applied to any pin (2) –0.3 V to V CC + 0.3 V" and "Diode current at any device pin ±2 mA".

Under these circumstances, do we need to add clamping diodes to Vcc and GND at the analog inputs? What is the worst scenario if we do not have them? Looking forward for your opinions, thank you for looking into this.

MSP430F5529: Can't get XT2 16Mhz to run CPU

$
0
0

Part Number:MSP430F5359

Hi,

I have a 16Mhz crystal on XT2IN and XT2OUT . I see 16MHz on the scope so I know the oscillator is working. If I run a simple counting timing loop and toggle a pin, I see no change in the CPU speed from the default clock cycle. I imagine it's a register setup issue. Please help.

Thanks

My setup code for switching MCLK to XT2 is;

P7SEL |= 0x0C; // set XT2in out as osc mode bits 2,3
P7DIR |=0x08; //bit 3 out
P7DIR &=0xFB; //bit 2 in
UCSCTL6 &=0xFEFF; //XT2 on
UCSCTL4 |=0x0005; //101b = XT2 16Mhz MCLK source


MSP-GANG: do nothing setting issue after program completion with MSP-GANG tool offline programming for MSP430

$
0
0

Part Number:MSP-GANG

MSP-GANG Programmer tool for MSP430 offline programming, and use the default setting for do nothing after program completion.

the MSP430 should be held in reset status all the time after program completion, but i can see that the RST pin voltate is released and hold high some time later.

you can refer to the waveform, TP25 is the RST/NMI pin voltage and TP26 is the TEST pin.

So pls help check if the programmer GUI setting has some problem for the do nothing setting which can not match the msp-gang user guide.

how i can realize the MSP430 can be held in reset status all the time after program completion if do nothing can not work.

Thanks

CCS/MSP430FR5994: Crypto-Bootloader example project for CCS?

$
0
0

Part Number:MSP430FR5994

Tool/software: Code Composer Studio

I've been reviewing the Crypto-Bootloader User's Guide (SLAU657) and I'd like to try it out for my MSP430FR5994.  However, the Crypto-Bootloader example project is an IAR project and I'm using Code Composer Studio version 7.2.  I've been trying to find some relevant guides for porting this project from IAR to CCS, but all the details I find refer to CCS version 5 or earlier.

Does TI have a copy of this example project that runs in CCS?  If not, is there a more recent guide that describes how to port an IAR project to CCS?

CCS/MSP430F2274: MSP430 write to specific RAM location

$
0
0

Part Number:MSP430F2274

Tool/software: Code Composer Studio

For testing purposes I wanted to write a single character to location in RAM, and move the value to a different spot in RAM during an interrupt. I tried to use the intrinsic function `__data20_write_char()`, but are getting error #10234-D: unresolved symbols remain. Is there a reason as to why this is occurring? My code is provided below:

#include <msp430.h>
//#include <string.h>

void configWDT(void);
void configClocks(void);
void configGPIO(void);
void configTimers(void);
void configADC(void);

unsigned volatile int blink_cnt;
int main(void)
{
    blink_cnt = 0;
    configWDT();
    configClocks();
    configGPIO();
    configTimers();
    configADC();

    const char ch = 'V';
    __data20_write_char(0x028E, ch);

    __no_operation();

    while(1)
    {
        __bis_SR_register(LPM3_bits + GIE);             // Enter LPM3
        if(blink_cnt == 0 || blink_cnt > 0)
        {
            P1OUT ^= BIT0;
        }
    }
}


void configWDT(void)
{
    WDTCTL = WDTPW + WDTHOLD;
}


void configClocks()
{
    DCOCTL |= DCO1 + DCO0;
    BCSCTL1 |= XT2OFF + DIVA_3 + RSEL2 + RSEL1 + RSEL0;
    BCSCTL2 |= SELM_3 + SELS;
    BCSCTL3 |= XT2S_3 + XCAP_3;
}


void configGPIO(void)
{
    P1DIR |= 0x03;                            // P1.1 output
    P1SEL |= 0x02;                            // P1.1 option select
}


void configTimers(void)
{
    TACCTL0 = OUTMOD_4;                       // TACCR0 toggle mode
    TACCR0 = 0xFFFF;
    TACTL = TASSEL_1 + ID_3 + MC_3 + TAIE;    // ACLK, up-downmode
}


void configADC(void)
{
    ADC10CTL0 = 0x00;
}


// Timer_A3 Interrupt Vector (TAIV) handler
#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
#pragma vector=TIMERA1_VECTOR
__interrupt void Timer_A(void)
#elif defined(__GNUC__)
void __attribute__ ((interrupt(TIMERA1_VECTOR))) Timer_A (void)
#else
#error Compiler not supported!
#endif
{
    switch(TAIV)        // Efficient switch-implementation
    {
        case  2:
            break;                        // TACCR1 not used
        case  4:
            break;                        // TACCR2 not used
        case 10:
            blink_cnt++;
            break;
    }
    __bic_SR_register_on_exit(LPM3_bits);
}

I have yet to get to the part where the character is moved to a different location in RAM, but I cannot get the character to written initially. Is there an alternative method to writing a value to RAM? In the future this data value is going to be 128 bytes, so it might be necessary to know how to write the entire data value to RAM instead of a single character. Thank you.

MSP430F2274: Spy-bi Wire Programming

$
0
0

Part Number:MSP430F2274

I would like to configure my MSP430F2274 and its eval board to be programmed (with code composer studio) using the 2 wire spy-bi wire method. The current debugger/programmer I am using is the MSP MCU. I am switching from the 4 wire JTAG method to the spy-bi wire and I am not sure how to reconfigure the eval board/compiler in code composer studio. Is there a certain protocol that I need to follow in order to accomplish this?

MSP430F1111A: Testing Eloqua Port **Will Delete thread**

$
0
0

Part Number:MSP430F1111A

OP-Comm_Mem asks a question. And will click this resolved my issue when answer is suggested by Tier_A

CCS/MSP432P401R: Set up the ADC reading with frequency of 1kHz

$
0
0

Part Number:MSP432P401R

Tool/software: Code Composer Studio

Hi,

I am using MSP432 evaluation board. I have written a code to read ADC and SPI values. I want to record data with higher frequency (1kHz) but there is a limitation here and even I change 

ACLK_FREQUENCY 

still the data collection is not going to be 1KHz. Do you have any suggestions or any example code available for recording at high frequency?

/*
 * This project is about reading two 14 bit data streams using
 * the Synchronous Peripheral Interface (SPI), and from four ADC
 * channels every 1 seconds.
 *
 * Comments assume the reader is familiar with Double_14_bit_spi_example
 * and ADC14-TimerA-Sample-Clock.
 *
 * When the timer triggers an interrupt, the SPIs and ADC are read (from),
 * and the LED is toggled. The timer should trigger every 1 seconds.
 */

#include "msp.h"
#include <driverlib.h>
#include <stdio.h>

#define ACLK_FREQUENCY 32768 /* Hertz */

/* The time between timer interrupts in seconds is equal to
 *
 * (TIMER_OVERFLOWS + TOGGLE_FREQUENCY / ACLK_FREQUENCY) * 2
 *
 * TIMER_OVERFLOWS must be a positive integer.
 */
#define TOGGLE_FREQUENCY ACLK_FREQUENCY
#define TIMER_OVERFLOWS 0

/* Define result variables big enough to contain 14 bit results. */
uint32_t adc0Result = 0;
uint32_t adc1Result = 0;
uint32_t adc2Result = 0;
uint32_t adc3Result = 0;
uint32_t adc4Result = 0;
uint32_t adc5Result = 0;
uint32_t spi0Result = 0;
uint32_t spi1Result = 0;
uint32_t spi2Result = 0;
uint8_t timerOverflows = 0;
uint8_t index;

/* Sets up the ADC. */
void setup_ADC(void)
{
    /* Enable ADC interrupt in NVIC module. */
    NVIC->ISER[0] = 1 << ((ADC14_IRQn) & 31);

    // Sampling time, S&H=4, ADC14 on
    //ADC14->CTL0 = ADC14_CTL0_SHT0_0 | ADC14_CTL0_SHP | ADC14_CTL0_ON;

    ADC14->CTL0 = ADC14_CTL0_SHT0__192 | ADC14_CTL0_MSC | ADC14_CTL0_SHP | ADC14_CTL0_ON | ADC14_CTL0_CONSEQ_1;

    /* This setting sets the input pin (P5.5 to 5.0). */
    ADC14->MCTL[0] |= ADC14_MCTLN_INCH_0;
    ADC14->MCTL[1] |= ADC14_MCTLN_INCH_1;
    ADC14->MCTL[2] |= ADC14_MCTLN_INCH_2;
    ADC14->MCTL[3] |= ADC14_MCTLN_INCH_3;
    ADC14->MCTL[4] |= ADC14_MCTLN_INCH_4;
    ADC14->MCTL[5] |= ADC14_MCTLN_INCH_5;

    /* Mark the final input as the end of the reading sequence. */
    ADC14->MCTL[5] |= ADC14_MCTLN_EOS;

    /* Enable interrupt in ADC */
    ADC14->IER0 |= ADC14_IER0_IE0;
}

/* Sets up the timer. */
void setup_timer(void)
{
	/* Enable interrupt from the timer in NVIC module. */
	NVIC->ISER[0] = 1 << ((TA0_0_IRQn) & 31);

	/* Clear timer interrupt trigger (if any).
	 * Note: the CC stands for capture (or) control. */
	TIMER_A0->CCTL[0] &= ~TIMER_A_CCTLN_CCIFG;

	/* Enable interrupt functionality. */
	TIMER_A0->CCTL[0] = TIMER_A_CCTLN_CCIE;

	/* Set the time at which the timer triggers an interrupt. */
	TIMER_A0->CCR[0] = TOGGLE_FREQUENCY;

	/* Watch the ACLK (Auxiliary clock). */
	TIMER_A0->CTL |= TIMER_A_CTL_TASSEL_1;

	/* Define mode of the timer. This is continuous mode, where the
	 * Timer counts up to 0xFFFFF, then sets itself to zero. */
	TIMER_A0->CTL |= TIMER_A_CTL_MC_2;
}

/* Configures the SPIs for use with thermocouples, ready to read. */
void setup_SP_interfaces(void)
{
	/* Define ports to use for SPI. In this example, for interface B0,
	 * P1.5 transmits the clock signal (UCB0CLK), P1.6 sends data to the
	 * datagenerator/thermocouple to tell the generator that we are ready
	 * to receive data, and P1.7 stores the data in the reading
	 * buffer for us.
	 *
	 * The equivalent ports for interface B1 are P6.3, P6.4, and P6.5.
	 *
	 * These ports are hard-coded, and can be found in the data sheet.
	 */
    P1->SEL0 |= BIT5 | BIT6 | BIT7;
    P6->SEL0 |= BIT3 | BIT4 | BIT5;
    P10->SEL0 |= BIT1 | BIT2 | BIT3;
    /* Reset the EUSCIs (serial communications interfaces), and prevent
     * them from operating while we configure them. */
    EUSCI_B0->CTLW0 |= EUSCI_B_CTLW0_SWRST;
    EUSCI_B1->CTLW0 |= EUSCI_B_CTLW0_SWRST;
    EUSCI_B3->CTLW0 |= EUSCI_B_CTLW0_SWRST;
    /* The serial communication interfaces require a master and a slave.
     * The master tells the slave when the master is ready to receive
     * data from the slave. In addition, the master is in charge of
     * keeping communication time correct by sending its clock ticks to
     * the slave. This microcontroller is the master. */
    EUSCI_B0->CTLW0 |= EUSCI_B_CTLW0_MST;
    EUSCI_B1->CTLW0 |= EUSCI_B_CTLW0_MST;
    EUSCI_B3->CTLW0 |= EUSCI_B_CTLW0_MST;
    /* Use the auxilliary clock for determining ticks. This choice seems
     * largely superficial. */
    EUSCI_B0->CTLW0 |= EUSCI_B_CTLW0_SSEL__ACLK;
    EUSCI_B1->CTLW0 |= EUSCI_B_CTLW0_SSEL__ACLK;
    EUSCI_B3->CTLW0 |= EUSCI_B_CTLW0_SSEL__ACLK;
    /* No idea. */
    EUSCI_B0->BRW = 0x01;                   // /2,fBitClock = fBRCLK/(UCBRx+1).
    EUSCI_B1->BRW = 0x01;
    EUSCI_B3->BRW = 0x01;
    /* We will read the data in two 8-Bit blocks, so we must configure
     * the interface to not operate in 7-Bit mode.  */
    // EUSCI_A0->CTLW0 &= ~EUSCI_A_CTLW0_7BIT;

    /* Enable MSB-first, which controls the direction of the receive
     * and transmit shift register. Not sure what this does. */
    EUSCI_B0->CTLW0 |= EUSCI_B_CTLW0_MSB;
    EUSCI_B1->CTLW0 |= EUSCI_B_CTLW0_MSB;
    EUSCI_B3->CTLW0 |= EUSCI_B_CTLW0_MSB;
    /* Also not sure what these instructions do. */
    EUSCI_B0->CTLW0 |= EUSCI_B_CTLW0_SYNC | EUSCI_B_CTLW0_CKPL;
    EUSCI_B1->CTLW0 |= EUSCI_B_CTLW0_SYNC | EUSCI_B_CTLW0_CKPL;
    EUSCI_B3->CTLW0 |= EUSCI_B_CTLW0_SYNC | EUSCI_B_CTLW0_CKPL;
    /* Register the interfaces with the interrupt handler. */
    NVIC->ISER[0] = 1 << ((EUSCIB0_IRQn) & 31);
    NVIC->ISER[0] = 1 << ((EUSCIB1_IRQn) & 31);
    NVIC->ISER[0] = 1 << ((EUSCIB2_IRQn) & 31);
    /* Now we switch on the interfaces; they will not yet transmit data,
     * but it is ready to do so. */
    EUSCI_B0->CTLW0 &= ~EUSCI_B_CTLW0_SWRST;
    EUSCI_B1->CTLW0 &= ~EUSCI_B_CTLW0_SWRST;
    EUSCI_B3->CTLW0 &= ~EUSCI_B_CTLW0_SWRST;
    /* Allow the interfaces to raise interrupts once data has been
     * received, but not transmitted. */
    EUSCI_B0->IE |= EUSCI_B_IE_RXIE;
    EUSCI_B0->IE &= ~EUSCI_B_IE_TXIE;
    EUSCI_B1->IE |= EUSCI_B_IE_RXIE;
    EUSCI_B1->IE &= ~EUSCI_B_IE_TXIE;
    EUSCI_B3->IE |= EUSCI_B_IE_RXIE;
    EUSCI_B3->IE &= ~EUSCI_B_IE_TXIE;
    /* Clear the interrupt flag, if any. */
    EUSCI_B0->IFG = 0;
    EUSCI_B1->IFG = 0;
    EUSCI_B3->IFG = 0;
}

void main(void)
{
	/* Disable watchdog. */
	WDT_A->CTL = WDT_A_CTL_PW | WDT_A_CTL_HOLD;

	/* Enable interrupt handler. */
	__enable_irq();

    /* When an interrupt is triggered while sleeping, this bit makes
     * the microcontroller wake up. */
    SCB->SCR &= ~SCB_SCR_SLEEPONEXIT_Msk;

    /* Setup other stuff. */
    setup_ADC();
    setup_SP_interfaces();
    setup_timer();

    /* Use the LED as an output, and turn it on. */
    P1->DIR |= BIT0;
    P1->OUT = BIT0;

    /* Wait for the timer to interrupt. */
    while(1);
}

/* This function is called when the data interface 0 interrupts. */
void EUSCIB0_IRQHandler(void){return;}

/* This function is called when the data interface 1 interrupts. */
void EUSCIB1_IRQHandler(void){return;}

/* This function is called when the ADC interrupts. */
void ADC14_IRQHandler(void){return;}

/* This function is run when timer A0 interrupts. */
void TA0_0_IRQHandler(void)
{
	/* Clear timer interrupt bit. */
    TIMER_A0->CCTL[0] &= ~TIMER_A_CCTLN_CCIFG;

    /* Leave if we haven't hit the required number of overflows. */
    if(timerOverflows < TIMER_OVERFLOWS)
    {
    	timerOverflows++;
    	return;
    }
    timerOverflows = 0;

    /* Blink LED (if it's on, turn it off. If it's off, turn it on). */
	// printf("Timer has interrupted.\n");
    P1->OUT ^= BIT0;

    /* Perform a SPI read operation. */
	EUSCI_B0->TXBUF = 1;
	EUSCI_B1->TXBUF = 1;
	EUSCI_B3->TXBUF = 1;

    for(index=0; index<4; index++)
    {
    	/* Set the input bit low. This causes the thermocouples to begin
    	 * reading (if this has executed for the first time), or to
    	 * continue reading. */
    	EUSCI_B0->TXBUF = 0;
    	EUSCI_B1->TXBUF = 0;
    	EUSCI_B3->TXBUF = 0;

    	while(EUSCI_B0->IFG == 0);
    	spi0Result |= EUSCI_B0->RXBUF;
    	if(index <= 2){spi0Result <<= 8;}

    	while(EUSCI_B1->IFG == 0);
    	spi1Result |= EUSCI_B1->RXBUF;
    	if(index <= 2){spi1Result <<= 8;}

    	while(EUSCI_B3->IFG == 0);
    	spi2Result |= EUSCI_B3->RXBUF;
    	if(index <= 2){spi2Result <<= 8;}

    	/* Clear the interrupt flags. */
    	EUSCI_B0->IFG = 0;
    	EUSCI_B1->IFG = 0;
    	EUSCI_B3->IFG = 0;
    }

    /* Measure with, and read from ADC. */
    ADC14->CTL0 |= ADC14_CTL0_ENC | ADC14_CTL0_SC;
    while (!(ADC14->IFGR0 | BIT0));
    while (!(ADC14->IFGR0 | BIT1));
    while (!(ADC14->IFGR0 | BIT2));
    while (!(ADC14->IFGR0 | BIT3));
    while (!(ADC14->IFGR0 | BIT4));
    while (!(ADC14->IFGR0 | BIT5));
    adc0Result = ADC14->MEM[0];
    adc1Result = ADC14->MEM[1];
    adc2Result = ADC14->MEM[2];
    adc3Result = ADC14->MEM[3];
    adc4Result = ADC14->MEM[4];
    adc5Result = ADC14->MEM[5];

    /* Print measurements.*/
    /*printf("SPI0 Result: %u\nSPI1 Result: %u\nADC Measurement: %u\n",
    	   spi0Result, spi1Result, adc0Result);*/
    printf("\n%u, %u, %u, %u, %u, %u, %u, %u, %u", spi0Result, spi1Result, spi2Result, adc0Result, adc1Result, adc2Result, adc3Result,  adc4Result, adc5Result);

    /* Shift result data back to its original position. */
    spi0Result = 0;
    spi1Result = 0;
    spi2Result = 0;
    spi0Result >>= 24;
    spi1Result >>= 24;
    spi2Result >>= 24;

    /* Set the next interrupt time. */
    TIMER_A0->CCR[0] += TOGGLE_FREQUENCY;
}

Thanks,

Bezak

MSP430F2274: Configuring timerA and timerB to extend the time before an interrupt

$
0
0

Part Number:MSP430F2274

Hello,

My goal was was use an interrupt of timerA to start timerB, and have the interrupt of timerB cause an LED to toggle. The idea to double the length of time between interrupts by using both timers working off each other. The code I am working with is provided below:

#include <msp430.h>

void configWDT(void);
void configClocks(void);
void configGPIO(void);
void configTimerA(void);
void configTimerB(void);
void configADC(void);

unsigned volatile int blink_cnt;
int main(void)
{
    blink_cnt = 0;
    configWDT();
    configClocks();
    configGPIO();
    configTimerA();

    while(1)
    {
        __bis_SR_register(LPM3_bits + GIE);             // Enter LPM3
        if(blink_cnt == 0 || blink_cnt > 0)
        {
            P1OUT ^= BIT0;
        }
    }
}


void configWDT(void)
{
    WDTCTL = WDTPW + WDTHOLD;
}


void configClocks()
{
    DCOCTL |= DCO1 + DCO0;
    BCSCTL1 |= XT2OFF + DIVA_3 + RSEL2 + RSEL1 + RSEL0;
    BCSCTL2 |= SELM_3 + SELS;
    BCSCTL3 |= XT2S_3 + XCAP_3;
}


void configGPIO(void)
{
    P1DIR |= 0x03;                            // P1.1 output
    P1SEL |= 0x02;                            // P1.1 option select

    P4DIR |= 0x06;                            // P4.1 and P4.2 output
    P4SEL |= 0x06;                            // P4.1 and P4.2 TB1/2 otions
}


void configTimerA(void)
{
    TACCTL0 |= OUTMOD_4;                       // TACCR0 toggle mode
    TACCR0 |= 0xFFFF;
    TACTL |= TASSEL_1 + ID_3 + MC_3 + TAIE;    // ACLK, up-downmode
}


void configTimerB(void)
{
    TBCCTL0 |= OUTMOD_4;
    TBCCR0 |= 0xFFFF;
    TBCTL |= TBSSEL_1 + ID_3 + MC_3 + TBIE;
}


// Timer_A3 Interrupt Vector (TAIV) handler
#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
#pragma vector=TIMERA1_VECTOR
__interrupt void Timer_A(void)
#elif defined(__GNUC__)
void __attribute__ ((interrupt(TIMERA1_VECTOR))) Timer_A (void)
#else
#error Compiler not supported!
#endif
{
    switch(TAIV)        // Efficient switch-implementation
    {
        case  2:
            break;                        // TACCR1 not used
        case  4:
            break;                        // TACCR2 not used
        case 10:
            configTimerB();
            //blink_cnt++;
            break;
    }
    __bic_SR_register_on_exit(LPM3_bits);
}


// Timer_B3 Interrupt Vector (TAIV) handler
#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
#pragma vector=TIMERB1_VECTOR
__interrupt void Timer_B(void)
#elif defined(__GNUC__)
void __attribute__ ((interrupt(TIMERB1_VECTOR))) Timer_A (void)
#else
#error Compiler not supported!
#endif
{
    switch(TBIV)        // Efficient switch-implementation
    {
        case  2:
            break;                        // TACCR1 not used
        case  4:
            break;                        // TACCR2 not used
        case 10:
            blink_cnt++;
            break;
    }
    __bic_SR_register_on_exit(LPM3_bits);
}

When testing this, the length of time between interrupts is the same length as it was when just using timerA. My question is if the timer continuously runs even when in an ISR? If so, should the timerA be halted when the time that timerB is running? Another question is if the timers are set up correctly? The specifications would be to have each timer run in up/down mode, off ACLK which is divided by eight. Thanks


MSP430FR2433: Please provide link to "Debugging MSP430 LPM4.5" App Report

$
0
0

Part Number:MSP430FR2433

Several threads in the forum refer to the document but the links are broken and a web search on those words doesn't find the document.

CCS/MSP-FET430UIF: Customer is looking for software

$
0
0

Part Number:MSP-FET430UIF

Tool/software: Code Composer Studio

Hello,

We have a customer who is trying to find software for the MSP-FET430UIF. Customer has the disc, but does not have a drive to install the software. I searched Yoda, found the literature reference printed on his software disc, but not finding a software release package associated with it. SLYC045D is the literature reference.

Could someone please direct us to the version of the software which was associated with literature reference SLYC045D?

Thank you,

CCS/MSP430FR5994: interfacing SDcard with MSP430FR5994

$
0
0

Part Number:MSP430FR5994

Tool/software: Code Composer Studio

Hello, I'm trying to transmit .wav file from SD card to MSP430FR5994 using SPI.  I'm unable to implement it. Please provide me some suggestion.

#include <msp430.h>

volatile char received_ch = [];
int main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
// Configure USCI_B0 for SPI operation
UCB0CTLW0 = UCSWRST; // **Put state machine in reset**
UCB0CTLW0 = UCMST | UCSYNC | UCMSB | UCCKPH; // 3-pin synchronous, 8-bit SPI master, MSB first

// Clock phase select - data capture on raising edge

UCB0CTLW0 |= UCSSEL__ACLK; // Clock source select - ACLK
UCB0BR0 = 0x02; // /2
UCB0BR1 = 0; //
UCB0CTLW0 &= ~UCSWRST; // **Initialize USCI state machine**
UCB0IE &= ~UCRXIE; // Receive interrupt disabled
UCB0IE &= ~UCTXIE; // Transmit interrupt disabled
__bis_SR_register(GIE); //enable interrupts

// Configure GPIO

// P1.6 -> B0 MOSI

// P1.7 -> B0 MISO

// P2.2 -> B0 CLK

P1DIR |= BIT6;
P1DIR &= ~BIT7;
P2DIR |= BIT2;
P1SEL1 |= BIT6 | BIT7;
P2SEL1 |= BIT2;
P1DIR |= BIT2;

//Transmitter shut-down pin and TRX slave-select

while (!(IFG2 & UCA0RXIFG))
; // USCI_A0 RX Received?
{
for (i = 0; i < 512; i++) //DATA BLOCK
{
received_ch[i] = UCA0RXBUF; // Store received data
i++;
}
}
}

RTOS/MSP432E401Y: MSP432E401Y

$
0
0

Part Number:MSP432E401Y

Tool/software: TI-RTOS

I am interested in working this exact example but am unable to find any documentation or code on the topic.  Can anyone lead me in the right direction?  

MSP430FR6047: About the SNAA284A-Analog Design to Ultrasonic Gas Flow Meter

$
0
0

Part Number:MSP430FR6047

Hi ,

I read the application report SNAA284A wriite by Bahram Mirshab. It's a very good document. But I still need more help about how to design the receiver circuit deferentially. In the application report the author said it is possible to design a circuit to match the impedance with the transmit circuit.

@Bahram Mirshab 

Viewing all 22224 articles
Browse latest View live


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