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

Compiler/MSP430F5435A: is it possible to get Typical Baud Rates and Errors when I set 25MHz in BRCLK

$
0
0

Part Number:MSP430F5435A

Tool/software: TI C/C++ Compiler

Hi, I am now trying to check the Errors in UART because there are sometimes the problem in my UART1 

I hope to know  Maximum TX Error and  RX Error  when I set 25MHz in SystemClock and set  115200 baudrate in UART

following is my setting 

System Clock

- 763 x 32768=25001984

UART Setting

- UCA1BRW =  217 

- UCA1MCTL = UCBRS_0;

 763x32768/217 = 115216.51612903225806451612903226

  http://www.ti.com/lit/ug/slau410e/slau410e.pdf

  1.3.13 Typical Baud Rates and Errors (this information is limited  until 20MHz)

Thanks.


MSP430F5419A: wide range sensor interface with micro controller.

$
0
0

Part Number:MSP430F5419A

hi all,

 in our project there is requirement for interfacing a sensor whose output will vary from 14volt to 110volt

ie above 14 volt if high and it will goes upto 110v

below 14 volt is low 

Isolation is must 

kindly help us to overcome this issue

MSP430F5328: MSP430F5328 Bit question

$
0
0

Part Number:MSP430F5328

Hello All,

One of our customers is having an issue with an MSP430 (MSP430F5328) resetting randomly,

He tracked it down to be

SYSRSTIV Register

0Ah = Security violation (BOR) Bit set

This is not explained anywhere in the user guide as to the cause of this bit, can you shed any light on this?

Best regards

Anil

CCS/MSP430F2122: Wrong Identifying On CCS

$
0
0

Part Number:MSP430F2122

Tool/software: Code Composer Studio

Hi everyone,

Why does the error message, error connecting to the target, exist on CCS but my chip and my project is the same?

My chip is MSP430F2122 and my setting of project is MSP430F2122, too.

The error code said, The target setup(MMSP430F2471) does not match the actual target type(MSP430F2122).

How should I solve it?

Is the chip  broken?

Sincerely,

Norton

MSP430F5172: I have a problem with P2.0 to P2.7,and P3.0 to P3.1 .

$
0
0

Part Number:MSP430F5172

When I set the I/O port from P2.0 to P3.7 to high level,but it doesn't works at the development board.

. The code reads as follows:

#include <msp430.h>
void main( void )
{
  // Stop watchdog timer to prevent time out reset
      WDTCTL = WDTPW + WDTHOLD;
      P1DIR |=BIT0;
      P1OUT |=BIT0;
    
      P2DIR |=0xff;
      P2OUT |=0xff; 
      P3DIR |=0xff;
      P3OUT |=0xff;
      


}

CCS/MSP432P401R: Trying to acquire 13 channels with ADC14 in MultiSequenceMode

$
0
0

Part Number:MSP432P401R

Tool/software: Code Composer Studio

Hello,

I try to read 13 channels in MultiSequenceMode. In the resultsBuffer, only the first 4 positions are completed but the data is not correct.

I use the XDS200  JTAG debugger in mode "JTAG(1149.1), SWD and cJTAG are disabled".

Please, show me where I'm wrong.


/* DriverLib Includes */
#include <ti/devices/msp432p4xx/driverlib/driverlib.h>(Please visit the site to view this file)

/* Standard Includes */
#include <stdint.h>
#include <stdbool.h>

static uint16_t resultsBuffer[13];

int main(void)
{
/* Stop Watchdog */
MAP_WDT_A_holdTimer();
MAP_Interrupt_disableMaster();

// Setting the external clock frequency
MAP_CS_setExternalClockSourceFrequency(32768, 48000000);
MAP_PCM_setCoreVoltageLevel(PCM_VCORE1);

// Configuring pins for crystal usage
MAP_GPIO_setAsPeripheralModuleFunctionOutputPin(GPIO_PORT_PJ, GPIO_PIN0 | GPIO_PIN1, GPIO_PRIMARY_MODULE_FUNCTION); // LFXT
MAP_GPIO_setAsPeripheralModuleFunctionOutputPin(GPIO_PORT_PJ, GPIO_PIN2 | GPIO_PIN3, GPIO_PRIMARY_MODULE_FUNCTION); // HFXT


MAP_FlashCtl_setWaitState(FLASH_BANK0, 2); // For 48 MHz
MAP_FlashCtl_setWaitState(FLASH_BANK1, 2); // For 48 MHz

// Starting LFXT in non-bypass mode without a timeout
MAP_CS_startLFXT(false);
// Starting HFXT in non-bypass mode without a timeout
MAP_CS_startHFXT(false);

// Initializing MCLK, HSMCLK, SMCLK and ACLK
MAP_CS_initClockSignal(CS_MCLK, CS_HFXTCLK_SELECT, CS_CLOCK_DIVIDER_1);
MAP_CS_initClockSignal(CS_HSMCLK, CS_HFXTCLK_SELECT, CS_CLOCK_DIVIDER_1); // Shares clock source with SMCLK
MAP_CS_initClockSignal(CS_SMCLK, CS_HFXTCLK_SELECT, CS_CLOCK_DIVIDER_2); // Maximum HSMCLK / 2; shares clock source with HSMCLK
MAP_CS_initClockSignal(CS_ACLK, CS_LFXTCLK_SELECT, CS_CLOCK_DIVIDER_1); // Maximum 128 kHz
MAP_CS_initClockSignal(CS_BCLK, CS_LFXTCLK_SELECT, CS_CLOCK_DIVIDER_1); // Maximum 32768 kHz

/* Initializing ADC (MCLK/1/1) */
MAP_ADC14_enableModule();
MAP_ADC14_initModule(ADC_CLOCKSOURCE_SMCLK, ADC_PREDIVIDER_1, ADC_DIVIDER_1, 0);


/* Configuring GPIOs for Analog In */
MAP_GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P4,
GPIO_PIN7 |GPIO_PIN6 | GPIO_PIN5 |GPIO_PIN4 | GPIO_PIN3, GPIO_TERTIARY_MODULE_FUNCTION);
MAP_GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P5,
GPIO_PIN5 |GPIO_PIN4 | GPIO_PIN3 | GPIO_PIN2 |GPIO_PIN1 | GPIO_PIN0, GPIO_TERTIARY_MODULE_FUNCTION);
MAP_GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P8,
GPIO_PIN7, GPIO_TERTIARY_MODULE_FUNCTION);
MAP_GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P9,
GPIO_PIN0, GPIO_TERTIARY_MODULE_FUNCTION);

//Configuring ADC Memory (ADC_MEM0 - ADC_MEM10 (A0-A12) no repeat
MAP_ADC14_configureMultiSequenceMode(ADC_MEM0, ADC_MEM12, false);

MAP_ADC14_configureConversionMemory(ADC_MEM0,
ADC_VREFPOS_AVCC_VREFNEG_VSS,
ADC_INPUT_A0, ADC_NONDIFFERENTIAL_INPUTS);
MAP_ADC14_configureConversionMemory(ADC_MEM1,
ADC_VREFPOS_AVCC_VREFNEG_VSS,
ADC_INPUT_A1, ADC_NONDIFFERENTIAL_INPUTS);
MAP_ADC14_configureConversionMemory(ADC_MEM2,
ADC_VREFPOS_AVCC_VREFNEG_VSS,
ADC_INPUT_A2, ADC_NONDIFFERENTIAL_INPUTS);
MAP_ADC14_configureConversionMemory(ADC_MEM3,
ADC_VREFPOS_AVCC_VREFNEG_VSS,
ADC_INPUT_A3, ADC_NONDIFFERENTIAL_INPUTS);
MAP_ADC14_configureConversionMemory(ADC_MEM4,
ADC_VREFPOS_AVCC_VREFNEG_VSS,
ADC_INPUT_A4, ADC_NONDIFFERENTIAL_INPUTS);
MAP_ADC14_configureConversionMemory(ADC_MEM5,
ADC_VREFPOS_AVCC_VREFNEG_VSS,
ADC_INPUT_A5, ADC_NONDIFFERENTIAL_INPUTS);
MAP_ADC14_configureConversionMemory(ADC_MEM6,
ADC_VREFPOS_AVCC_VREFNEG_VSS,
ADC_INPUT_A6, ADC_NONDIFFERENTIAL_INPUTS);
MAP_ADC14_configureConversionMemory(ADC_MEM7,
ADC_VREFPOS_AVCC_VREFNEG_VSS,
ADC_INPUT_A7, ADC_NONDIFFERENTIAL_INPUTS);
MAP_ADC14_configureConversionMemory(ADC_MEM8,
ADC_VREFPOS_AVCC_VREFNEG_VSS,
ADC_INPUT_A8, ADC_NONDIFFERENTIAL_INPUTS);
MAP_ADC14_configureConversionMemory(ADC_MEM9,
ADC_VREFPOS_AVCC_VREFNEG_VSS,
ADC_INPUT_A9, ADC_NONDIFFERENTIAL_INPUTS);
MAP_ADC14_configureConversionMemory(ADC_MEM10,
ADC_VREFPOS_AVCC_VREFNEG_VSS,
ADC_INPUT_A10, ADC_NONDIFFERENTIAL_INPUTS);
MAP_ADC14_configureConversionMemory(ADC_MEM11,
ADC_VREFPOS_AVCC_VREFNEG_VSS,
ADC_INPUT_A17, ADC_NONDIFFERENTIAL_INPUTS);
MAP_ADC14_configureConversionMemory(ADC_MEM12,
ADC_VREFPOS_AVCC_VREFNEG_VSS,
ADC_INPUT_A18, ADC_NONDIFFERENTIAL_INPUTS);

/* Setting up the sample timer to automatically step through the sequence convert. */
MAP_ADC14_enableSampleTimer(ADC_AUTOMATIC_ITERATION);

/* Enabling the interrupt when a conversion on channel 12 (end of sequence) is complete and enabling conversions */
MAP_ADC14_enableInterrupt(ADC_INT12);

/* Enabling Interrupts */
MAP_Interrupt_enableInterrupt(INT_ADC14);
MAP_Interrupt_enableMaster();

/* Triggering the start of the sample */
MAP_ADC14_enableConversion();
MAP_ADC14_toggleConversionTrigger();

/* Zero-filling buffer */
memset(resultsBuffer, 0x00, 13);

while(1)
{
MAP_ADC14_enableConversion();
MAP_ADC14_toggleConversionTrigger();

MAP_PCM_gotoLPM0();

}
}


/* This interrupt is fired whenever a conversion is completed and placed in
* ADC_MEM12. This signals the end of conversion and the results array is
* grabbed and placed in resultsBuffer */
void ADC14_IRQHandler(void)
{
uint64_t status;

status = MAP_ADC14_getEnabledInterruptStatus();
MAP_ADC14_clearInterruptFlag(status);


if(status & ADC_INT12)
{
MAP_ADC14_getMultiSequenceResult(resultsBuffer);
}


}

CCS/MSP430F5132: MSP430 stops working after a fixed UART transmit count

$
0
0

Part Number:MSP430F5132

Tool/software: Code Composer Studio

Hello,

I am working on an RS485 device which is controlled by MSP430F5132IDA. Here is the comments about my custom device:

- MSP430F5132 is the MCU on the board and it has I/Os and RS485 communication using ISO3088 TI device.

- If I dont use any UART, everything is working fine. 

- If the mcu transmits to PC, everything is working fine.

- If the mcu receives a command (Like "360751SETO1#") and answer back the string "ACK360751?", it fails after transmitting 88th string (I dont know why it is 88, I put some disable interrupt, clear interrupt and enable interrup codes it increased to195th). MCU totally stops, no status led blinking. It stuck at delay(20000))

Here is the screen print at pc side:

Here is the simple MSP430F5132 code (from MSP430F5529 example) for UART communication:

#include "driverlib.h"

#define STATUS1   GPIO_PIN6
#define STATUS2   GPIO_PIN5

#define IN1   GPIO_PIN4
#define IN2   GPIO_PIN5
#define IN3   GPIO_PIN6
#define IN4   GPIO_PIN7
#define IN5   GPIO_PIN0
#define IN6   GPIO_PIN1
#define IN7   GPIO_PIN2
#define IN8   GPIO_PIN3

#define OUT1   GPIO_PIN1
#define OUT2   GPIO_PIN0
#define OUT3   GPIO_PIN7
#define OUT4   GPIO_PIN6
#define OUT5   GPIO_PIN5


uint8_t durum = 0x00;

uint8_t check = 0, sendACK=0, donguKontrol = 0;
uint8_t sendMessage = 1, receiveEnable = 0, charReceived = 0;

char charArray[12],charArrayCopy[12];

volatile int i,c=0;
uint8_t receivedData = 0x00;


void main(void)
{
    //Stop WDT
    WDT_A_hold(WDT_A_BASE);

    //outs low first, prevent flickering at outputs
    GPIO_setOutputHighOnPin(GPIO_PORT_P2, OUT5 + OUT4 + OUT3);
    GPIO_setOutputHighOnPin(GPIO_PORT_P3, OUT2 + OUT1 + STATUS2 + STATUS1);

    //outputs
    GPIO_setAsOutputPin(GPIO_PORT_P2, OUT5 + OUT4 + OUT3);
    GPIO_setAsOutputPin(GPIO_PORT_P3, OUT2 + OUT1 + STATUS2 + STATUS1);

    GPIO_setOutputHighOnPin(GPIO_PORT_P2, OUT5 + OUT4 + OUT3);
    GPIO_setOutputHighOnPin(GPIO_PORT_P3, OUT2 + OUT1);
    GPIO_setOutputLowOnPin(GPIO_PORT_P3, STATUS2 + STATUS1);

    //inputs
    GPIO_setAsInputPin(GPIO_PORT_P1,IN1 + IN2 + IN3 + IN4);
    GPIO_setAsInputPin(GPIO_PORT_P2,IN5 + IN6);

    //rs485 de re
    GPIO_setAsOutputPin(GPIO_PORT_P1, GPIO_PIN0 + GPIO_PIN3);

    //uart - rs485
    GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P1, GPIO_PIN1 + GPIO_PIN2);



    //Baudrate = 9600, clock freq = 1.048MHz
    //UCBRx = 109, UCBRFx = 0, UCBRSx = 2, UCOS16 = 0  --> Copied from MSP430F5529 example
    USCI_A_UART_initParam param = {0};
    param.selectClockSource = USCI_A_UART_CLOCKSOURCE_SMCLK;
    param.clockPrescalar = 109;
    param.firstModReg = 0;
    param.secondModReg = 2;
    param.parity = USCI_A_UART_NO_PARITY;
    param.msborLsbFirst = USCI_A_UART_LSB_FIRST;
    param.numberofStopBits = USCI_A_UART_ONE_STOP_BIT;
    param.uartMode = USCI_A_UART_MODE;
    param.overSampling = USCI_A_UART_LOW_FREQUENCY_BAUDRATE_GENERATION;

    if(STATUS_FAIL == USCI_A_UART_init(USCI_A0_BASE, &param))
    {
        return;
    }

    //Enable UART module for operation
    USCI_A_UART_enable(USCI_A0_BASE);

    //Enable Receive Interrupt
    USCI_A_UART_clearInterrupt(USCI_A0_BASE,USCI_A_UART_RECEIVE_INTERRUPT);
    USCI_A_UART_enableInterrupt(USCI_A0_BASE,USCI_A_UART_RECEIVE_INTERRUPT);


    __enable_interrupt();

    while(1)
    {
        if(charReceived == 1){

            GPIO_setOutputHighOnPin(GPIO_PORT_P1, GPIO_PIN0 + GPIO_PIN3);
            _delay_cycles(8000);

            USCI_A_UART_transmitData(USCI_A0_BASE, 'A');
            USCI_A_UART_transmitData(USCI_A0_BASE, 'C');
            USCI_A_UART_transmitData(USCI_A0_BASE, 'K');
            USCI_A_UART_transmitData(USCI_A0_BASE, '3');
            USCI_A_UART_transmitData(USCI_A0_BASE, '6');
            USCI_A_UART_transmitData(USCI_A0_BASE, '0');
            USCI_A_UART_transmitData(USCI_A0_BASE, '7');
            USCI_A_UART_transmitData(USCI_A0_BASE, '5');
            USCI_A_UART_transmitData(USCI_A0_BASE, '1');
            USCI_A_UART_transmitData(USCI_A0_BASE, '?');


            _delay_cycles(8000);
            GPIO_setOutputLowOnPin(GPIO_PORT_P1, GPIO_PIN0 + GPIO_PIN3);

            charReceived = 0;
        }

        GPIO_setOutputHighOnPin(GPIO_PORT_P3,STATUS1);
        _delay_cycles(20000);
        GPIO_setOutputLowOnPin(GPIO_PORT_P3,STATUS1);
        _delay_cycles(20000);

    }
}


//******************************************************************************
//
//This is the USCI_A0 interrupt vector service routine.
//
//******************************************************************************
#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
#pragma vector=USCI_A0_VECTOR
__interrupt
#elif defined(__GNUC__)
__attribute__((interrupt(USCI_A0_VECTOR)))
#endif
void USCI_A0_ISR(void)
{
    switch(__even_in_range(UCA0IV,4))
    {
    //Vector 2 - RXIFG
    case 2:
        receivedData = USCI_A_UART_receiveData(USCI_A0_BASE);

        if(receivedData != '#')                       // Check value
        {
            charArray[c] = receivedData;
            c++;
            charReceived = 0;
        }else{
            charReceived = 1;
        }
        break;
    default: break;
    }
}

Looking forward for your advices.

Best regards,

Onur

MSP432P401R: Problem with SPI receive interrupt

$
0
0

Part Number:MSP432P401R

Hello! I'm trying to use a MSP432 to communicate with a CY15B104Q FRAM via SPI. The problem is that if I read the receive buffer immediately after the RX ISR is triggered, it reads 0, but if I add a small delay before reading, it reads OK. I'm using CCS 7.2.0.00013 TI v16.9.4.LTS, MSP432 SDK 1.40.1.00. This is my code:

CY15B104Q_ASSERT_CS();
    while (framTxFlag == false)
    {
        MAP_PCM_gotoLPM0InterruptSafe();
        MAP_Interrupt_enableMaster();
    }
    framTxFlag = false;
    SPI_transmitData(EUSCI_A1_BASE, 0x05);

    while (framTxFlag == false)
    {
        MAP_PCM_gotoLPM0InterruptSafe();
        MAP_Interrupt_enableMaster();
    }
    framTxFlag = false;
    SPI_transmitData(EUSCI_A1_BASE, 0x00); // Dummy write to clock out data from FRAM

    while (framRxFlag == false)
    {
        MAP_PCM_gotoLPM0InterruptSafe();
        MAP_Interrupt_enableMaster();
    }
    framRxFlag = false;
    
    CY15B104Q_DEASSERT_CS();




void EUSCIA1_IRQHandler(void) { unsigned int status; status = MAP_SPI_getEnabledInterruptStatus(EUSCI_A1_BASE); MAP_SPI_clearInterruptFlag(EUSCI_A1_BASE, status); char rx; if (status & EUSCI_A_SPI_TRANSMIT_INTERRUPT) { framTxFlag = true; } if (status & EUSCI_A_SPI_RECEIVE_INTERRUPT) { int jj; for (jj=0;jj<100;jj++); rx = MAP_SPI_receiveData(EUSCI_A1_BASE); framRxFlag = true; } MAP_Interrupt_disableSleepOnIsrExit(); }

If I comment the for() loop from IRQ handler, SPI_receiveData() reads 0, but with the loop it reads OK.

What is the problem? It this working as it is intended to? It seems that the RX interrupt is not triggered when the receive buffer is full.


MSP432P401R: driverlib, temperature calibration constants set to zero

$
0
0

Part Number:MSP432P401R

The calibration values appear to be set to 0.  Is this correct or were the values never put into the library?

Thanks!

cal30 = SysCtl_getTempCalibrationConstant(SYSCTL_2_5V_REF,

                SYSCTL_30_DEGREES_C);

cal85 = SysCtl_getTempCalibrationConstant(SYSCTL_2_5V_REF,

                SYSCTL_85_DEGREES_C);

MSP430F5229: UART interface using Energia (sending SMS)

$
0
0

Part Number:MSP430F5229

Hello,

since 43oh forum had crashed, im trying here:

I connected my Tx, Rx and GND pins to the matched pins in SIM900 modem and try to send sms using AT commands.
I want to declare about the UART pins in the code , because there are 2 UART interfaces in my board.

how can I do that? probably in the setup() routine, but how?

this is my code for the sms routine: is it enough? or should I get acks for the commands?

void sendsms(){
Serial.println("AT\r");
delay(1000);
Serial.println("AT+CMGF = 1\r");
delay(1000);
Serial.println("AT+CMGS =\"012345678\"\r");
delay(1000);
Serial.println("HELLO WORLD");
delay(1000);
Serial.println((char)26);
delay(100);
}

thanks

Nir

MSP-EXP430F5529LP: LP Firmware Recovery, need help

$
0
0

Part Number:MSP-EXP430F5529LP

I am not sure why but after my recent re-install of CCS (v7.2.0.00013) I was asked to update my Launchpad firmware when I connected it to the PC. It just hangs during the update, and I have to then cancel out eventually. See attached for the screen it hangs on.

I have multiple 5529 LP's, it asks for updates on all of them as I just tried this morning, and now all are bricked! How to correct, how to get my 5529 LP's updated & running again?

MSP430F5438 Bluetooth Stack

$
0
0

Is this Bluetooth stack only available for MS Windows?

RTOS/MSP432P401R: Do global variables shared between tasks (or clock functions) need to be marked as volatile?

$
0
0

Part Number:MSP432P401R

Tool/software:TI-RTOS

G'Day all,

Can you confirm whether global variables shared between idle tasks/tasks/clock functions/SWIs need to be marked as volatile explicitly.

Or does the RTOS compile process somehow make this unnecessary?

Would it be good practice to always mark globals as volatile? 

Cheers

Julian

MSP430F2416: Microcontroller goes to sleep mode after executing code randomly in field

$
0
0

Part Number:MSP430F2416

Programming Procedure: 

We are using MSP430f2416 in production. We use Elprotronics to write flash memory in production. We blow JTag fuse after every programming and then subsequent programming we are using BSL programming. 

Code Description:

We are low powered battery operated instruments which uses MSP430. After each 15 seconds we go to deep sleep mode. This sleep mode unit is woken up by 5 different buttons on the wake up on interrupt pins. Then after 15 seconds unit goes to sleep mode. 

Following is the observation of the problem.

- Units are QCed, tested and out of the production in the field. After few months, unit comes in repair. 

- When you press the wake up one particular  'X' button out of five buttons unit turns on for just milliseconds and then go to sleep mode right away. Essentially unit doesn't turn on. If unit is turned on by other buttons then pressing button 'X' turns off the unit and go to deep sleep mode. 

Troubleshooting results:

- Hardware is perfect

- There is no obvious issue with the code. Code is running in the production for more than 15 years. Earlier we had MSP430F149 micro controller. We replace it with the new one 7 years ago. Problem seems to happened last couple of years. 

- There is no obvious stack issue or PC failure. 

- Power cycle doesn't help. Button 'X' always seems to make unit to go to sleep. 

My Questions:

- Is this a flash issue of reading the code? Is flash code is being corrupted?

- Is because of the flash error, micro controller is going to sleep mode?

- Is microcontroller resetting itself if it goes to reset vector? Does it execute the code from beginning if it goes to reset vector?

- Is there a known production flash failure issues in this micro controller?

- If flash key failure putting unit to reset how does it responds to other keys?

MSP430FR59941: read registers over I2C with restart

$
0
0

Part Number:MSP430FR59941

I'm having a little trouble getting restart and register reading over I2C working in this new part.  I have old code that worked on my previous msp430 but it didn't port well to the new one.  What's happening when I run the code below is there's a write of 0x40 followed by a write of 0x00 followed by a restart, but then 0x40 comes out with the read bit set and then there's another unexpected write of 0x60.  I'm not sure what I'm doing wrong and the examples never seem to show how to do register style I2C accesses :)  Any advice is appreciated, I'm working late trying to solve this one.

    UCB1CTLW0 = UCSWRST;                    // put eUSCI_B in reset state
    UCB1CTLW0 |= UCMODE_3 | UCMST | UCSSEL__SMCLK; // I2C master mode, SMCLK
    UCB1BRW = 0x8;                          // baudrate = SMCLK / 8
    UCB1CTLW0 &= ~UCSWRST;                  // clear reset register
    UCB1IE |= UCTXIE0 | UCNACKIE;           // transmit and NACK interrupt enable
    UCB2IE |= UCRXIE | UCNACKIE | UCBCNTIE; //receive interrupt enable

    SlaveFlag = 0;                          // Initialize SlaveFlag
    TXByteCtr = 2;                      // Load TX byte counter


        UCB1I2CSA = 0x40;// configure slave address
        while (UCB1CTLW0 & UCTXSTP);        // Ensure stop condition got sent

        UCB1CTLW0 |= UCTR | UCTXSTT;        // I2C TX, start condition

        __bis_SR_register(LPM0_bits | GIE); // Enter LPM0 w/ interrupts

        UCB1TXBUF = 0x00;  // Load address to buffer
        __bis_SR_register(LPM0_bits | GIE); // Enter LPM0 w/ interrupts

        //clear tx flag
        UCB1IFG &= ~UCTXIFG; //clear tx flag

        //switch to RX mode
        UCB1CTL1 &= ~UCTR;   //change to rx mode
        UCB1IFG &= ~UCRXIFG;  //clear rx ifg

        UCB1CTL1 |= UCTXSTT; //send start for restart
        //while(UCB1CTL1 & UCTXSTT);//wait for start to be set which will be a TXIFG interrupt flag
        __bis_SR_register(LPM0_bits | GIE); // Enter LPM0 w/ interrupts

        //stop when you're done
        UCB1CTLW0 |= UCTXSTP;       // I2C stop condition
        UCB1IFG &= ~UCTXIFG;        // Clear USCI_B2 TX int flag


    return 0;


#pragma vector=TIMER1_A0_VECTOR
   __interrupt void Timer1_A0 (void) {      // Timer0 A0 interrupt service routine

    //check button status
    if((P1IN & BIT0) == BIT0){
        button_timer = 0;
    }else{
        button_timer++;
        //if button timer > threshold switch states
        if(button_timer >= PWR_BUTTON_THRESH){
            CHANGE_PWR_STATE_FLAG = 1;
        }
    }

    //flash led for debugging
    if((P8OUT & BIT0) == BIT0){
        P8OUT &= ~BIT0;
    }else{
        P8OUT |= BIT0;
    }

    //clear interrupts
    TA1CTL &= ~BIT0;
    TA1CCTL0 &= ~CCIFG;  //clear interrupt
    //TA1CTL &=~(MC_1); // Stop Timer_A
    __bic_SR_register_on_exit(LPM0_bits+GIE); // Clear LPM bits upon ISR Exit
}


#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
#pragma vector = EUSCI_B1_VECTOR
__interrupt void USCI_B1_ISR(void)
#elif defined(__GNUC__)
void __attribute__ ((interrupt(EUSCI_B1_VECTOR))) USCI_B1_ISR (void)
#else
#error Compiler not supported!
#endif
{
    switch(__even_in_range(UCB1IV, 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
            UCB2CTLW0 |= 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:             // Vector 22: RXIFG0
            *RXData = UCB2RXBUF;             // Get RX data
            __bic_SR_register_on_exit(LPM0_bits); // Exit LPM0
            break;
        case USCI_I2C_UCTXIFG0:             // Vector 24: TXIFG0
            /*if (TXByteCtr)                  // Check TX byte counter
            {
                UCB1TXBUF = TXData[SlaveFlag];  // Load TX buffer
                TXByteCtr--;                // Decrement TX byte counter
            }
            else
            {
                UCB1CTLW0 |= UCTXSTP;       // I2C stop condition
                UCB1IFG &= ~UCTXIFG;        // Clear USCI_B2 TX int flag
                __bic_SR_register_on_exit(LPM0_bits); // Exit LPM0
            }*/
            __bic_SR_register_on_exit(LPM0_bits); // Exit LPM0
            break;
        case USCI_I2C_UCBCNTIFG: break;     // Vector 26: BCNTIFG
        case USCI_I2C_UCCLTOIFG: break;     // Vector 28: clock low timeout
        case USCI_I2C_UCBIT9IFG: break;     // Vector 30: 9th bit
        default: break;
    }
}


CCS/CC1101: upgrade of eZ430_Chronos_CC.dll to Tcl8.6

$
0
0

Part Number:CC1101

Tool/software: Code Composer Studio

I am using eZ430Chronos Tools and espacially the eZ430_Chronos_CC.dll for a tcl-appication. The eZ430_Chronos_CC.dll is compilied with lib85.lib and libstub85.lib. I am forced to use Tcl8.6 and the approriate libray functions. But the tcl-application does not work fine with Tcl8.6. Is there a newer version of eZ430_Chronos_CC.dll available that is compatible to Tcl8.6? What can I do to transport it to Tcl8.6?

Harasim

MSP430F5244: JTAG lock even thought not writing the value for 0x17FC to 0x17FF

$
0
0

Part Number:MSP430F5244

Hi TI Experts,

Please provide your advice for customer issue.
They have met the following error after writing the BSL area.
"ERROR: The Debug Interface to the device has been secured"
I think that this device was "JTAG locked", but they did not write the any value in the area of 0x17FC to 0x17FF.
What do you think about the cause?

Best regards.
Kaka

MSP430FR4133: Connecting a ADXL362 accelerometer to MSP430

$
0
0

Part Number:MSP430FR4133

Hello community, 

I am trying to connect a ADXL362 to my MSP430 in Energia using SPI. I have found some arduino code examples (but no msp430 examples)  which sync without issue in Energia. However, I don't know what pins to hook up the accelerometer to and am guessing I will need to change the code to correspond to the correct MSP430 pins. This is a link to the code I am using,

1st

will the arduino.h library work correctly?

2nd 

what do i need to change "ie pin configuration" to get this to work correctly? 

3rd

any tips on getting this to work?

any help would be greatly appreciated. 

Kind regards,

Chris

I2C_transfer() block the task and how to recover

$
0
0

Hi

     I am working with MSP432. When using I2c driver provided in simplelink_msp432_sdk_1_30_00_40, I find that task will be blocked once i2c transfer abnormal. 

I trace the code and the code is blocked in I2C_transfer() . 

    So I want to know how to recover i2c from abnormal state since there is no timeout method and no deinitialize driver interface, which I can not find in sdk. 

    Really need your help.

MSP-CAPT-FR2633: CapTIvate MCU Development Kit source code and uart configuration

$
0
0

Part Number:MSP-CAPT-FR2633


I'm exploring the MSP CapTIvate MCU Development Kit  and I want to use an alternative method of communicating with the PC, wirelessly. When exploring the code generated after configuring my sensor layout, I verified that the code for use of the microcontroller peripherals is compiled in a library (driverlib) and I can't find the source code. So I question if this code is open, or if it is possible to get the configurations of the peripherals namely the uart. I also checked the uart.h file but the specified parameters do not allow me to extract the necessary settings to establish a communication.
Thank you for your help

Viewing all 22507 articles
Browse latest View live


Latest Images

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