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

CCS/EVM430-FR6047: MIsmatch between the flowrate calculated and output LPS

$
0
0

Part Number:EVM430-FR6047

Tool/software: Code Composer Studio

Hello,

I have measured the flow at different flowrates for a 2 inch pipe. I have calibrated using the LPS output from the excel output of USS GUI which appears to be almost linear. I have also manually calculated the (tup - tdown)/(tup*tdown) and compared with the true value. The trend is very erratic (unusable) whereas it has to be the same as LPS. How can we calculate the flow rate by ourselves using the tup, tdown and DelTOF or are we supposed to use only the LPS output.

Regards,

Prudhvi Sagar


MSP430FR5994: Comparator (COMP_E) interrupt triggers at startup

$
0
0

Part Number:MSP430FR5994

Hi,

I have the COMP_E analog comparator module setup as follows:

    //Initialize the Comparator E module
    /*
     * Base Address of Comparator E,
     * Pin CE13 to Positive(+) Terminal
     * Reference Voltage to Negative(-) Terminal
     * Normal Power Mode
     * Output Filter On with minimal delay
     * Non-Inverted Output Polarity
     */
    Comp_E_initParam param = {0};
    param.posTerminalInput = COMP_E_INPUT5;
    param.negTerminalInput = COMP_E_VREF;
    param.outputFilterEnableAndDelayLevel = COMP_E_FILTEROUTPUT_DLYLVL4;
    param.invertedOutputPolarity = COMP_E_NORMALOUTPUTPOLARITY;
    Comp_E_init(COMP_E_BASE, &param);

    //Set the reference voltage that is being supplied to the (-) terminal
    /*
     * Base Address of Comparator E,
     * Reference Voltage of 2.0 V,
     * Lower Limit of 2.0*(22/32) = 1.375V,
     * Upper Limit of 2.0*(22/32) = 1.375V
     */
    Comp_E_setReferenceVoltage(COMP_E_BASE,
        COMP_E_VREFBASE2_0V,
        22,
        22
        );

    //Enable COMP_E Interrupt on default rising edge for CEIFG
    Comp_E_setInterruptEdgeDirection(COMP_E_BASE, COMP_E_RISINGEDGE);
    // Clear any erroneous interrupts
    Comp_E_clearInterrupt(COMP_E_BASE, (COMP_E_OUTPUT_INTERRUPT_FLAG + COMP_E_INTERRUPT_FLAG_INVERTED_POLARITY));

    //Enable Interrupts
    /*
     * Base Address of Comparator E,
     * Enable COMPE Interrupt on default rising edge for CEIFG
     */
    Comp_E_clearInterrupt(COMP_E_BASE, COMP_E_OUTPUT_INTERRUPT_FLAG);


    Comp_E_enableInterrupt(COMP_E_BASE, COMP_E_OUTPUT_INTERRUPT);

    //Allow power to Comparator module
    Comp_E_enable(COMP_E_BASE);

    __delay_cycles(400);           // delay for the reference to settle

    __enable_interrupt();



//******************************************************************************
//
//This is the COMP_E_VECTOR interrupt vector service routine.
//
//******************************************************************************
#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
#pragma vector=COMP_E_VECTOR
__interrupt
#elif defined(__GNUC__)
__attribute__((interrupt(COMP_E_VECTOR)))
#endif
void COMP_E_ISR(void){
    if (enableVM){
        //Toggle the edge at which an interrupt is generated
        Comp_E_toggleInterruptEdgeDirection(COMP_E_BASE);

        //Clear Interrupt flag
        Comp_E_clearInterrupt(COMP_E_BASE, COMP_E_OUTPUT_INTERRUPT_FLAG);

        //Toggle P1.0 output pin.
        GPIO_toggleOutputOnPin( GPIO_PORT_P1, GPIO_PIN0 );
    }
}

The code toggles LED P1.0 when input voltage goes above or below the reference voltage (1.375V). Input is from pin P1.5. When I toggle the input voltage the interrupt fires as expected.

When the system starts up the LED lights up, But i've put the LED to LOW at startup (before the comparator is initialized) like so:

// P1.0 (LED)
GPIO_setAsOutputPin(GPIO_PORT_P1, GPIO_PIN0);
GPIO_setOutputLowOnPin(GPIO_PORT_P1,GPIO_PIN0);

So I suspect the COMP_E interrupt is firing immediately when enabled. Why is this ? have I configured it incorrectly ?

thanks

MSP430G2544: BGA package, layout/design guidelines

$
0
0

Part Number:MSP430G2544

Team,

we will use MSP430 in BGA49 package YYF (R-XBGA-N49). I wonder what is recommended landing pattern for it.

I have found document www.ti.com/.../spraav1b.pdf, which describes recommended PCB Design
Guidelines for 0.4mm Package-On-Package for OMAP350 processors. Is it valid for smaller BGA49 of MSP430GxxxYYF, too?

Namely what about solder-mask-defined pads vs. non-solder-mask-defined pads design. Please advise.

Thanks for your help.

CCS/MSP-EXP430FR2355: I am not able to get interrupt code working

$
0
0

Part Number:MSP-EXP430FR2355

Tool/software: Code Composer Studio

Hi everyone,

I am a newbie for interrupt coding. I am using TimerB interrupt for MSP430FR2355 device. Could you please let me know what is wrong in the following code? 

int main(void)
{

WDTCTL = WDTPW | WDTHOLD; // stop watchdog timer

P1DIR |= BIT0; // Set pin with LED1 to output

TB0CCR0 = 100;

TB0CCTL0 = CCIE;

TB0CTL = MC_1|ID_3|TBSSEL_1|TBCLR; //set up timer and start it

}


#pragma vector = TIMER0_B1_VECTOR
__interrupt void TB1_ISR (void)
{
// P1OUT |= BIT0;
while(1) {
volatile unsigned int i; // volatile to prevent optimization

P1OUT ^= 0x01; // Toggle P1.0 using exclusive-OR

i = 10000; // SW Delay
do i--;
while(i != 0);
}

}

From all the references online, it looks like I have all the steps required to use an interrupt. Any help is greatly appreciated. Thank you.

- Ritika

MSP430F5342: "Device secured" message after custom BSL download

$
0
0

Part Number:MSP430F5342

Hello,

I have recently tried to create a custom BSL for the MSP430F5342 device using the template found in the MSP430 Custom BSL Package.

I used the template for the MSP430F543xA device and changed the memory map to a) adapt it to my device and b) load the BSL code into the BSL section (according to the .map file in the template, the code is loaded into flash starting at 0x10000 instead of the BSL area starting at 0x1000.) When trying to load the sample BSL code into the BSL area, there is not enough space and so an overflow area is needed. To accommodate this, I made the following modifications to lnk_msp430f5342.cmd:

In the MEMORY section:

    /* Get rid of INFO MEM sections
    INFOA                   : origin = 0x1980, length = 0x0080
    INFOB                   : origin = 0x1900, length = 0x0080
    INFOC                   : origin = 0x1880, length = 0x0080
    INFOD                   : origin = 0x1800, length = 0x0080 //Use this area for BSL OverFlow
	*/
    // Added BSL & BSLOF (overflow) section -------------------------------
    BSL						: origin = 0x1042, length = 0x7AE
    BSLOF					: origin = 0x1880, length = 0x200
	// --------------------------------------------------------------------

in the SECTIONS section:

	//Place all output sections into newly defined memory sections
    .text       : {} >> BSL | BSLOF			// Code
    .text:_isr  : {} >> BSL | BSLOF			// ISR code space
    .cinit      : {} > BSL | BSLOF	        // Initialization tables
    .const      : {} >> BSL | BSLOF         // Constant data
    .cio        : {} > RAM                  // C I/O Buffer

    .pinit      : {} > BSL | BSLOF          // C++ Constructor tables
    .binit      : {} > BSL | BSLOF          // Boot-time Initialization tables
    .init_array : {} > BSL | BSLOF          // C++ Constructor tables
    .mspabi.exidx : {} > BSL | BSLOF        // C++ Constructor tables
    .mspabi.extab : {} > BSL | BSLOF        // C++ Constructor tables

#ifdef __TI_COMPILER_VERSION__
  #if __TI_COMPILER_VERSION__ >= 15009000
    .TI.ramfunc : {} load=BSL | BSLOF, run=RAM, table(BINIT)
  #endif
#endif

The project compiled successfully and I was able to load it into the device. However, after loading it a few more times I am no longer able to access the device and get the message that

"Error connecting to the target:
The Debug Interface to the device has been secured"

I do not understand why this happened. I checked the BSL430_API.c file and the lock key is still 0xFFFFFFFF in my project so the JTAG fuse should not have blown. What is causing this behavior? Is it possible to unlock the device?

Thank you,

svl123

MSP430F248: End Of Life Official TI's Statement.

$
0
0

Part Number:MSP430F248

Hi Folks,

Can Anyone At Texas Instruments Provide Me With The EOL Statement

for the MSP430F248?

We are engaging in a new subsystem design and we would like to have

TI's Blessing about the longevity of this particular MSP430F248.

An official letter (with TI's Header) to my e-mail address will be very appropriate.

My e-mail address is erubin@Ttetracore.com

Very Respectfully,

Ephi Rubin,

Sr. Hardware Engineer

CCS/MSP430FR6989: Multiple ADC Signals CCS Assembler Code BoosterPack BOOSTXL-MKII

$
0
0

Part Number:MSP430FR6989

Tool/software: Code Composer Studio

I am trying to set-up the code to activate both the horizontal and vertical axis of the joystick on a BoosterPack MKII attached to my MSP430FR6989 Launchpad (by setting ADC signals to the pins controlling the horizontal and vertical axes). With the setup I have now, the code always jumps to the code for ADCMEM1 interrupt (and hence execute MEM1) no matter what. This is how my setup looks right now: Please let me know what is possibly causing the code to always jump to MEM1. 



;P9.2 is horizontal joystick axis A10 is the ADC signal
;P8.7 is vertical joystick axis A4 is the ADC signal


SetupP9 bis.b #BIT2,&P9SEL0 ;
bis.b #BIT2,&P9SEL1 ;
SetupP8 bis.b #BIT7,&P8SEL0 ;
bis.b #BIT7,&P9SEL1 ;


SetupADC12 mov.w #ADC12SHT0_2+ADC12ON+ADC12MSC,&ADC12CTL0 ; 16x
bis.w #ADC12SHP+ADC12CONSEQ_1,&ADC12CTL1 ; ADCCLK = MODOSC; sampling timer
bis.w #ADC12RES_2,&ADC12CTL2 ; 12-bit conversion results
bis.w #ADC12INCH_10,&ADC12MCTL0; A10 ADC input select; Vref=AVCC
bis.w #ADC12INCH_4+ADC12EOS,&ADC12MCTL1
bis.w #ADC12IE1,&ADC12IER0 ; Enable ADC conv complete interrupt

Mainloop mov.w #2500,R15 ; Delay ~5000 cycles between conversions
L1 dec.w R15 ; Decrement R15
jnz L1 ; Delay over?
bis.w #ADC12ENC+ADC12SC,&ADC12CTL0 ; Start sampling/conversion
nop ;
bis.w #LPM0+GIE,SR ; Enter LPM0 w/ interrupt
nop ; for debug
jmp Mainloop ; Again
nop

;-------------------------------------------------------------------------------
ADC12_ISR; ADC12 interrupt service routine
;-------------------------------------------------------------------------------
add.w &ADC12IV,PC ; add offset to PC
reti ; Vector 0: No interrupt
reti ; Vector 2: ADC12MEMx Overflow
reti ; Vector 4: Conversion time overflow
reti ; Vector 6: ADC12HI
reti ; Vector 8: ADC12LO
reti ; Vector 10: ADC12IN
jmp MEM0 ; Vector 12: ADC12MEM0 Interrupt
jmp MEM1 ; Vector 14: ADC12MEM1
reti ; Vector 16: ADC12MEM2
reti ; Vector 18: ADC12MEM3
reti ; Vector 20: ADC12MEM4
reti ; Vector 22: ADC12MEM5
reti ; Vector 24: ADC12MEM6
reti ; Vector 26: ADC12MEM7
reti ; Vector 28: ADC12MEM8
reti ; Vector 30: ADC12MEM9
reti ; Vector 32: ADC12MEM10
reti ; Vector 34: ADC12MEM11
reti ; Vector 36: ADC12MEM12
reti ; Vector 38: ADC12MEM13
reti ; Vector 40: ADC12MEM14
reti ; Vector 42: ADC12MEM15
reti ; Vector 44: ADC12MEM16
reti ; Vector 46: ADC12MEM17
reti ; Vector 48: ADC12MEM18
reti ; Vector 50: ADC12MEM19
reti ; Vector 52: ADC12MEM20
reti ; Vector 54: ADC12MEM21
reti ; Vector 56: ADC12MEM22
reti ; Vector 58: ADC12MEM23
reti ; Vector 60: ADC12MEM24
reti ; Vector 62: ADC12MEM25
reti ; Vector 64: ADC12MEM26
reti ; Vector 66: ADC12MEM27
reti ; Vector 68: ADC12MEM28
reti ; Vector 70: ADC12MEM29
reti ; Vector 72: ADC12MEM30
reti ; Vector 74: ADC12MEM31
reti ; Vector 76: ADC12RDY

MEM1
;Do MEM1 Stuff
bic.w #LPM0,0(SP)
reti

MEM0 
;Do MEM0 stuff
bic.w #LPM0,0(SP)
reti

;------------------------------------------------------------------------------
; Interrupt Vectors
;------------------------------------------------------------------------------
.sect ".reset" ; MSP430 RESET Vector
.short RESET ;
.sect ADC12_VECTOR ; ADC12 Vector
.short ADC12_ISR ;
.end

MSP-FET: What's max output current on pin 2?

$
0
0

Part Number:MSP-FET

Hi Team,

May I know the max output current of MSP-FET pin 2(VCC-TOOL)? Thanks.

Best regards,

Penny


MSP430F479: UART data not correct

$
0
0

Part Number:MSP430F479

Hi,

I am trying to send one byte of data over the UART at a baud rate of 115200 Hz. I am using the BM70 ble module to transfer the data and the baud rate of the BM70 module is also 115200 Hz. I have connected the TX and RX pins of MSP430 of the RX and TX pins of BM70 module. I am just putting the byte I want to send in the Txbuffer of the MSP430 to see the data without using any interrupt. But when I send the data over the UART, it sends garbage data which I can see from the mobile app. Can you please tell me what I am doing wrong here?

Thanks

MSP430FR5994: MSP430FR Main Mem Boot loader

$
0
0

Part Number:MSP430FR5994

Dear Sirs:

     I'm trying to run the perl code converter 430txt2c_20bit from the utilities\430txtconverter\ directory but the code executes so fast that I can't read what it is doing.

Is there a way to slow this down to see what's going on?

Also am I running it from the correct directory?

Thanks

John Moore

RTOS/MSP432E401Y: problem using pin PD7 as a GPIO do control an LED

$
0
0

Part Number:MSP432E401Y

Tool/software: TI-RTOS

Hello,

I've had success using pins PD0-PD6 to control LED's, but I can't seem to get PD7 to function correctly. I'm using the following snippets to configure and toggle the LED's. I see in the datasheet PD7 has the following alternate functions: SSI2XDAT2, USB0PFLT, T4CCP1, U2CTS, and NMI. Could one of these functions be preventing me from using it?

// from MSP_EXP432E401y.c
/*
 * Array of Pin configurations
 * NOTE: The order of the pin configurations must coincide with what was
 *       defined in MSP_EXP432E401Y.h
 * NOTE: Pins not used for interrupts should be placed at the end of the
 *       array.  Callback entries can be omitted from callbacks array to
 *       reduce memory usage.
 */
GPIO_PinConfig gpioPinConfigs[] = {
    /* Input pins */
    /* MSP_EXP432E401Y_USR_SW1 */
    GPIOMSP432E4_PJ0 | GPIO_CFG_IN_PU | GPIO_CFG_IN_INT_RISING,
    /* MSP_EXP432E401Y_USR_SW2 */
    GPIOMSP432E4_PJ1 | GPIO_CFG_IN_PU | GPIO_CFG_IN_INT_RISING,

    /* MSP_EXP432E401Y_SPI_MASTER_READY */
    GPIOMSP432E4_PM3 | GPIO_DO_NOT_CONFIG,

    // my pins
    // eth led_1
    GPIOMSP432E4_PF0 | GPIO_CFG_OUT_STD | GPIO_CFG_OUT_STR_HIGH | GPIO_CFG_OUT_LOW,
    // eth led_2
    GPIOMSP432E4_PF4 | GPIO_CFG_OUT_STD | GPIO_CFG_OUT_STR_HIGH | GPIO_CFG_OUT_LOW,
    // eth led 3
    GPIOMSP432E4_PG0 | GPIO_CFG_OUT_STD | GPIO_CFG_OUT_STR_HIGH | GPIO_CFG_OUT_LOW,
    // rs232 tx_1
    GPIOMSP432E4_PD0 | GPIO_CFG_OUT_STD | GPIO_CFG_OUT_STR_HIGH | GPIO_CFG_OUT_LOW,
    // rs232 rx_1
    GPIOMSP432E4_PD1 | GPIO_CFG_OUT_STD | GPIO_CFG_OUT_STR_HIGH | GPIO_CFG_OUT_LOW,
    // rs232 tx_2
    GPIOMSP432E4_PD2 | GPIO_CFG_OUT_STD | GPIO_CFG_OUT_STR_HIGH | GPIO_CFG_OUT_LOW,
    // rs232 rx_2
    GPIOMSP432E4_PD3 | GPIO_CFG_OUT_STD | GPIO_CFG_OUT_STR_HIGH | GPIO_CFG_OUT_LOW,
    // rs232 tx_3
    GPIOMSP432E4_PD4 | GPIO_CFG_OUT_STD | GPIO_CFG_OUT_STR_HIGH | GPIO_CFG_OUT_LOW,
    // rs232 rx_3
    GPIOMSP432E4_PD5 | GPIO_CFG_OUT_STD | GPIO_CFG_OUT_STR_HIGH | GPIO_CFG_OUT_LOW,
    // rs232 tx_4
    GPIOMSP432E4_PD6 | GPIO_CFG_OUT_STD | GPIO_CFG_OUT_STR_HIGH | GPIO_CFG_OUT_LOW,
    // rs232 rx_4
    GPIOMSP432E4_PD7 | GPIO_CFG_OUT_STD | GPIO_CFG_OUT_STR_HIGH | GPIO_CFG_OUT_LOW,// <---PD7 CONFIG
    // io led_green
    GPIOMSP432E4_PL0 | GPIO_CFG_OUT_STD | GPIO_CFG_OUT_STR_HIGH | GPIO_CFG_OUT_LOW,
    // io led_red
    GPIOMSP432E4_PL1 | GPIO_CFG_OUT_STD | GPIO_CFG_OUT_STR_HIGH | GPIO_CFG_OUT_LOW,
    // io led_amber
    GPIOMSP432E4_PL2 | GPIO_CFG_OUT_STD | GPIO_CFG_OUT_STR_HIGH | GPIO_CFG_OUT_LOW,
    // end my pins

    /* Output pins */
    /* MSP_EXP432E401Y_USR_D1 */
    //GPIOMSP432E4_PN1 | GPIO_CFG_OUT_STD | GPIO_CFG_OUT_STR_HIGH | GPIO_CFG_OUT_LOW,
    /* MSP_EXP432E401Y_USR_D2 */
    //GPIOMSP432E4_PN0 | GPIO_CFG_OUT_STD | GPIO_CFG_OUT_STR_HIGH | GPIO_CFG_OUT_LOW,

    /* MSP_EXP432E401Y_SDSPI_CS */
    GPIOMSP432E4_PC7 | GPIO_CFG_OUT_STD | GPIO_CFG_OUT_STR_HIGH | GPIO_CFG_OUT_HIGH,

    /* Sharp Display - GPIO configurations will be done in the Display files */
    GPIOMSP432E4_PE5 | GPIO_DO_NOT_CONFIG, /* SPI chip select */
    GPIOMSP432E4_PC6 | GPIO_DO_NOT_CONFIG, /* LCD power control */
    GPIOMSP432E4_PE4 | GPIO_DO_NOT_CONFIG, /*LCD enable */
};

// from MSP_EXP432E401y.h
typedef enum MSP_EXP432E401Y_GPIOName {
    MSP_EXP432E401Y_GPIO_USR_SW1 = 0,
    MSP_EXP432E401Y_GPIO_USR_SW2,
    MSP_EXP432E401Y_SPI_MASTER_READY,

    // my pins
    ETH_LED1,//MSP_EXP432E401Y_GPIO_PF0,
    ETH_LED2,//MSP_EXP432E401Y_GPIO_PF4,
    ETH_LED3,//MSP_EXP432E401Y_GPIO_PG0
    UART4_TX_LED,//MSP_EXP432E401Y_GPIO_PD0,
    UART4_RX_LED,//MSP_EXP432E401Y_GPIO_PD1,
    UART5_TX_LED, //MSP_EXP432E401Y_GPIO_PD2,
    UART5_RX_LED,//MSP_EXP432E401Y_GPIO_PD3,
    UART2_TX_LED,//MSP_EXP432E401Y_GPIO_PD4,
    UART2_RX_LED,//MSP_EXP432E401Y_GPIO_PD5,
    UART3_TX_LED,//MSP_EXP432E401Y_GPIO_PD6,
    UART3_RX_LED,//MSP_EXP432E401Y_GPIO_PD7,
    STATUS_GREEN_LED,//MSP_EXP432E401Y_GPIO_PL0,
    STATUS_RED_LED,//MSP_EXP432E401Y_GPIO_PL1,
    STATUS_AMBER_LED,//MSP_EXP432E401Y_GPIO_PL2,

    MSP_EXP432E401Y_SDSPI_CS,

    /* Sharp 96x96 LCD Pins */
    MSP_EXP432E401Y_LCD_CS,
    MSP_EXP432E401Y_LCD_POWER,
    MSP_EXP432E401Y_LCD_ENABLE,

    MSP_EXP432E401Y_GPIOCOUNT
} MSP_EXP432E401Y_GPIOName;

// from main_tirtos.c
GPIO_write(UART4_TX_LED, 1);
GPIO_write(UART4_RX_LED, 1);
GPIO_write(UART5_TX_LED, 1);
GPIO_write(UART5_RX_LED, 1);
GPIO_write(UART2_TX_LED, 1);
GPIO_write(UART2_RX_LED, 1);
GPIO_write(UART3_TX_LED, 1);
GPIO_write(UART3_RX_LED, 1);

CCS/MSP432E401Y: Enable UART interrupt

$
0
0

Part Number:MSP432E401Y

Tool/software: Code Composer Studio

Hello ,

I would like to install an interrupt for UART 7 in the project tcpecho_MSP_EXP432E401Y_tirtors_ccs, so that when a signal arrives on UART 7 it will be sent to the PC via tcp.  

I used a part from the project uartecho (I test first with UART0), But I think my interrupt handler for UART is not registered.

Is there a quick way to implement that? I'm a little bit in time pressure.

best regards,

fares rabuts

MSP430FR2433: Can't get Uart to send correct data to other msp over HC-05

$
0
0

Part Number:MSP430FR2433

So basically here is the layout. I have one Master HC-05 Bluetooth Module  connected to one MSP with a joystick, the other has the Slave.

Here is the code for the Master HC-05 MSP

FIRST MSP CODE

#include "msp430.h" ; #define controlled include file

NAME main ; module name

PUBLIC main ; make the main label vissible
; outside this module
ORG 0FFFEh
DC16 init ; set reset vector to 'init' label

RSEG CSTACK ; pre-declaration of segment
RSEG CODE ; place program in 'CODE' segment

RSEG DATA16_N
TXData DW 0h
Voltage DW 0h
init: MOV #SFE(CSTACK), SP ; set up stack

main: NOP ; main program
MOV.W #WDTPW+WDTHOLD,&WDTCTL ; Stop watchdog timer

;18:E4:35F093 <-- Bluetooth Address

;Ports
bis.b #BIT0, P1DIR
bic.b #BIT0, P1OUT

;Push Button Setup
BIS.B #BIT7, &P2REN ;P2.7 Pullup or Pulldown register enabled
BIS.B #BIT7, &P2OUT ;P2.7 Set as Pulldown register
BIS.B #BIT7, &P2IES ;P2.7 Lo/Hi edge enabled
BIC.B #BIT7, &P2IFG ;P2.7 IFG cleared

;Setup Clock
bis.w #SCG0, SR
bis.w #SELREF__REFOCLK, &CSCTL3 ;Creates reference for Clock Source = REFOCLK
mov.w #0, &CSCTL0
bic.w #DCORSEL_7, &CSCTL1 ; Clear data @ CSCTL1
bis.w #DCORSEL_0, &CSCTL1 ;Set DCO for 1 MHZ Operation
mov.w #FLLD_0+30, &CSCTL2 ;FLLD+30 = FLLD for 1mhz DCO
bic.w #SCG0, SR

;Setup ADC
mov.w #ADCPCTL1, &SYSCFG2
bic.w #LOCKLPM5, PM5CTL0
mov.w #ADCSHT_2|ADCON, &ADCCTL0
bis.w #ADCSHP, &ADCCTL1
bis.w #ADCRES, &ADCCTL2
bis.w #ADCINCH_1, &ADCMCTL0
bis.w #ADCIE0, &ADCIE

unlockFLL:
mov.w &CSCTL7, R13
and.w #FLLUNLOCK0|FLLUNLOCK1, R13
jnz unlockFLL
mov.w #SELMS__DCOCLKDIV+SELA__REFOCLK, &CSCTL4
bic.w #LOCKLPM5,PM5CTL0

;Setup Uart
bis.b #BIT4+BIT5, &P1SEL0
bis.w #UCSWRST, &UCA0CTLW0
bis.w #UCSSEL__SMCLK,&UCA0CTLW0
mov.b #104, UCA0BR0
clr.b &UCA0BR1
bis.w #UCBRS0, &UCA0MCTLW
bic.w #UCSWRST, &UCA0CTLW0

MainLoop:
bis.w #ADCENC|ADCSC, &ADCCTL0
nop
bis.w #LPM3+GIE, SR
nop

cmp #250h, Voltage
jhs L2
cmp #01ffh,Voltage
jl L3
bic.b #BIT0, &P1OUT
jmp MainLoop
bit.w #0x03, TXData
call #Send_Data
jmp MainLoop
L3:
bit.w #0x01, TXData
xor.b #BIT0, P1OUT
call #Send_Data
jmp MainLoop
L2:
bit.w #0x02, TXData
xor.b #BIT0, P1OUT
call #Send_Data
jmp MainLoop


ADC_ISR:
mov.w &ADCMEM0, Voltage
bic.w #LPM3, 0(SP)
reti

Send_Data:
cmp.w #0x1, &UCTXIFG
jz Send_Data
mov.w TXData, &UCA0TXBUF
ret

COMMON INTVEC
ORG ADC_VECTOR
DW ADC_ISR


END



SECOND MSP Code

Here is the code for my Slave MSP

#include "msp430.h" ; #define controlled include file

NAME main ; module name

PUBLIC main ; make the main label vissible
; outside this module
ORG 0FFFEh
DC16 init ; set reset vector to 'init' label

RSEG CSTACK ; pre-declaration of segment
RSEG CODE ; place program in 'CODE' segment
RSEG DATA16_N
RXData DW 0h

init: MOV #SFE(CSTACK), SP ; set up stack

main: NOP ; main program
MOV.W #WDTPW+WDTHOLD,&WDTCTL ; Stop watchdog timer

;18:E4:35F093 <-- Bluetooth Address

;Ports
bis.b #BIT0, P1DIR
bic.b #BIT0, P1OUT
;Relay Ports

;Forward
;Front
bis.b #BIT0, P2DIR
bis.b #BIT1, P2DIR
bis.b #BIT0, P2OUT
bic.b #BIT1, P2OUT
;Back
bis.b #BIT5, P2DIR
bis.b #BIT6, P2DIR
bis.b #BIT5, P2OUT
bic.b #BIT6, P2OUT
;Backward
;Front
bis.b #BIT0, P2DIR
bis.b #BIT1, P2DIR
bis.b #BIT1, P2OUT
bic.b #BIT0, P2OUT
;Back
bis.b #BIT5, P2DIR
bis.b #BIT6, P2DIR
bis.b #BIT6, P2OUT
bic.b #BIT5, P2OUT

bis.w #SCG0, SR
bis.w #SELREF__REFOCLK, &CSCTL3 ;Creates reference for Clock Source = REFOCLK
mov.w #0, &CSCTL0
bic.w #DCORSEL_7, &CSCTL1 ; Clear data @ CSCTL1
bis.w #DCORSEL_0, &CSCTL1 ;Set DCO for 1 MHZ Operation
mov.w #FLLD_0+30, &CSCTL2 ;FLLD+30 = FLLD for 1mhz DCO
nop
nop
nop
bic.w #SCG0, SR

unlockFLL:
mov.w &CSCTL7, R13
and.w #FLLUNLOCK0|FLLUNLOCK1, R13
jnz unlockFLL

mov.w #SELMS__DCOCLKDIV+SELA__REFOCLK, &CSCTL4

bic.w #LOCKLPM5,PM5CTL0

bis.b #BIT4+BIT5, &P1SEL0
bis.w #UCSWRST, &UCA0CTLW0
bis.w #UCSSEL__SMCLK,&UCA0CTLW0

mov.b #104, UCA0BR0
clr.b &UCA0BR1
bis.w #UCBRS0, &UCA0MCTLW
bic.w #UCSWRST, &UCA0CTLW0
clr.w RXData


bis.w #UCRXIE, &UCA0IE
nop
bis.w #LPM3+GIE,SR
nop

USC_ISR:
mov.w &UCA0RXBUF, RXData
bic.w #UCRXIFG, &UCA0IFG
xor.b #BIT0, P1OUT
reti

COMMON INTVEC
org USCI_A0_VECTOR
dw USC_ISR
END

I can get it to transmit whenever I toggle a Joystick and toggle the light, but I am getting some funky data. I tried to transfer only #0x01, but am getting like 255 on the other end. Any suggestions on how to fix this?

MSP430FR2355: LMP4.5 exit issue

$
0
0

Part Number:MSP430FR2355

Hi,

I am trying to generate a LMP4.5 exit however the device never detects the interrupt on my PCB.

I have the MCU to go into deep sleep mode (LMP4.5) and as soon as I press a switch on pin 2.4 to come out of this mode.

My code is as follows:

 int main()
{
 WDTCTL = WDTPW + WDTHOLD;	// stop watchdog timer

 P1DIR = 0xFF; P2DIR = 0xFF; P3DIR = 0xFF; P4DIR = 0xFF; P5DIR = 0xFF; P6DIR = 0xFF;
 P1REN = 0xFF; P2REN = 0xFF; P3REN = 0xFF; P4REN = 0xFF; P5REN = 0xFF; P6REN = 0xFF;
 P1OUT = 0x00; P2OUT = 0x00; P3OUT = 0x00; P4OUT = 0x00; P5OUT = 0x00; P6OUT = 0x00;

 // Disable the GPIO power-on default high-impedance mode
 // to activate previously configured port settings
 PM5CTL0 &= ~LOCKLPM5;

 // Configure 16MHz XTAL
 // Configure one FRAM waitstate as required by the device datasheet for MCLK
 // operation beyond 8MHz _before_ configuring the clock system.
 FRCTL0 = FRCTLPW | NWAITS_1;

 CSCTL6 |= XTS + XT1HFFREQ_2;                // Select XT1 HF mode
                                                      // Set the appropriate high frequency for the crystal @16MHz
 CSCTL4 = SELMS__XT1CLK | SELA__REFOCLK;     // Set MCLK = XT1CLK = 4MHz
                                                      // XT1CLK = MCLK and SMCLK source

 P2SEL1 |= BIT6 | BIT7;                      // P2.6~P2.7: crystal pins
 do
 {
   CSCTL7 &= ~(XT1OFFG | DCOFFG);      // Clear XT1 and DCO fault flag
   SFRIFG1 &= ~OFIFG;
 } while (SFRIFG1 & OFIFG);              // Test oscillator fault flag
 CSCTL5 |= DIVM_0 | DIVS_1;              // MCLK = XT1CLK = 16MHZ,
                                         // SMCLK = MCLK/2 = 8MHz



      // Determine whether we are coming out of an LPMx.5 or a regular RESET.
        if (SYSRSTIV == SYSRSTIV_LPM5WU)        // MSP430 just woke up from LPMx.5
        {
            //Do nothing let the FW run

        }  else
           {

               // Device powered up from a cold start.
               // It configures the device and puts the device into LPM4.5
               
               P2DIR &= ~(BIT4);                   // Configure P2.4 as input direction pin
               P2OUT &= ~(BIT4);                   // Configure P2.4 as pulled-down
               P2REN |= BIT4;                      // P2.4 pull-up register enable
               P2IES &= ~(BIT4);                   // P2.4 Low/Hi edge
               P2IFG = 0;                          // Clear all P2 interrupt flags
               P2IE |= BIT4;                       // P2.4 interrupt enabled

               // Explicitly clear RTC control registers to disable it
               // just in case if the RTC was previously enabled
               disable_RTC();

               // Enter LPM4 Note that this operation does not return. The LPM4.5
               // will exit through a RESET event, resulting in a re-start
               // of the code.
               __bis_SR_register(LPM4_bits | GIE);
           }
    
// Main program
    while(1)
{

}
 
The above enters in LMP4.5 and while debugging and applying a reset on reset pin it detects but does not detect the Pin2.4 interrupt. What am I doing wrong?

Thanks,

Vlad

MSP430FR5994: User Backchannel UART with external power

$
0
0

Part Number:MSP430FR5994

Hi,

I want better debugging capabilities than using LED/GPIOs, when using external power.

Is there a way to use the backchannel UART when powering the MSP430FR5994 launchpad board with external power (e.g. from a power supply) ?

I also have some 3V/5V booster packs which will be mounted on the LP.

thanks


CCS/MSP432P401R: msp432

$
0
0

Part Number:MSP432P401R

Tool/software: Code Composer Studio

I am writing a SPI driver to communicate with Accelerometer, I have written the code given below. The problem that I am facing is:
a) I am not able to locate all P1.4 - P1.7 on my MSP432 board
b) Can anybody check my code and point out any error in my configuration of SPI(specially bitrate) and read and write byte function. 
c) I am confused regarding the use of STE, since STE is nothing but a Chip select signal, cant we directly use a port pin(GPIO) to directly make it low or high as per requirement rather than setting one of the port pin as STE
Code:

/**
* @file spi.c
* @brief This file is to be used for the setting the SPI peripheral of the microcontroller.
* @author Vikrant Waje
* @date November 20, 2018
*
*/
//***********************************************************************************
// Include files
//***********************************************************************************
#include"main.h"


//***********************************************************************************
// Global variables
//***********************************************************************************


//***********************************************************************************
// Function implementation
//***********************************************************************************
/*------------------------------------------------------------------------------------------------------------------------------------*/
/*
@brief: Setup the SPI peripheral.


@param: None
@param:None

@return: None
*/
/*-----------------------------------------------------------------------------------------------------------------------------*/
void spi_setup(){
spi_gpio_setup();
spi_set_parameters();
spi_enable();
}
/*------------------------------------------------------------------------------------------------------------------------------------*/
/*
@brief: Assign GPIO to SPI peripherals.

SOMI = P1.7 (UCSI B)(SEL1 =0 , SEL0 = 1 )
SIMO = P1.6 (UCSI B)(SEL1 =0 , SEL0 = 1 )
CLK = P1.5 (UCSI B)(SEL1 =0 , SEL0 = 1 )
STE = P1.4 (UCSI B)(SEL1 =0 , SEL0 = 1 )
@param: None
@param:None

@return: None
*/
/*-----------------------------------------------------------------------------------------------------------------------------*/
void spi_gpio_setup(){
P1->SEL0 |=(BIT4 | BIT5 | BIT6 | BIT7);
}

/*------------------------------------------------------------------------------------------------------------------------------------*/
/*
@brief: Set the parameters for SPI peripheral.


@param: None
@param:None

@return: None
*/
/*-----------------------------------------------------------------------------------------------------------------------------*/
void spi_set_parameters(){
//Enable Reset, MSB first, 7 bit mode, master, SPI mode with STE =0, Sync bit, SMCLK as source clock and STE as slave select
EUSCI_B0->CTLW0 |= EUSCI_B_CTLW0_SWRST | EUSCI_B_CTLW0_MSB | EUSCI_B_CTLW0_SEVENBIT | EUSCI_B_CTLW0_MST | EUSCI_B_CTLW0_MODE_2 | \
EUSCI_B_CTLW0_SYNC | EUSCI_B_CTLW0_SSEL__SMCLK | EUSCI_B_CTLW0_STEM;
EUSCI_B0->BRW = 120;
EUSCI_B0->CTLW0 &= ~(EUSCI_B_CTLW0_SWRST); //Come out of Reset
}

/*------------------------------------------------------------------------------------------------------------------------------------*/
/*
@brief: Write byte for SPI peripheral.


@param: None
@param:None

@return: None
*/
/*-----------------------------------------------------------------------------------------------------------------------------*/
void spi_write_byte(uint8_t reg_addr, uint8_t data_byte){
P1->OUT &=~(BIT4); //Make CS low
EUSCI_B0->TXBUF = (0<<7) & (reg_addr); //Send the register address with write bit at MSb position(write bit = 0)
while(!(EUSCI_B0->IFG & EUSCI_B_IFG_TXIFG ); //Wait for Byte to get transmitted
EUSCI_B0->TXBUF = data_byte;
while(!(EUSCI_B0->IFG & EUSCI_B_IFG_TXIFG ); //Wait for Byte to get transmitted
EUSCI_B2->IFG &= ~(EUSCI_B_IFG_TXIFG0); //Clear the flag
P1->OUT |=(BIT4); //Make CS high
}

/*------------------------------------------------------------------------------------------------------------------------------------*/
/*
@brief: Read byte for SPI peripheral.


@param: reg_addr: Register address from which data is to be read
@param:None

@return: uint8_t : 8 bit data that is read from register
*/
/*-----------------------------------------------------------------------------------------------------------------------------*/
uint8_t spi_read_byte(uint8_t reg_addr){
uint8_t data_byte;
P1->OUT &=~(BIT4); //Make CS low
EUSCI_B0->TXBUF = (0<<7) & (reg_addr); //Send the register address with write bit at MSb position(write bit = 0)
while(!(EUSCI_B0->IFG & EUSCI_B_IFG_TXIFG ); //Wait for Byte to get transmitted
EUSCI_B2->IFG &= ~(EUSCI_B_IFG_TXIFG0); //Clear the flag
while(!(EUSCI_B0->IFG & EUSCI_B_IFG_RXIFG ); //Wait for Byte to get transmitted
data_byte = EUSCI_B0->RXBUF; // Read data from RXBUF
P1->OUT |=(BIT4); //Make CS high
return data_byte;
}

CCS/MSP432P401R: Bit-banging UART on GPIO's

$
0
0

Part Number:MSP432P401R

Tool/software: Code Composer Studio

Hi,

I want to perform UART bit-banging on any 2 pins of MSP432P401R micro-controller (I have already used the dedicated UART hardware pins with one sensor and want to interface another one using UART protocol with my controller) .

Is there any sample code for this?

CCS/MSP430FR5969: Affect of Temperature on Loadcells.

$
0
0

Part Number:MSP430FR5969

Tool/software: Code Composer Studio

Hello All,

 I want to know how to reduce temp affect on loadcells. In my project I am working with -26C but when temp varies from -26C to -20C or -15C then that time loadcells values are  changing upto 20 to 30 grams. please help me to reduce this impact.

Thanks & Regards,

Sandhya Yadav

CCS/MSP430FR6989: I2C transfer between two boards

$
0
0

Part Number:MSP430FR6989

Tool/software: Code Composer Studio

Hi I am trying to replicate the same scenario as in the previous question. However, as I don't have access to a 10k resistors, are they really necessary? Will it work if I don't make the 10k connections? And also, which jumpers are "eZ-FET lite jumpers" as talked about in the reply that was marked as resolved?

Thanks in advance, 

CCS/MSP430FR2311: RTC

$
0
0

Part Number:MSP430FR2311

Tool/software: Code Composer Studio

i want to use RTC for only one count 

how to stop at 1count and

it stop execution of program from that point where RTC is used further program is not accessable

Viewing all 22138 articles
Browse latest View live


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