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

MSP430FR2433: Trouble programming memory through BSL using Uniflash

$
0
0

Part Number: MSP430FR2433

We are trying to program the MSP430FR2433 with Uniflash using UART BSL mode and we need help. We are using Uniflash v5.0.0.2289. We are also using the MSP-EXP430FR2433 board and very closely following the example described in Section 5 of "Programming the Bootloader of MSP430™ and SimpleLink™ MSP432™ , CC13xx, CC26xx, and CC32xx MCUs Using UniFlash" . We have created a simple LED blink program and converted its output to TI-Text hex format.

The contents of our image file is as follows:

@c400
B2 40 80 5A CC 01 D2 D3 04 02 D2 D3 02 02 92 C3
30 01 B2 D0 10 00 82 03 B2 40 50 C3 92 03 B2 D0
20 02 80 03 03 43 32 D2 03 43 03 43 FE 3F 03 43
31 40 00 30 B0 13 5E C4 0C 43 B0 13 00 C4 1C 43
B0 13 58 C4 D2 E3 02 02 B2 80 B0 3C 92 03 00 13
32 D0 10 00 FD 3F 03 43 03 43 FF 3F 03 43 1C 43
10 01
@ff80
FF FF FF FF FF FF FF FF
@ffda
50 C4 50 C4 50 C4 50 C4 50 C4 50 C4 50 C4 50 C4
50 C4 50 C4 50 C4 50 C4 50 C4 50 C4 50 C4 44 C4
50 C4 50 C4 30 C4
q

The contents of our password file when we start with an erases device is:

@ffe0
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
q

The contents of our password file when we start with a pre-programmed device is:

@ffe0
50 C4 50 C4 50 C4 50 C4 50 C4 50 C4 50 C4 50 C4
50 C4 50 C4 50 C4 50 C4 44 C4 50 C4 50 C4 30 C4
q

Uniflash gives the following error: 

Image loading failed: Flash Generic, Loading Images... Error: -9

We always get the same error whether we start with the device memory pre-erased and a password file with all ff values, or if we start with the device pre-programmed and the corresponding password file.

Questions:

  1. Is Uniflash v5.0.0.2289 able to program the MSP430FR2433 via BSL using the MSP-EXP430FR2433 board?
  2. What is the meaning of the Uniflash error code listed above?
  3. Please provide suggestions about what we might be doing wrong.

Thanks


EZ430 Chronos 868

$
0
0

I have received my eZ430-Chronos and I installed chronos-setup.exe ,however when installing the drivers I received the error that the (usbser) Ports install failed. My RF Access Point isn't recognized when plugged in now. Using Windows 10.

Jacob

CCS/MSP432P401R: Commands format in Code Composer Studio

$
0
0

Part Number: MSP432P401R

Tool/software: Code Composer Studio

Hi TI community

I am using MSP401P401R for my application. To set the SPI (A3) in code composer studio. The piece of code I am have written to program SPI is as follows

oid main(void)
{
WDT_A->CTL = WDT_A_CTL_PW | WDT_A_CTL_HOLD; // stop watchdog timer

/**************************************MElectrical Motors control***********************/
P2DIR |=BIT4 + BIT5 + BIT6 + BIT7;

/**************GPIO2 Interrupt is enabled on P1.6 high>>low transition**********************/
P1REN |= BIT6; //Pullp/pulldown resistor is activated.
P1OUT &= ~BIT6; //The default of the P1.5 is low.
P1DIR &= ~BIT6; //P2.2 is defined as input pin.
P1IE |= BIT6; // The interrupt is activated for P1.5.
P1IES |= BIT6; // The interrupt is activated on high to low transition.
P1IFG &= ~BIT6; // P1.6 IFG cleared /************************************************************************************ ********/
//Configure the SPI interface.
UCA3CTLW0 |= UCSWRST; // **Initialize USCI state machine**
P9SEL0 |= BIT5; // SPI_CLK..
P9SEL1 &= ~BIT5;
P9SEL0 &=~(BIT6 + BIT7);
P9SEL1 |= BIT6 + BIT7; // UCA0SOMI | UCA0SIMO
P9SEL1 &=~BIT5;
UCA3CTLW0 |= UCCKPH + UCMST + UCMSB + UCSYNC + UCSSEL_2; // 3-pin, 8-bit, SPI master
//UCA3CTL1 |= UCSSEL_2; // SMCLK
// UCA3BR0 |= 0x02; // /2
//UCB0BR1 = 0x00; //
/*****************************************/
P9OUT |= BIT6;/* Pullup on UCA3SOMI */
P9REN |= BIT6;/*Pullup/pulldown resistors*/
/****************************************/
P1DIR |= BIT7;
P1OUT |= BIT7; /*CSn on P1.7*/
/***************************************/
/* In case not automatically set */
P9DIR |= BIT5 + BIT7;
P9DIR &= ~BIT6;
UCA3CTLW0 &= ~UCSWRST; // **Initialize USCI state machine**

Do you think it is right procedure to do that? I mean the format is correct?

Thanks

Saber 

CCS/MSP430FR2433: Unable to us MSP-FETU430IF with CCSv9

$
0
0

Part Number: MSP430FR2433

Tool/software: Code Composer Studio

When I try to use my old MSP-FETU430IF with CCSv9 I get the "No USB FET was found" CCS error. I;'m using Windows 7 Pro and CCS  Version: 9.0.1.00004. I have confirmed that the MSP-FETU430IF shows up in device manager. Is this tool still compatible with CCSv9?

See below screenshots.

MSP432E401Y: Semaphore and GateMutex documentation

$
0
0

Part Number: MSP432E401Y

I am using MSP432 with CCS and have some shared memory to protect.

Looking for reference to use GateMutex.

Where can I find the API documentation and also the sample usecase for GateMutex and Semaphre?

What is the difference between "Semaphore_construct" and Semaphore_create" API's?

Thanks

Hetal

Compiler/MSP-EXP430FR2433: #pragma advice from ULP advisor in ISR

$
0
0

Part Number: MSP-EXP430FR2433

Tool/software: TI C/C++ Compiler

Hello,

When I try to call a function from any ISR, ULP advisor says:

(ULP 10.1) ISR ADC_ISR calls function ADC_getResults. Recommend moving function call away from ISR, or inlining the function, or using pragmas.

I understand the first two recommendations as they are self explaining but the last one, using pragmas, I do not understand.

How to meet the ULP advisor's recommendation for function call using pragmas in an ISR?

CCS/MSP430FR5969: CCS breaks at NOP in mult16_f5hw.asm at 16MHz

$
0
0

Part Number: MSP430FR5969

Tool/software: Code Composer Studio

During debugging with CCS, a phantom breakpoint stops execution at a NOP in mult16_f5hw.asm.   However I am not executing any multiply at the time.  This is occurring in a mature firmware project that I recently modified to run with MCLK = 16 MHz.   Same code with MCLK = 8 MHz does not have this issue, which is exactly the problem reported in this post. and also here.  Both of these posts were locked without resolution so I am reopening the question.   

Similar to symptoms in the other problem report, the issue may be related to SPI in some way:  I had code that failed with SPI peripheral access with MCLK = 16 MHz when using driverlib functions for SPI and clock initialization.  My solution was to drop MCLK to 8 MHz and the code has been fine in the field.    However if I simply increase MCLK to 16 MHz (after all SPI access is completed) , CCS consistently hits this phantom breakpoint at at a NOP in mult16_f5hw.asm.    

I can provide more detail, but I am asking for help in with analyzing this issue.

MSP432E401Y: RE: MSP432E401Y-how-to-use-the-rom-bootloader-of-the-device-MSP432E401Y

$
0
0

Part Number: MSP432E401Y

For anyone wondering, it's SLAU746A not SLAU764A. I wasted several minutes reading 764 trying to figure out how I was so stupid as to not see the referred to material.


MSP430FR5969: Incorrect order of enabling wait-waits and 16MHz MCLK in MSP430Ware cs_ex2_DCO16MHz driverlib example?

$
0
0

Part Number: MSP430FR5969

The MSP430Ware 3.80.07.00 driverlib cs_ex2_DCO16MHz example cs_ex2_DCO16MHz has the following calls to configure 16MHz operation:

    //Set DCO frequency to 16MHz
    CS_setDCOFreq(CS_DCORSEL_1, CS_DCOFSEL_4);

    CS_initClockSignal(CS_SMCLK,CS_DCOCLK_SELECT,CS_CLOCK_DIVIDER_1);
    CS_initClockSignal(CS_MCLK,CS_DCOCLK_SELECT,CS_CLOCK_DIVIDER_1);

    //Set wait state to 1
    FRAMCtl_configureWaitStateControl(FRAMCTL_ACCESS_TIME_CYCLES_1); 

For reliable operation should the number of wait states be set before setting the DCO frequency?

Whereas the Register Level example msp430fr59xx_cs_02.c does set the wait states first:

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

  // Clock System Setup
  CSCTL0_H = CSKEY >> 8;                    // Unlock CS registers
  CSCTL1 = DCORSEL | DCOFSEL_4;             // Set DCO to 16MHz
  CSCTL2 = SELA__VLOCLK | SELS__DCOCLK | SELM__DCOCLK; // Set SMCLK = MCLK = DCO,
                                            // ACLK = VLOCLK
  CSCTL3 = DIVA__1 | DIVS__1 | DIVM__1;     // Set all dividers
  CSCTL0_H = 0;                             // Lock CS registers

MSP430FR60431: power consumption calculation

$
0
0

Part Number: MSP430FR60431

hello

i am working on a new design for ultrasonic water flow meter. i use MSP430FR60431 for metering.

datasheet mentioned that 3-μA overall current consumption with 1 set of results per second which means about 10.8uA per hour.

these numbers will consume our battery in about 3 months only.

other manufactures for water meters grantee battery life time for about 10 years!!!!

is there any missing data on my calculations?

please help me in that

thanks

Compiler/MSP432P401R: Unable to print using Display_printf function

$
0
0

Part Number: MSP432P401R

Tool/software: TI C/C++ Compiler

Hi,

I am working TIDA_01575 Library. In that i am trying to print the "adjustedSampleBuffer[]"  values in the "vibrationCapture.c" file. I initialized the Display handle in "convertAdjustedDataToFloat" but unfortunately unable to print the data. 

#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>


/* POSIX Header files */
#include <pthread.h>

/* Driver Header files */
#include <ti/drivers/UART.h>
#include <ti/display/Display.h>
#include <ti/drivers/ADCBuf.h>
#include <ti/drivers/adcbuf/ADCBufMSP432.h>
#include <ti/drivers/Power.h>
#include <ti/drivers/GPIO.h>
#include <ti/drivers/Timer.h>
#include <ti/drivers/power/PowerMSP432.h>
#ifdef RTC_WAKEUP
#include <ti/drivers/dpl/HwiP.h>
#endif

/* Driverlib Header files */
#include <ti/devices/msp432p4xx/driverlib/driverlib.h>

/* Example/Board Header files */
#include "Board.h"
#include "vibrationCapture.h"
#include "commonComms.h"
#ifdef BLE_COMMS
#include "motor_condition_monitor.h"
#endif

#include <semaphore.h>
#ifdef BLE_COMMS
#include <mqueue.h>
#endif

/* DSP Include */
#include "arm_math.h"
#include "arm_const_structs.h"

#ifdef BLE_COMMS
extern mqd_t apQueueSend;
#endif

#ifdef RTC_WAKEUP
void RTC_C_IRQHandler(void);

/* -------------------------------------------------------------------
 * Set up of the current RTC time when the system is first powered up.
 * This is set for April 28th 2017 11:30:00 PM
 * ------------------------------------------------------------------- */
const RTC_C_Calendar currentTime =
{
        00,
        30,
        23,
        06,
        28,
        04,
        2017
};
#endif

/* Callback used for timer in one-shot mode. */
void timerCallback(Timer_Handle myHandle);

void *vibrationThread(void *arg0);

/* Energy Bin buffers*/
Energy_Bin XAxisEnergyBin;
Energy_Bin YAxisEnergyBin;
Energy_Bin ZAxisEnergyBin;

/* ADC Sample Buffers for X, Y and Z axis */
uint16_t sampleBufferX[ADCBUFFERSIZE];
uint16_t sampleBufferY[ADCBUFFERSIZE];
uint16_t sampleBufferZ[ADCBUFFERSIZE];

/* Floating Point Buffer for getting the data */
static float32_t setfloatInput[ADCBUFFERSIZE*2];

/* Floating Point Buffer where FFT output is kept */
float32_t *fftOutput;

/* Variable to count the number of averaging iterations */
uint8_t avgLoop;

/* Mutex for end of conversion and FFT calculation */
sem_t adcConvMutex;

/* Mutex for indicating wakeup of device */
sem_t devWakeMutex;

/* Mutex for power up of AFE time delay */
sem_t afeWakeMutex;

/* Mutex to talk to the Communication stack */
extern sem_t startComms;
extern sem_t endComms;

/* Power Policy Object*/
Power_NotifyObj notifyObj;

/* ------------------------------------------------------------------
* Global variables for FFT Bin Example
* ------------------------------------------------------------------- */
uint32_t ifftFlag     = 0;
uint32_t doBitReverse = 1;

/*
 * This function converts the data into a floating point representation of the
 * data read from the ADC channel
 */
int_fast16_t convertAdjustedDataToFloat(uint32_t adjustedSampleBuffer[],
                                        float32_t adjustedfloatInput[],
                                        uint_fast16_t sampleCount)
{

        Display_Handle displayHandle;
        Display_Params displayParams;
        Display_Params_init(&displayParams);
        displayHandle = Display_open(Display_Type_UART, NULL);



    int_fast16_t loopCount;

    Display_printf(displayHandle, 1, 0, "In Vibration Capture");
    for(loopCount = 0; loopCount < (sampleCount/2); loopCount++)
    {
        Display_printf(displayHandle, 1, 0, " Count is %d\r\n",loopCount);

        adjustedfloatInput[loopCount*4] = (float32_t)((adjustedSampleBuffer[loopCount] & 0xFFFF))/(float32_t)(6553.6f);
        adjustedfloatInput[loopCount*4 + 1] = 0.0f;
        adjustedfloatInput[loopCount*4 + 2] = (float32_t)(((adjustedSampleBuffer[loopCount] & 0xFFFF0000) >> 16))/(float32_t)(6553.6f);
        adjustedfloatInput[loopCount*4 + 3] = 0.0f;
    }
    Display_close(displayHandle);

    return 0;
}

/*
 * This function is called whenever a buffer is full. The content is converted
 * to floating point representation and FFT is performed on the 3 channels. In
 * the end the Conversion Mutex is released for the device to go to LPM3 state. (LPM3 -low power mode with rtc )
 *
 */
void adcBufCallback(ADCBuf_Handle handle, ADCBuf_Conversion *conversion,
    void *completedADCBuffer, uint32_t completedChannel) {

    int_fast16_t loopCount;

    if(avgLoop == (AVG_LOOP_COUNT-1))
    {
        /* Power Down the Sensor and Power Down the Switch for the AFE */
        GPIO_write(Board_GPIO_SENSOREN, Board_GPIO_LED_OFF);
        GPIO_write(Board_GPIO_SENSORPWREN, Board_GPIO_LED_OFF);
    }

    /* Adjust raw adc values and convert them to microvolts */
    ADCBuf_adjustRawValues(handle, completedADCBuffer, ADCBUFFERSIZE,
        completedChannel);
    convertAdjustedDataToFloat(completedADCBuffer, setfloatInput, ADCBUFFERSIZE);

    if(0 == completedChannel)
    {
        /* CPU now performs the X Axis-FFT calculation */
#if FFTSIZE == 2048 && defined(DeviceFamily_MSP432P4x1xI)
        arm_cfft_f32(&arm_cfft_sR_f32_len4096, setfloatInput, ifftFlag, doBitReverse);
#elif FFTSIZE == 1024 && defined(DeviceFamily_MSP432P4x1xI)
        arm_cfft_f32(&arm_cfft_sR_f32_len2048, setfloatInput, ifftFlag, doBitReverse);
#elif FFTSIZE == 512
        arm_cfft_f32(&arm_cfft_sR_f32_len1024, setfloatInput, ifftFlag, doBitReverse);
#elif FFTSIZE == 256
        arm_cfft_f32(&arm_cfft_sR_f32_len512, setfloatInput, ifftFlag, doBitReverse);
#endif

        /* Process the data through the Complex Magnitude Module for
         * calculating the magnitude at each bin */
        arm_cmplx_mag_f32(setfloatInput, fftOutput, ADCBUFFERSIZE);

        /* Store the DC Value */
        if(avgLoop == 0)
        {
            XAxisEnergyBin.energyValue[0] = fftOutput[0];
        }
        else
        {
            XAxisEnergyBin.energyValue[0] += fftOutput[0];
        }

        for(loopCount=1; loopCount<FFTSIZE; loopCount++)
        {
            /* Perform the FFT Bin conversion for +ve and -ve frequency
             * wrapping to +ve frequency */
            if(avgLoop == 0)
            {
                XAxisEnergyBin.energyValue[loopCount] = 2*fftOutput[loopCount];
            }
            else
            {
                XAxisEnergyBin.energyValue[loopCount] += 2*fftOutput[loopCount];
            }

            if(loopCount > 1)
            {
                if(XAxisEnergyBin.energyValue[loopCount] > XAxisEnergyBin.maxValue)
                {
                    XAxisEnergyBin.maxValue = XAxisEnergyBin.energyValue[loopCount];
                    XAxisEnergyBin.maxValueBin = loopCount;
                }
            }
            else
            {
                XAxisEnergyBin.maxValue    = XAxisEnergyBin.energyValue[1];
                XAxisEnergyBin.maxValueBin = 1;
            }
        }
    }
    else if(1 == completedChannel)
    {
        /* CPU now performs the X Axis-FFT calculation */
#if FFTSIZE == 2048 && defined(DeviceFamily_MSP432P4x1xI)
        arm_cfft_f32(&arm_cfft_sR_f32_len4096, setfloatInput, ifftFlag, doBitReverse);
#elif FFTSIZE == 1024 && defined(DeviceFamily_MSP432P4x1xI)
        arm_cfft_f32(&arm_cfft_sR_f32_len2048, setfloatInput, ifftFlag, doBitReverse);
#elif FFTSIZE == 512
        arm_cfft_f32(&arm_cfft_sR_f32_len1024, setfloatInput, ifftFlag, doBitReverse);
#elif FFTSIZE == 256
        arm_cfft_f32(&arm_cfft_sR_f32_len512, setfloatInput, ifftFlag, doBitReverse);
#endif

        /* Process the data through the Complex Magnitude Module for
         * calculating the magnitude at each bin */
        arm_cmplx_mag_f32(setfloatInput, fftOutput, ADCBUFFERSIZE);

        /* Store the DC Value */
        if(avgLoop == 0)
        {
            YAxisEnergyBin.energyValue[0] = fftOutput[0];
        }
        else
        {
            YAxisEnergyBin.energyValue[0] += fftOutput[0];
        }

        for(loopCount=1; loopCount<FFTSIZE; loopCount++)
        {
            /* Perform the FFT Bin conversion for +ve and -ve frequency
             * wrapping to +ve frequency */
            if(avgLoop == 0)
            {
                YAxisEnergyBin.energyValue[loopCount] = 2*fftOutput[loopCount];
            }
            else
            {
                YAxisEnergyBin.energyValue[loopCount] += 2*fftOutput[loopCount];
            }

            if(loopCount > 1)
            {
                if(YAxisEnergyBin.energyValue[loopCount] > YAxisEnergyBin.maxValue)
                {
                    YAxisEnergyBin.maxValue = YAxisEnergyBin.energyValue[loopCount];
                    YAxisEnergyBin.maxValueBin = loopCount;
                }
            }
            else
            {
                YAxisEnergyBin.maxValue    = YAxisEnergyBin.energyValue[1];
                YAxisEnergyBin.maxValueBin = 1;
            }
        }
    }
    if(2 == completedChannel)
    {
        /* CPU now performs the X Axis-FFT calculation */
#if FFTSIZE == 2048 && defined(DeviceFamily_MSP432P4x1xI)
        arm_cfft_f32(&arm_cfft_sR_f32_len4096, setfloatInput, ifftFlag, doBitReverse);
#elif FFTSIZE == 1024 && defined(DeviceFamily_MSP432P4x1xI)
        arm_cfft_f32(&arm_cfft_sR_f32_len2048, setfloatInput, ifftFlag, doBitReverse);
#elif FFTSIZE == 512
        arm_cfft_f32(&arm_cfft_sR_f32_len1024, setfloatInput, ifftFlag, doBitReverse);
#elif FFTSIZE == 256
        arm_cfft_f32(&arm_cfft_sR_f32_len512, setfloatInput, ifftFlag, doBitReverse);
#endif

        /* Process the data through the Complex Magnitude Module for
         * calculating the magnitude at each bin */
        arm_cmplx_mag_f32(setfloatInput, fftOutput, ADCBUFFERSIZE);

        /* Store the DC Value */
        if(avgLoop == 0)
        {
            ZAxisEnergyBin.energyValue[0] = fftOutput[0];
        }
        else
        {
            ZAxisEnergyBin.energyValue[0] += fftOutput[0];
        }

        for(loopCount=1; loopCount<FFTSIZE; loopCount++)
        {
            /* Perform the FFT Bin conversion for +ve and -ve frequency
             * wrapping to +ve frequency */
            if(avgLoop == 0)
            {
                ZAxisEnergyBin.energyValue[loopCount] = 2*fftOutput[loopCount];
            }
            else
            {
                ZAxisEnergyBin.energyValue[loopCount] += 2*fftOutput[loopCount];
            }

            if(loopCount > 1)
            {
                if(ZAxisEnergyBin.energyValue[loopCount] > ZAxisEnergyBin.maxValue)
                {
                    ZAxisEnergyBin.maxValue = ZAxisEnergyBin.energyValue[loopCount];
                    ZAxisEnergyBin.maxValueBin = loopCount;
                }
            }
            else
            {
                ZAxisEnergyBin.maxValue    = ZAxisEnergyBin.energyValue[1];
                ZAxisEnergyBin.maxValueBin = 1;
            }
        }

        /* Average out the values for AVG_LOOP_COUNT times */
        if(avgLoop == (AVG_LOOP_COUNT-1))
        {
            for(loopCount=0; loopCount<FFTSIZE; loopCount++)
            {
                XAxisEnergyBin.energyValue[loopCount] = (XAxisEnergyBin.energyValue[loopCount])/AVG_LOOP_COUNT;
                YAxisEnergyBin.energyValue[loopCount] = (YAxisEnergyBin.energyValue[loopCount])/AVG_LOOP_COUNT;
                ZAxisEnergyBin.energyValue[loopCount] = (ZAxisEnergyBin.energyValue[loopCount])/AVG_LOOP_COUNT;
            }

            XAxisEnergyBin.maxValue = XAxisEnergyBin.maxValue/AVG_LOOP_COUNT;
            YAxisEnergyBin.maxValue = YAxisEnergyBin.maxValue/AVG_LOOP_COUNT;
            ZAxisEnergyBin.maxValue = ZAxisEnergyBin.maxValue/AVG_LOOP_COUNT;
        }

        /* Post the Conversion Complete Mutex */
        sem_post(&adcConvMutex);
    }
}

#ifdef GPIO_WAKEUP
/* Call back function when GPIO SW1 is pressed. This wakes up the system from
 * LPM3 state and starts the next ADC sample acquisition and FFT processing.
 * */
void gpioButtonFxn0(uint_least8_t x)
{
    sem_post(&devWakeMutex);
}
#endif

/* Vibration Task to start the Thread for Vibration data capture */
void vibrationTask(void)
{
    pthread_t           thread;
    pthread_attr_t      attrs;
    struct sched_param  priParam;
    int                 retc;
    int                 detachState;

    /* Set priority and stack size attributes */
    pthread_attr_init(&attrs);
    priParam.sched_priority = VIBRATION_TASK_PRIORITY;

    detachState = PTHREAD_CREATE_DETACHED;
    retc = pthread_attr_setdetachstate(&attrs, detachState);
    if (retc != 0) {
        /* pthread_attr_setdetachstate() failed */
        while (1);
    }

    pthread_attr_setschedparam(&attrs, &priParam);

    retc |= pthread_attr_setstacksize(&attrs, VIBRATION_TASK_STACK_SIZE);
    if (retc != 0) {
        /* pthread_attr_setstacksize() failed */
        while (1);
    }

    retc = pthread_create(&thread, &attrs, vibrationThread, NULL);
    if (retc != 0) {
        /* pthread_create() failed */
        while (1);
    }
}

/* Callback function for Power Policy Manager to perform specific tasks on
 * LMP3 Entry and Wake. During LPM3 Entry, the GPIO for AFE Power Enable and
 * Sensor Enable are made low to reduce current consumption. Also since
 * enableparking is disabled, the unused IO's are configured to output low
 * state so that current consumption is reduced. During LPM3 exit the GPIO for
 * AFE Power Enable and Sensor Enable are made High.
 * */
uint8_t notifyDeepSleepFxn(uint8_t eventType, uint8_t eventArg, uint8_t clientArg)
{
    if(PowerMSP432_ENTERING_DEEPSLEEP == eventType)
    {
        /* Set the unused IOs to low state */
#ifdef GPIO_WAKEUP
#ifdef BLE_COMMS
        MAP_GPIO_setOutputLowOnPin(GPIO_PORT_PA, (PIN_ALL16 & ~(GPIO_PIN1|GPIO_PIN2|GPIO_PIN3|GPIO_PIN13)));
#else
        MAP_GPIO_setOutputLowOnPin(GPIO_PORT_PA, (PIN_ALL16 & ~(GPIO_PIN1|GPIO_PIN2|GPIO_PIN3)));
#endif
#else
#ifdef BLE_COMMS
    	MAP_GPIO_setOutputLowOnPin(GPIO_PORT_PA, (PIN_ALL16 & ~(GPIO_PIN2|GPIO_PIN3|GPIO_PIN13)));
#else
        MAP_GPIO_setOutputLowOnPin(GPIO_PORT_PA, (PIN_ALL16 & ~(GPIO_PIN2|GPIO_PIN3)));
#endif
#endif
#ifdef BLE_COMMS
        MAP_GPIO_setOutputLowOnPin(GPIO_PORT_PB, (PIN_ALL16 & ~(GPIO_PIN2|GPIO_PIN3|GPIO_PIN8|GPIO_PIN10)));
        MAP_GPIO_setOutputLowOnPin(GPIO_PORT_PC, (PIN_ALL16 & ~(GPIO_PIN8|GPIO_PIN9|GPIO_PIN15)));
#else
        MAP_GPIO_setOutputLowOnPin(GPIO_PORT_PB, (PIN_ALL16 & ~(GPIO_PIN8|GPIO_PIN10)));
        MAP_GPIO_setOutputLowOnPin(GPIO_PORT_PC, (PIN_ALL16 & ~(GPIO_PIN9)));
#endif
     	MAP_GPIO_setOutputLowOnPin(GPIO_PORT_PD, PIN_ALL16);
        MAP_GPIO_setOutputLowOnPin(GPIO_PORT_PE, PIN_ALL16);
        MAP_GPIO_setOutputLowOnPin(GPIO_PORT_PJ, PIN_ALL16);
#ifdef GPIO_WAKEUP
#ifdef BLE_COMMS
        MAP_GPIO_setAsOutputPin(GPIO_PORT_PA, (PIN_ALL16 & ~(GPIO_PIN1|GPIO_PIN2|GPIO_PIN3|GPIO_PIN13)));
#else
        MAP_GPIO_setAsOutputPin(GPIO_PORT_PA, (PIN_ALL16 & ~(GPIO_PIN1|GPIO_PIN2|GPIO_PIN3)));
#endif
#else
#ifdef BLE_COMMS
        MAP_GPIO_setAsOutputPin(GPIO_PORT_PA, (PIN_ALL16 & ~(GPIO_PIN2|GPIO_PIN3|GPIO_PIN13)));
#else
        MAP_GPIO_setAsOutputPin(GPIO_PORT_PA, (PIN_ALL16 & ~(GPIO_PIN2|GPIO_PIN3)));
#endif
#endif
#ifdef BLE_COMMS
        MAP_GPIO_setAsOutputPin(GPIO_PORT_PB, (PIN_ALL16 & ~(GPIO_PIN2|GPIO_PIN3|GPIO_PIN8|GPIO_PIN10)));
        MAP_GPIO_setAsOutputPin(GPIO_PORT_PC, (PIN_ALL16 & ~(GPIO_PIN8|GPIO_PIN9|GPIO_PIN15)));
#else
        MAP_GPIO_setAsOutputPin(GPIO_PORT_PB, (PIN_ALL16 & ~(GPIO_PIN8|GPIO_PIN10)));
        MAP_GPIO_setAsOutputPin(GPIO_PORT_PC, (PIN_ALL16 & ~(GPIO_PIN9)));
#endif
        MAP_GPIO_setAsOutputPin(GPIO_PORT_PD, PIN_ALL16);
        MAP_GPIO_setAsOutputPin(GPIO_PORT_PE, PIN_ALL16);
        MAP_GPIO_setAsOutputPin(GPIO_PORT_PJ, PIN_ALL16);


        /* Turn off PSS high-side supervisors to consume less power in shutdown */
        MAP_PSS_disableHighSide();
    }
    else
    {
#ifdef BLE_COMMS
        if(GPIO_read(Board_SRDY) == 0)
        {
            Power_setConstraint(PowerMSP432_DISALLOW_DEEPSLEEP_0);
        }
#endif

        /* Enable ADC pins in ADC mode before powering up the AFE supply, to
         * avoid bus contention */
        MAP_GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P6,
                GPIO_PIN1, GPIO_TERTIARY_MODULE_FUNCTION);
        MAP_GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P4,
                GPIO_PIN0, GPIO_TERTIARY_MODULE_FUNCTION);
        MAP_GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P4,
                GPIO_PIN2, GPIO_TERTIARY_MODULE_FUNCTION);
        MAP_GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P1,
                GPIO_PIN2 | GPIO_PIN3, GPIO_PRIMARY_MODULE_FUNCTION);
    }

    return 0;
}

#ifdef RTC_WAKEUP
/* Function to set the next wakeup time after N Hours and M minutes */
void predictive_maintenance_setWakeTime(uint8_t Hours, uint8_t Minutes)
{
    RTC_C_Calendar newTime;
    uint_fast8_t excessHours = 0;

    /* Get the current time */
    newTime = MAP_RTC_C_getCalendarTime();

    /* Check if the wakeup period parameters are valid
     * Hour interval cannot be more than 24
     * Minute interval cannot be more than 60
     * Hour and Minute both cannot be 0 */
    if((Hours > 24) || (Minutes > 60) || ((Hours == 0) && (Minutes == 0)))
    {
        while(1);
    }

    /* Get the current time and check if there is a roll over for minute or
     * hour. If there is a hour roll over, then change the next match time
     * for 0 hrs. If there is a minute roll over, then increment the hour
     * and then set the minute match time. If there is no roll over for
     * either minute or hour then program the next match time with hour
     * unchanged and minute added. */

    newTime.minutes = newTime.minutes + Minutes;

    if(newTime.minutes > 59)
    {
        newTime.minutes = newTime.minutes - 60;
        excessHours = 1;
    }

    newTime.hours = newTime.hours + Hours + excessHours;

    if(newTime.hours > 23)
    {
        newTime.hours = newTime.hours - 24;
    }

    MAP_RTC_C_setCalendarAlarm(newTime.minutes,
                               newTime.hours,
                               RTC_C_ALARMCONDITION_OFF,
                               RTC_C_ALARMCONDITION_OFF);
}
#endif

/* The Vibration Thread which handles the scheduling of the ADC data
 * acquisition and FFT conversion */
void *vibrationThread(void *arg0)
{
#ifdef RTC_WAKEUP
    /* Hwi variables */
    HwiP_Handle hwiPRTC = NULL;
    HwiP_Params hwiPRTCParams;
#endif

    /* Power Up AFE Timer Handle */
    Timer_Handle timer0;
    Timer_Params params;

    /* ADC Buff Handle */
    ADCBuf_Handle adcBuf;
    ADCBuf_Params adcBufParams;
    ADCBufMSP432_ParamsExtension adcBufParamsEx;
    ADCBuf_Conversion oneshotVibChannels[ADC_NO_OF_CH];

    /* Set up an ADCBuf peripheral in ADCBuf_RECURRENCE_MODE_ONE_SHOT */
    ADCBuf_Params_init(&adcBufParams);
    adcBufParams.callbackFxn = adcBufCallback;
    adcBufParams.recurrenceMode = ADCBuf_RECURRENCE_MODE_ONE_SHOT;
    adcBufParams.returnMode = ADCBuf_RETURN_MODE_CALLBACK;
    adcBufParams.samplingFrequency = ADC_CH_SAMPLING_FREQ*ADC_NO_OF_CH;
    adcBufParamsEx.samplingDuration = ADCBufMSP432_SamplingDuration_PULSE_WIDTH_16;
    adcBufParams.custom = &adcBufParamsEx;
    adcBuf = ADCBuf_open(Board_ADCBUF0, &adcBufParams);

    /* Configure the conversion struct */
    oneshotVibChannels[0].arg = NULL;
    oneshotVibChannels[0].adcChannel = Board_ADCBUF0CHANNEL_0;
    oneshotVibChannels[0].sampleBuffer = sampleBufferX;
    oneshotVibChannels[0].sampleBufferTwo = NULL;
    oneshotVibChannels[0].samplesRequestedCount = ADCBUFFERSIZE;

    oneshotVibChannels[1].arg = NULL;
    oneshotVibChannels[1].adcChannel = Board_ADCBUF0CHANNEL_1;
    oneshotVibChannels[1].sampleBuffer = sampleBufferY;
    oneshotVibChannels[1].sampleBufferTwo = NULL;
    oneshotVibChannels[1].samplesRequestedCount = ADCBUFFERSIZE;

    oneshotVibChannels[2].arg = NULL;
    oneshotVibChannels[2].adcChannel = Board_ADCBUF0CHANNEL_2;
    oneshotVibChannels[2].sampleBuffer = sampleBufferZ;
    oneshotVibChannels[2].sampleBufferTwo = NULL;
    oneshotVibChannels[2].samplesRequestedCount = ADCBUFFERSIZE;

    if (!adcBuf){
        /* AdcBuf did not open correctly. */
        while(1);
    }

    /* Create Mutex for ADC Conversion before starting the next cycle */
    sem_init(&adcConvMutex, 1, 0);

    /* Create Mutex for Device wakeup due to GPIO switch release or RTC
     * wake up */
    sem_init(&devWakeMutex, 1, 0);

    /* Create Mutex for Device sleep mode entry during power up sequencing
     * of the AFE to reduce current consumption */
    sem_init(&afeWakeMutex, 1, 0);

#ifdef GPIO_WAKEUP
    /* Initialize interrupts for all ports that need them */
    GPIO_setCallback(Board_GPIO_BUTTON0, gpioButtonFxn0);
    GPIO_enableInt(Board_GPIO_BUTTON0);
#endif

    Power_setPolicy((Power_PolicyFxn)PowerMSP432_deepSleepPolicy);

    Power_setConstraint(PowerMSP432_DISALLOW_DEEPSLEEP_1);

    /* Register for entering shutdown notifications */
    Power_registerNotify(&notifyObj, PowerMSP432_ENTERING_DEEPSLEEP | PowerMSP432_AWAKE_DEEPSLEEP,
        (Power_NotifyFxn) notifyDeepSleepFxn, 0);

#ifdef RTC_WAKEUP
    /* Initialize RTC for current time and wakeup due to time match from
     * calendar mode. */
    MAP_RTC_C_initCalendar(&currentTime, RTC_C_FORMAT_BINARY);

    MAP_RTC_C_setPrescaleValue(RTC_C_PRESCALE_0, 0);
    MAP_RTC_C_definePrescaleEvent(RTC_C_PRESCALE_0, RTC_C_PSEVENTDIVIDER_64);
    MAP_RTC_C_clearInterruptFlag(RTC_C_CLOCK_ALARM_INTERRUPT);
    MAP_RTC_C_enableInterrupt(RTC_C_CLOCK_ALARM_INTERRUPT);

    MAP_RTC_C_startClock();

    /* Enable interrupts from RTC Module. */
    HwiP_Params_init(&hwiPRTCParams);
    hwiPRTCParams.arg = 0;
    hwiPRTCParams.priority = 0x20;
    hwiPRTC = HwiP_create(INT_RTC_C, (HwiP_Fxn)RTC_C_IRQHandler, &hwiPRTCParams);

    if (hwiPRTC == NULL)
    {
        while(1);
    }
#endif

    /* Setting up the timer in continuous callback mode that calls the callback
     * function for 279 ms to power up 3.3V AFE rail and 62 ms to power up the
     * 3-axis sensor.
     */
    Timer_Params_init(&params);

    /*
     * Go to sleep in the foreground thread forever. The data will be collected
     * and transfered in the background thread
     */
    for(;;)
    {
#ifdef DeviceFamily_MSP432P4x1xI
        /* Set constraint to prevent the device from going to LPM3.0 state */
        Power_setConstraint(PowerMSP432_DISALLOW_DEEPSLEEP_0);
#endif

        /* Power Up the Switch for the AFE */
        GPIO_write(Board_GPIO_SENSORPWREN, Board_GPIO_LED_ON);

        params.period = 40000;
        params.periodUnits = Timer_PERIOD_US;
        params.timerMode = Timer_ONESHOT_CALLBACK;
        params.timerCallback = timerCallback;
        timer0 = Timer_open(Board_TIMER0, &params);

        if (timer0 == NULL) {
            /* Failed to initialized timer */
            while (1);
        }
        if (Timer_start(timer0) == Timer_STATUS_ERROR) {
            /* Failed to start timer */
            while (1);
        }
        sem_wait(&afeWakeMutex);
        Timer_close(timer0);

        /* Power Up the Sensor */
        GPIO_write(Board_GPIO_SENSOREN, Board_GPIO_LED_ON);

        params.period = 10000;
        params.periodUnits = Timer_PERIOD_US;
        params.timerMode = Timer_ONESHOT_CALLBACK;
        params.timerCallback = timerCallback;
        timer0 = Timer_open(Board_TIMER0, &params);

        if (timer0 == NULL) {
            /* Failed to initialized timer */
            while (1);
        }
        if (Timer_start(timer0) == Timer_STATUS_ERROR) {
            /* Failed to start timer */
            while (1);
        }
        sem_wait(&afeWakeMutex);
        Timer_close(timer0);

        avgLoop = 0;

#ifdef DeviceFamily_MSP432P4x1xI
        /* Set constraint to prevent the device from going to LPM3.0 state */
        Power_releaseConstraint(PowerMSP432_DISALLOW_DEEPSLEEP_0);
#endif

        /* Allocate memory buffer for FFT computation */
        fftOutput = malloc(ADCBUFFERSIZE*sizeof(float32_t));

		do
        {
            /* Start converting using ADCBuf Drivers */
            if (ADCBuf_convert(adcBuf, oneshotVibChannels, ADC_NO_OF_CH) !=
                ADCBuf_STATUS_SUCCESS) {
                /* Did not start conversion process correctly. */
                while(1);
            }

            /* Wait for ADC Conversion to Complete */
            sem_wait(&adcConvMutex);

            /* Increment the loop count */
            avgLoop++;
        }
        while(avgLoop < AVG_LOOP_COUNT);

		/* Free the Buffer */
        free(fftOutput);

        /* Send Mutex to start data transmission and wait for data transmission
         * to complete. Before sending the data prevent LPM3 transition and only
         * when it is complete allow LPM3 transition */
        Power_setConstraint(PowerMSP432_DISALLOW_DEEPSLEEP_0);
        sem_post(&startComms);
        sem_wait(&endComms);
        Power_releaseConstraint(PowerMSP432_DISALLOW_DEEPSLEEP_0);
        Power_releaseConstraint(PowerMSP432_DISALLOW_DEEPSLEEP_0);

#ifdef RTC_WAKEUP
        predictive_maintenance_setWakeTime(0, 1);
#endif
        /* Wait for GPIO To wakeup the device from LPM3 */
        sem_wait(&devWakeMutex);
#ifdef BLE_COMMS
        uint32_t eventPend = AP_EVT_HOSTMCU_WAKE;
        mq_send(apQueueSend, (void*)&eventPend, sizeof(uint32_t), 1);
#endif

    }
}

#ifdef RTC_WAKEUP
/* Interrupt handler for RTC Match Event */
void RTC_C_IRQHandler(void)
{
    /* Clear the interrupt status for alarm and timer-0 interrupt */
    MAP_RTC_C_clearInterruptFlag(RTC_C_CLOCK_ALARM_INTERRUPT);

    /* Post the semaphore to process the ADCBuf Task and FFT */
    sem_post(&devWakeMutex);

}
#endif

void timerCallback(Timer_Handle myHandle)
{
    /* Post the semaphore to sequence the power up of the AFE */
    sem_post(&afeWakeMutex);
}

MSP430FR2633: Wake-on-Proximity and Wakeup Interval

$
0
0

Part Number: MSP430FR2633

Hi,
My customers made a capacitive sensor product with MSP430FR2633.
This product wakes up even though they are not touching.

Wake-on-Proximity occurs at the cycle timing of Wakeup Interval.
Would you tell me the solution?

(Please visit the site to view this file)


Regards,
Rei

MSP430FR6043: USS the amplitude of ADC Capture is negative

$
0
0

Part Number: MSP430FR6043

Dear team,

I am using the USS of MSP430FR6043. I found that the amplitude of ADC Capture has negative number in Ultrasonic Design Center. 

So please kindly tell me why it has negative number.

http://www.ti.com.cn/cn/lit/ml/slau765b/slau765b.pdf  

Figure 6. ADC Capture in Design Center

MSP430FR2311: ADC timing question

$
0
0

Part Number: MSP430FR2311

HI Team,  

My intention is to trigger a conversion using the eComp output with a short sample delay. The scope plot below shows what I have happening – red is the eComp input and blue is a DIO line I am toggling to show timings on my ISR. What I see is that there is a 58usec delay between ADC being triggered by eComp and the ISR being triggered following a conversion; I was expecting less than that…200ksps = 5usec. I’m also finding that I need to force a conversion in my eComp ISR for this to work correctly by calling ADC_startConversion(…). I thought this should be triggered automatically.

 

ADC registers when initialised and when the ISR is entered are also below.

 

I’ve tried various things but am not able to change the timings. What am I doing wrong?   code attached(Please visit the site to view this file)

MSP430F5529: HELP! my project can`t run out [__data16_memzero]

$
0
0

Part Number: MSP430F5529

my mcu keeps reset.

it can`t run into main().

i found it keeps reset by wdog and i really don`t know how to close wdog.

like this:

my ide:IAR 7.12

I really need help,It's been bothering me for days.

help me,pls.


MSP430F247: Brownout and Power OFF problems with 16 MHz and 3.3V

$
0
0

Part Number: MSP430F247

My previous thread "MSP430F247: MCU doesn't start anymore until voltage drops below 2V (or less)" is locked, so I had to begin a new thread...

My problem is that my device using MSP430F247 with DCO at 16 MHz and powered with 3.3V (from 12V with cascaded 78M05 and LD1117S33CTR), can be powered OFF for a short time, sometimes not enough to have the MCU reset using 47 kohm and 2200pF on Reset pin.

When this happens, the MCU hangs and doesn't reboot until manually shorting the reset pin to Vss or until the power is manually removed for a much longer time, enough to have the reset with the RC.

The browout voltage of 3.2V is too critical (too high) with a 3.3V regulator, so I used a brownout voltage with reset of 3.05V  but, sometimes, when Vdd is 3.05V, it is too late and the MCU is already hanged and never resets.

I know that adding an hardware voltage supervisor with reset would solve the problem, but the hardware can't be changed and I don't know if JTAG programming will still work.

I'm in a "cul the sac", because I've tried many firmware solutions, but none works, when the MCU hangs near 3.05V...

It looks like using an MSP430F247 at 16 MHz with 3.3V is very critical without an hardware voltage supervisor with reset, but I need all the MCU power at 16 Mhz and I can't reduce the clock to 12 or 8 MHz

Best regards

Guido

MSP430FR6047: template project vs Demo example

CCS/MSP430F5529: MSP430F5529

$
0
0

Part Number: MSP430F5529

Tool/software: Code Composer Studio

Hi Sir

1) Can anyone let me know how can I access 79x magic constants in MSP430F5529 which are 24-bit long and how to load these constants with the data which I get from TICS PRO software and I haven't found the slave select pin in MSP430F5529  to interface with LMX2595.

2) The launch pad kit is used to program the controller but once it is programmed we cannot remove the controller from the launch pad kit. In the fabrication point of view how can I load the code in the controller and interface with the slave device LMX2595. 

3) In my application I am using MSP430F5529 to interface with LMX2595 to generate 17 GHz frequency. Now in order to generate different frequency in steps (17.01,17.02...) the value of fractional divider which is in the feedback path of the VCO and Phase frequency detector is to be changed. Now can I obtain this but using any switch case in programming because for each and every new frequency I need to change the entire registers values. Can I achieve this by using single micro controller. 

4) Any help with respect to spi programming will be greatly appreciated.

Thanks in advance.   

CCS/MSP430G2553: MSP low-power microcontroller forum

$
0
0

Part Number: MSP430G2553

Tool/software: Code Composer Studio

I am using Closed Loop Analysis along with PI on MSP430G2553 to get constant output from the buck-boost converter. I need a constant 12V output. The code is working fine except for the input range 11.5V to 16V, where it gives an output which is continuously boosting till 17V. Please help me to figure out this issue.

EVM430-FR6047: EVM430-FR6047

$
0
0

Part Number: EVM430-FR6047

Hi, we are trying to connect the TIDA-01486 TO THE EVM430FR6047. We are a littlebit confused about the connectors we suspect should be connected to each other with a flat cable?

EVM CH0 OUT would then be connected to GND?

Please advise.

regards,

Laurent

Viewing all 21951 articles
Browse latest View live


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