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

Reg - MSP430 ADC SW Support

$
0
0

Hi,

Can you review this code because it is not working for me. This is ADC Code, In this code i configured internal reference and perform repeated conversions on a single channel using "repeat-single-channel" mode.

#include <msp430.h>

#define Num_of_Results 8

volatile unsigned int results[Num_of_Results];
// Needs to be global in this
// example. Otherwise, the
// compiler removes it because it
// is not used for anything.

int main(void)
{
WDTCTL = WDTPW+WDTHOLD; // Stop watchdog timer
P6SEL |= 0x01; // Enable A/D channel A0
REFCTL0 &= ~REFMSTR; // Reset REFMSTR to hand over control to
// ADC12_A ref control registers ADC12CTL0 =
ADC12CTL0 = ADC12ON+ADC12SHT02+ADC12REFON+ADC12REF2_5V; // Turn on ADC12, set sampling time
// set multiple sample conversion
ADC12CTL1 = ADC12SHP+ADC12CONSEQ_2; // Use sampling timer, set mode
ADC12IE = 0x01; // Enable ADC12IFG.0
ADC12CTL0 |= ADC12ENC; // Enable conversions
ADC12CTL0 |= ADC12SC; // Start conversion

__bis_SR_register(LPM4_bits + GIE); // Enter LPM4, Enable interrupts
__no_operation(); // For debugger

}


#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
#pragma vector=ADC12_VECTOR
__interrupt void ADC12ISR (void)
#elif defined(__GNUC__)
void __attribute__ ((interrupt(ADC12_VECTOR))) ADC12ISR (void)
#else
#error Compiler not supported!
#endif
{
static unsigned char index = 0;

switch(__even_in_range(ADC12IV,34))
{
case 0: break; // Vector 0: No interrupt
case 2: break; // Vector 2: ADC overflow
case 4: break; // Vector 4: ADC timing overflow
case 6: // Vector 6: ADC12IFG0
results[index] = ADC12MEM0; // Move results
index++; // Increment results index, modulo; Set Breakpoint1 here

if (index == 8)
{
index = 0;
}
case 8: break; // Vector 8: ADC12IFG1
case 10: break; // Vector 10: ADC12IFG2
case 12: break; // Vector 12: ADC12IFG3
case 14: break; // Vector 14: ADC12IFG4
case 16: break; // Vector 16: ADC12IFG5
case 18: break; // Vector 18: ADC12IFG6
case 20: break; // Vector 20: ADC12IFG7
case 22: break; // Vector 22: ADC12IFG8
case 24: break; // Vector 24: ADC12IFG9
case 26: break; // Vector 26: ADC12IFG10
case 28: break; // Vector 28: ADC12IFG11
case 30: break; // Vector 30: ADC12IFG12
case 32: break; // Vector 32: ADC12IFG13
case 34: break; // Vector 34: ADC12IFG14
default: break;
}
}

I am reading wrong hex value @ ADC12MEM0.

For 1.93V at A0 I am reading 0x094F but I need read 0x0C5F. I dont know whether i configured internal reference correctly.

Thanks

Sathiyan


How can i generate a 1 pulse per second ?

$
0
0

Hello ,

I'm using MSP430F5131 micro-controller

I'm using an external oscillator of 12.8MHz which connected to pins PJ.4 and PJ.5 and defined P2.4 ( with timer : TD0.0) as my 1 pulse per second output.

I would like to generate a 1 pulse per second using this external oscillator through P2.4 . In addition to this 1 PPS i got a toggle switch that toggles between a "normal" 1 pulse per second and a "bad" pulse of 0.5 second.

First of all i would like to know how to write a proper code of 1PPS and then i would like to implement both of the pulses ("normal" and "bad") into the code.

I have written a code of a 1PPS , i'm not sure if i have written it correctly :

  TD0CCR0=49999;                          // setting TAR count up value -1

 

    TD0CCTL0=CCIE;                          //enabling interuption

 

    TD0CTL0 =MC_1|ID_3|IDEX_3|TDSSEL_0|TDCLR; //defining timer d TD0.0 (P2.4)

 

    __enable _interrupt ();

 

    for(;;){

  if ((P1IN & BIT2)==0) { //ACTIVE LOW

 

       #pragma vector = TIMERD0_VECTOR //GENERATES 1PPS EVERY 1s

 

          __interrupt void TD0_ISR (void){

 

          P2OUT ^=BIT4;//TOGGLE THE 1PPS PULSE ('1' - '0' )

 

                     }

}

}

Thanks in advance.

MSPEXP430G2 launchpad USB interface

$
0
0

Hello,

I am using mspexp430g2 launchpad with msp430g2553. I am using CCStudio to write and load program in chip. I am able to do so using USB cable. But after programming chip using same program, I try to communicate with PC using hyperterminal or labwindows CVI. The port is open but data is sent and received some time only. Chip fails operation sometimes and suceed sometime in random fashion. Is this problem of UART interface in launchpad? Because from PC side I am successfully writing values to chip but it doesnt send back required values..

Thanks in advance

Shalini 

interfacing gsm shield sim800c with msp430fr4133

$
0
0

according to msp430fr4133 diagram i connected the gsm sim800c tx with pin 3(rx mspboard) and r.x with pin 4(tx mspboard).then for the vcc(for gsm) i use a 12 v adapter and then connect the ground(gsm) with the pin 20(ground of msp)......is my connection is ok?i used the gsm in arduino....i use energia for sms

my code is

#include<msp430.h>
 void SendMessage()
{
  Serial.println("AT+CMGF=1");    //Sets the GSM Module in Text Mode
  delay(1000);  // Delay of 1000 milli seconds or 1 second
  Serial.println(Serial.read());
  Serial.println("AT+CMGS=\"+8801671422422\""); // Replace x with mobile number
  delay(1000);
  Serial.println("Warning! Excessive LPG detected at your house.");// The SMS text you want to send
  delay(100);
  Serial.println((char)26);// ASCII code of CTRL+Z
  delay(5000);
}
void setup(){
    Serial.begin(9600);
    //pinMode(RED_LED, OUTPUT);
    //pinMode(GREEN_LED, OUTPUT);
   SendMessage();
}

void loop(){

}

is my code ok?plz help

MSP430i204x metering library

$
0
0

hi,

if needs to identify the load between inductive or capacitive, i check the API of metering library, it seems have no suitable API to do it, is it right?

or how to make it achieveable? 

Using SPI, DMA and DMAE0 on MSP432

$
0
0

I found this thread.

In this thread it says that i can't use DMA with SPI with DMAE0 and send more than 1 byte. If I understood correctly, if I put the source DMA_CH0_EUSCIB0TX0 then the SPI generates the DMA request when the TX_SPI is ready. On the other hand, if I but the source to be DMAE0 then the DMA doesn't know if the SPI is ready and just copies the memory from one address to another without check the SPI ready signal.

I found on the internet that many systems have this feature that can use and combine both, so I first wanted to check here.

Thanks in advanced.
jasaleja

SPI MSP430FR5994

$
0
0

Hello, 

I am using the ADS1299 to adquire EEG signals, and I want to process them using the MSP430FR5994 launch pad. My question is: Can I communicate both of them, since ADS1299 has SPI module? I don't really understand the BoosterPack Standar that the MSP needs.

Thanks in advance.

Ángela Guerrero.

MSP430 Hangs BIOS, and then I get "Unknown Device" in device manager in Windows 7

$
0
0

Hi,

I've programmed my MSP430F5529 as a CDC+HID, and every so often my computer will stay on BIOS for more than usual, and when it boots up, will report unknown device in device manager with code 43. I've tried the USB9 fix, but to no avail. I think the code I'm using for initialization, that was pulled from the USB API, already includes this fix, anyway. This is what I pulled out of USB_init():

/* If USB device is self-powered, USB_SUPPORT_SELF_POWERED = 0xc0 */
#if (USB_SUPPORT_SELF_POWERED == 0xc0)
   /* To fix USB9 enumeration issue */
   USBPWRCTL = 0;
#endif

And I changed USB_SUPPORT_SELF_POWERED to 0xc0. Originally it was 0x80.

That did not help, so I tried changing the following line:

for (j = 0; j < 2000; j++) {
   for (i = 0; i < (DelayConstant_250us); i++) {//wait some time for LDOs (5ms delay)
   _NOP();
   }
}

I changed j<2000 from j<20. Now it is 500ms. This probably won't help, but I am trying to recreate the problem to see if maybe it did. If this doesn't fix the problem, I might resort to looking for an error produced from USB initialization and restart the MSP430 if I see the error.

Any other suggestions would help. 


SPI DMA Freezes when using DMA_INT0 with MSP432 Rev. C Silicon

$
0
0

I am using SPI DMA to read 18 bytes from an external IC. The IC generates a negative edge interrupt that is connected to a port IRQ.

In the PORT IRQ handler, I assert Chip Select ( CS ) low and then  enable the DMA.

In the DMA handler, I de-assert the CS high and then clear flags and copy the received data.

The main symptom is that SPI DMA gets triggered only once successfully... and then when the next port IRQ interrupt arrives, SPI-DMA does not get started: no SPI transactions occur.

I know that the PORT IRQ was executed (because the CS line goes low), however the DMA did not start the SPI transactions.

While debugging, I noticed that the UCTXIFG bit in the UCBxIFG register is 1 when the SPI successfully completes and UCTXIFG is set to 0, when the SPI DMA fails to start.

I looked at UCTXIFG after the execution of the following lines of code in the PORT IRQ handler

MAP_DMA_enableChannel(DMA_CHANNEL_1);

MAP_DMA_enableChannel(DMA_CHANNEL_0);

So it looks like the DMA did write to the eUSCI_B peripheral's TUCxxTXBUF, but for some reason the SPI peripheral did not start the transmission of the 18 bytes.

Also after reading the TRM, I know that the DMA_INT0 is a master interrupt and is different from the DMA_INT1/2/3 interrupts.

The problem is that the DMA_INT1/2/3 are mapped to other channels and I cannot use them, so I am left with DMA_INT0.

I also observed that when the SPI DMA fails and the DMA_INT0_IRQHandler gets called, then the value of INT0_SRCFLG is zeros. This is puzzling: how could the DMA_INT0_IRQHandler  be called and yet have all the bits in the source flag be reset to 0 ? I would think that at least 1 channel caused the interrupt handler to be called.

Another observation regarding DMA_INT0 is that if I do not disable the DMA_INT0 interrupt in the DMA_INT0_IRQHandler then the IRQ gets called again *even if I clear the DMA interrupt flags* . This reminds me of the DMA12 bug in the Rev B. silicon. But I think that was fixed in the production Rev C. silicon.

Also there is no way to assign DMA_INT0 to any specific trigger like a SPI RX or TX channel...

basically it is illegal to do this MAP_DMA_assignInterrupt(DMA_INT0, DMA_CHANNEL_1) because DMA_INT0 maps to all completion sources except those mapped to DMA_INT1/2/3

Ideally I would just want to map a SPI recieve (RX) DMA completion to DMA_INT0, but I guess that is not allowed.

(1) any suggestions to why the SPI DMA freezes

(2) Why am I seeing spurious interrupts on DMA_INT0 where none of the source bits are set?

here is a screen shot showing that the first DMA runs successfully , but the second one fails.

SPI CLK = 6MHz

SMCLK = 12MHz,

Clock is set to DCO = 12MHz

Here are the relevant code pieces :DMA configuration routine and Port and DMA IRQ handlers

const eUSCI_SPI_MasterConfig spiMasterConfig =
{
EUSCI_B_SPI_CLOCKSOURCE_SMCLK, // SMCLK Clock Source
6000000, // SMCLK = DCO/2 = 12MHz/2 = 6MHz
6000000, // SPICLK = 6MHz
EUSCI_B_SPI_MSB_FIRST, // MSB First
EUSCI_B_SPI_PHASE_DATA_CHANGED_ONFIRST_CAPTURED_ON_NEXT, // Phase
EUSCI_B_SPI_CLOCKPOLARITY_INACTIVITY_HIGH, // High polarity
EUSCI_B_SPI_3PIN // 3Wire SPI Mode
};

/* DMA Control Table */
#pragma DATA_ALIGN(1024)
static DMA_ControlTable controlTableInertialSensor[32];

----------------------------------------------------------------------------------------------------------------------------------------------

void Sensor::ConfigureDMA(void)
{
/* Configuring DMA module */
MAP_DMA_enableModule();
MAP_DMA_setControlBase(controlTableInertialSensor);

/* Assign DMA channel 0 to EUSCI_B0_TX0, channel 1 to EUSCI_B0_RX0 */
MAP_DMA_assignChannel(DMA_CH0_EUSCIB0TX0);
MAP_DMA_assignChannel(DMA_CH1_EUSCIB0RX0);

/* Setup the TX transfer characteristics & buffers */
MAP_DMA_setChannelControl(DMA_CH0_EUSCIB0TX0 | UDMA_PRI_SELECT,
UDMA_SIZE_8 | UDMA_SRC_INC_8 | UDMA_DST_INC_NONE | UDMA_ARB_1);

MAP_DMA_setChannelTransfer(DMA_CH0_EUSCIB0TX0 | UDMA_PRI_SELECT, UDMA_MODE_BASIC,
mTXData, (void *) MAP_SPI_getTransmitBufferAddressForDMA(EUSCI_B0_BASE),
INERTIAL_NUM_BYTES_TO_READ_PER_SAMPLE);

/* Setup the RX transfer characteristics & buffers */
MAP_DMA_setChannelControl(DMA_CH1_EUSCIB0RX0 | UDMA_PRI_SELECT,
UDMA_SIZE_8 | UDMA_SRC_INC_NONE | UDMA_DST_INC_8 | UDMA_ARB_1);

MAP_DMA_setChannelTransfer(DMA_CH1_EUSCIB0RX0 | UDMA_PRI_SELECT, UDMA_MODE_BASIC,
(void *) MAP_SPI_getReceiveBufferAddressForDMA(EUSCI_B0_BASE), mRXData,
INERTIAL_NUM_BYTES_TO_READ_PER_SAMPLE);

// Enable DMA interrupt and clear any previously set completion flags

MAP_DMA_enableInterrupt(INT_DMA_INT0);
MAP_Interrupt_enableInterrupt(INT_DMA_INT0);
MAP_DMA_clearInterruptFlag(DMA_CH0_EUSCIB0TX0);
MAP_DMA_clearInterruptFlag(DMA_CH1_EUSCIB0RX0);
}

----------------------------------------------------------------------------------------------------------------------------------------------

void InertialSensor::PORT2_IRQHandler(void)
{
/*
* disable the interrupt on the I2C DRDY port
* DMA operation on SPI and I2C should be atomic.
* Disable the other interrupts so that the current operation
* completes atomically before starting the other peripheral
*/
MAP_Interrupt_disableInterrupt(INT_PORT3);

uint32_t status;
status = MAP_GPIO_getEnabledInterruptStatus(GPIO_PORT_P2);
MAP_GPIO_clearInterruptFlag(GPIO_PORT_P2, 0xFF);

/*
* LSM6DS3 is signaling data is ready.
* Trigger the SPI read operation using DMA
*/
// reset the DMA transfer complete flag
mDMAXferComplete = false;

/* first assert the Chip Select (CS) to signal the start of the SPI transmission */
MAP_GPIO_setOutputLowOnPin(GPIO_PORT_P1, GPIO_PIN4);

// Enabling DMA interrupts
MAP_DMA_enableInterrupt(INT_DMA_INT0);
MAP_Interrupt_enableInterrupt(INT_DMA_INT0);

//enable DMA RX and TX channel

MAP_DMA_enableChannel(DMA_CHANNEL_1);
MAP_DMA_enableChannel(DMA_CHANNEL_0);

/*
* at this point DMA will take over and complete reception of rest of the data from the
* inertial sensor
*/
}

----------------------------------------------------------------------------------------------------------------------------------------------

void InertialSensor::DMA_INT0_IRQHandler(void)
{

uint32_t int0_srcflg_dma = DMA_Channel->INT0_SRCFLG;

if ( !(DMA_Channel->INT0_SRCFLG & (DMA_INT0_SRCFLG_CH0 | DMA_INT0_SRCFLG_CH1)) )
{
return;
}

// clear all the interrupt flag bits in the "DMA_INT0_SRCFLG" register
// that correspond to the DMA channels 0 and 1
MAP_DMA_clearInterruptFlag(DMA_CH0_EUSCIB0TX0);
MAP_DMA_clearInterruptFlag(DMA_CH1_EUSCIB0RX0);

// Disable the DMA interrupts
MAP_Interrupt_disableInterrupt(INT_DMA_INT0);
MAP_DMA_disableInterrupt(INT_DMA_INT0);

}

----------------------------------------------------------------------------------------------------------------------------------------------

Details of tool chain:

MSPWARE is version 3.50.0.2

Driverlib is version 3_21_00_05

Code Composer Studio  Version: 6.1.3.00033 

Compiler Version is V15.12.3 LTS

----------------------------------------------------------------------------------------------------------------------------------------------

Voltage applied to a pin on an unpowered device - MSP430FR2311

$
0
0

MSP430 Team,

I have an MSP40FR2311 application that is hot plugged.  There will be voltage on the (GPIO) pins before the device is properly powered.

QUESTION: What are the restrictions on applying voltage to a (GPIO) pin when the device is unpowered?

Are we safe if we current limit the connections so that we limit to +/-2 mA at each pin?   This is the absolute max diode current given in section 5.1 of the datasheet slase58b.  I worry though about repeated application of an absolute max stress however.  This could shorten the device lifespan.

Regards,

David

MSP430G2553 Training Videos - broken link?

$
0
0

Hi team,

I'm looking for MSP430G2553 training videos. The ones linked on the main 2553 page are pointing to the following link:

Which has a subsection with other video links. However, the video links do not work. Could you point me to the right video links for this workshop?

Best,

MSP430 FR5994 LaunchPad : Should the SD example work out of the box?

$
0
0

Hi,

I have a just got a FR5994 Launchpad, programmed with FW build on CCS on a mac. The out of the box demo is working for the temperature graph and the store/read from FRAM. 

However the SD example is not running. 

The issue first appears in storeTimeStampSDCard() at 

    //Read directory and file

    rc = SDCardLib_getDirectory(&sdCardLib, "data_log", dirs, &dirNum, files, &fileNum);

with FR_INVALID_OBJECT being returned

I have not populated R5 (CS) as I can see its set straight away in system_pre_init. Do I need to populate it to get the SD example to run?

int _system_pre_init(void)

{........

    GPIO_setOutputHighOnPin(GPIO_PORT_P4, GPIO_PIN0);

    GPIO_setAsOutputPin(GPIO_PORT_P4, GPIO_PIN0);

Noise signal from ADC input of MSP430i2041TPW during A/D conversion

$
0
0

Dear Sir,

We encounter problems at the conditioning circuit output and ADC input interface. The application circuit diagram is shown as Fig. 1. We use TI provided code examples from “Slac676d.zip” to perform single A/D conversionsimultaneously on a group of 3 channels. A pulse signal inverse injection from the ADC input to the conditioning circuit output is observed on each channel during conversion. This backward injected pulse seriously distorted the conditioning stage output signal. Fig. 2 shows the impact of the distorted signal at test point A. Fig. 3 shows the impact of the distorted signal at test point B. Fig. 4 shows the impact of the distorted signal at test point C. Fig. 5 shows the signal from A2.0+ at test point C with R5 removed.

We need solution from TI to eliminate this backward injected pulse signal.

Thanks

 

MSP432 UART receive multiple Byte

$
0
0

Hi Everyone.

I am currently trying to use the backdoor UART to receive multiple bytes from PC Host.

I used the example code "uart_pc_echo_12mhz_brclk" and tested the code with Coolterm.

My bytes("abcd") is sent from Coolterm. I was succssfully interruped.

When I check the value of "UCA0RXBUF".I saw the "a" there,

then i continue the excution and get interrupted again.However, instead of seeing "b". I am seeing "d" in UCA0RXBUF.

Somehow my middle bytes are missing. 

I appoligize if the this is very simple question.

Did i parse my bytes incorrectly? if so. How do i extract all of my bytes from UCA0RXBUF? 

Thank you,

Eddy

/*
 * -------------------------------------------
 *    MSP432 DriverLib - v3_21_00_05
 * -------------------------------------------
 *
 * --COPYRIGHT--,BSD,BSD
 * Copyright (c) 2016, Texas Instruments Incorporated
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * *  Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * *  Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * *  Neither the name of Texas Instruments Incorporated nor the names of
 *    its contributors may be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * --/COPYRIGHT--*/
/******************************************************************************
 * MSP432 UART - PC Echo with 12MHz BRCLK
 *
 * Description: This demo echoes back characters received via a PC serial port.
 * SMCLK/DCO is used as a clock source and the device is put in LPM0
 * The auto-clock enable feature is used by the eUSCI and SMCLK is turned off
 * when the UART is idle and turned on when a receive edge is detected.
 * Note that level shifter hardware is needed to shift between RS232 and MSP
 * voltage levels.
 *
 *               MSP432P401
 *             -----------------
 *            |                 |
 *            |                 |
 *            |                 |
 *       RST -|     P1.3/UCA0TXD|----> PC (echo)
 *            |                 |
 *            |                 |
 *            |     P1.2/UCA0RXD|<---- PC
 *            |                 |
 *
 * Author: Timothy Logan
*******************************************************************************/
/* DriverLib Includes */
#include "driverlib.h"

/* Standard Includes */
#include <stdint.h>
//#include "printf.h"
#include <stdbool.h>
#include "msp.h"
#include <driverlib.h>
#include <HAL_I2C.h>
#include <HAL_OPT3001.h>
#include <stdio.h>
#include <stdint.h>
#include <string.h>
//#include <uart_driver.h>

/* UART Configuration Parameter. These are the configuration parameters to
 * make the eUSCI A UART module to operate with a 9600 baud rate. These
 * values were calculated using the online calculator that TI provides
 * at:
 *software-dl.ti.com/.../index.html
 */


const eUSCI_UART_Config uartConfig =
{
        EUSCI_A_UART_CLOCKSOURCE_SMCLK,          // SMCLK Clock Source
        78,                                     // BRDIV = 78
        2,                                       // UCxBRF = 2
        0,                                       // UCxBRS = 0
        EUSCI_A_UART_NO_PARITY,                  // No Parity
        EUSCI_A_UART_LSB_FIRST,                  // LSB First
        EUSCI_A_UART_ONE_STOP_BIT,               // One stop bit
        EUSCI_A_UART_MODE,                       // UART mode
        EUSCI_A_UART_OVERSAMPLING_BAUDRATE_GENERATION  // Oversampling
};

/* Graphic library context */


//Receive UART Variables
#define NUM_RX_CHARS 64
char rxMsgData[NUM_RX_CHARS] = "";
int numMsgsRx = 0;
int tempIndex = 5;
int numChars = 0;
#define MAX_STR_LENGTH 271

#define FALSE 0
#define TRUE  1

typedef struct{
	unsigned char newStringReceived;
	char          txString[MAX_STR_LENGTH];
	char          rxString[MAX_STR_LENGTH];
}s_test;

extern s_test test;
s_test test = {
	FALSE,
	"",
	""
};
/* Variable for storing lux value returned from OPT3001 */
float lux;

/* Timer_A Up Configuration Parameter */
const Timer_A_UpModeConfig upConfig =
{
        TIMER_A_CLOCKSOURCE_ACLK,               // ACLK Clock SOurce
        TIMER_A_CLOCKSOURCE_DIVIDER_1,          // ACLK/1 = 3MHz
        200,                                    // 200 tick period
        TIMER_A_TAIE_INTERRUPT_DISABLE,         // Disable Timer interrupt
        TIMER_A_CCIE_CCR0_INTERRUPT_DISABLE,    // Disable CCR0 interrupt
        TIMER_A_DO_CLEAR                        // Clear value
};

/* Timer_A Compare Configuration Parameter  (PWM) */
Timer_A_CompareModeConfig compareConfig_PWM =
{
        TIMER_A_CAPTURECOMPARE_REGISTER_3,          // Use CCR3
        TIMER_A_CAPTURECOMPARE_INTERRUPT_DISABLE,   // Disable CCR interrupt
        TIMER_A_OUTPUTMODE_TOGGLE_SET,              // Toggle output but
        100                                         // 50% Duty Cycle
};




int main(void)
{
    /* Halting WDT  */
    MAP_WDT_A_holdTimer();
    /* Set the core voltage level to VCORE1 */
    MAP_PCM_setCoreVoltageLevel(PCM_VCORE1);

    /* Set 2 flash wait states for Flash bank 0 and 1*/
    MAP_FlashCtl_setWaitState(FLASH_BANK0, 2);
    MAP_FlashCtl_setWaitState(FLASH_BANK1, 2);

    // the UART DOES NOT WORK FOR more than 24Mhz
    MAP_CS_setDCOCenteredFrequency(CS_DCO_FREQUENCY_24);
    MAP_CS_initClockSignal(CS_MCLK, CS_DCOCLK_SELECT, CS_CLOCK_DIVIDER_2 );
    MAP_CS_initClockSignal(CS_HSMCLK, CS_DCOCLK_SELECT, CS_CLOCK_DIVIDER_2 );
    MAP_CS_initClockSignal(CS_SMCLK, CS_DCOCLK_SELECT, CS_CLOCK_DIVIDER_2 );
    MAP_CS_initClockSignal(CS_ACLK, CS_REFOCLK_SELECT, CS_CLOCK_DIVIDER_2);


    Init_I2C_GPIO();
    I2C_init();




    /* Selecting P1.2 and P1.3 in UART mode */
    MAP_GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P1,
            GPIO_PIN1 | GPIO_PIN2 | GPIO_PIN3, GPIO_PRIMARY_MODULE_FUNCTION);

    /* Setting DCO to 12MHz */

    /* Configuring UART Module */
    MAP_UART_initModule(EUSCI_A0_BASE, &uartConfig);

    /* Enable UART module */
    MAP_UART_enableModule(EUSCI_A0_BASE);

    /* Enabling UART interrupts */
    MAP_UART_enableInterrupt(EUSCI_A0_BASE, EUSCI_A_UART_RECEIVE_INTERRUPT);
    MAP_Interrupt_enableInterrupt(INT_EUSCIA0);
    MAP_Interrupt_enableSleepOnIsrExit();
    MAP_Interrupt_enableMaster();

    //sample test code for i2c, this code is not interrupt based.
    //I2C_write8(0x39,0x80, 0x03);
    //I2C_write8(0x39,0x81, 0x01);

    //int16_t raw;
    //int16_t raw_2;
    //raw = I2C_read8(0x39,0x60);
    //raw_2 = I2C_read16(0x80);
    //I2C_write8(0x39,0x80, 0x03);
    //I2C_write8(0x39,0x81, 0x01);
    //raw = I2C_read8(0x39,0x60);
    //raw_2 = I2C_read16(0x80);


    char *s = "printf test";
    char c = '!';
    int i = -12345;
    unsigned u = 4321;
    long int l = -123456780;
    long unsigned n = 1098765432;
    unsigned x = 0xABCD;
           %x\r\n", x);

    while(1)
    {
        MAP_PCM_gotoLPM0();
    }
}

/* EUSCI A0 UART ISR - Echoes data back to PC host */
/* This code works the following way
 * 1) Open a cool term serial port
 * 2) the board has backdoor uart and will shows up as comm port
 * 3)connect to that port in coolterm
 * 4)send some strings
 * 5)add a break point at below interrupt.
 * 6)the byte send should be stored in the "receiveByte" address
 * 7)Then the byte will be eched back to the cool term
 */

void EUSCIA0_IRQHandler(void)
{
    uint32_t status = MAP_UART_getEnabledInterruptStatus(EUSCI_A0_BASE);
    char receiveByte = UCA0RXBUF;  //This is the address where the received byte is stored

    MAP_UART_clearInterruptFlag(EUSCI_A0_BASE, status);


    if(status & EUSCI_A_UART_RECEIVE_INTERRUPT_FLAG)
    {

        MAP_UART_transmitData(EUSCI_A0_BASE, receiveByte);
    }

}

Code Composer studio flash problem

$
0
0

I flashed a code using RTSC configuration after that i couldnt flash  any program with any configuration.


visible Light communication

$
0
0

I am doing a project on Visible Light communication using Msp430g2553. I want to send the data from msp430g2253 to led via LED driver, then which LED driver is suitable for this project?

APA434R01 from RF430F5978EVM

Launch pad error

$
0
0

Using lauch pad i tried flashing the device but no use the below error gets popped up.

at MSP432_Factory_Reset()CS_DAP_0: Trouble Writing Register DP_RESET: (Error -615 @ 0x2) The target failed to see a correctly formatted SWD header. The connection to the target may be unreliable. Try lowering the TCLK setting before trying again. (Emulation package 6.0.407.3) 

MSP432_Factory_Reset() cannot be evaluated.
Target failed to write register DP_RESET
at DP_RESET=1 [msp432_factory_reset.gel:44]
at MSP432_Factory_Reset()

MSP430FR5989 / MSP430FR5986 current consumption issue over temperature

$
0
0

Current consumption ISSUE

 

We are working on MSP430FR598X based prototypes and we are having some issues related to current consumption over temperature change.

Up to now, we have already developed two different prototypes using both, MSP430FR5989 (Ver 1) and MSP430FR5986 (Ver 2).

 

Our application is using LC sensing hardware with two external resonant circuits following this AN:

Water Meter Reference Design for two LC Sensors, Using Extended Scan Interface (ESI): http://www.ti.com/tool/TIDM-LC-WATERMTR

 

Our FW is using this main routines (ESI_INV_CAL_V1_IIC):

-          void InitScanIF(void);

-          void ReCalScanIF(void);

-          __interrupt void ISR_ESCAN_IF(void)

 

The used resonant circuit is: 2x (1mH + 470pF)

 

When the FW is running in standby (no metal presence) we have a mean current consumption of about 3.8uA. Approaching metal to LC resonant circuit, excites a state change and MSP raises the current consumption up to about 10-20uA for short time going down again to 4uA.

 

The fact is that we have tested in climatic chamber over the temperature range (+70ºC to -20ºC) and we have detected that MSP current is not stable at 4uA. We have registered the current consumption of 2 boards over temperature (one with recalibration routine active and other without) and there are current peaks without having any kind of reason.

We also have tested in sleep mode (no LC sensing) and the current stays stable at 4uA.

Knowing that, we have we have recorded a video where we have heated coils, capacitors and MSP (around LC sensing HW pins) and we have noticed that heating coils or capacitors has no effect and heating MSP current consumption rises.

https://vimeo.com/190095447

 

Have TI noticed this effect?

We have repeated this test with several prototypes from both versions and we have no pattern about when and how it is generated this effect.

We have plenty of tests done with current consumption records if needed.

Many thanks for your help!

Ruben

Application code is not running after BSL update

$
0
0

Hi,

Here I am working on UART and I2C custom BSL. Both are working, but I am facing problem after SET_PC command.

 After SET_PC command the application code is not running continuously. It just entering into main() function and stopped there. When I restart the Hardware the new application code is running properly.
Is there any additional command required to run the application code after BSL(after SET_PC command)?
I haven't found any command in scripter guide for MSP430 controller. But there is a REBOOT command available for MSP432 devices. Please suggest if any solution available for this.
Here I am using MSP430F5255 controller. And SET_PC 0xa400. 
Please find the below my scripter code.

//
//Script example 5xx USB BSL
//Device tested: MSP430F5255
//Comm Bridge used: MSP-FET
//
//Download the blink application
//through UART BSL
//
LOG
MODE 5xx UART COM56
VERBOSE
CHANGE_BAUD_RATE 115200
MASS_ERASE
DELAY 20000
RX_PASSWORD pass30_default.txt
RX_DATA_BLOCK blinkLED_f5255.txt
SET_PC 0xa400

And find my application code .txt file below:

@a400
4F 14 92 53 02 24 B2 90 E9 03 02 24 06 28 82 43
02 24 8C 00 48 A4 B1 13 10 02 4B 16 00 13 81 00
00 A4 B1 13 94 02 0C 93 02 24 B1 13 00 00 0C 43
B1 13 60 01 B1 13 8E 02 D2 42 8C 06 00 24 00 13
32 D0 10 00 FD 3F 03 43 20 57 20 00 82 00 01 00
70 02 01 00 00 01 00 00 00 FF F0 00 54 A4 00 00
00 24 00 00
@ffc8
40 A4 40 A4 40 A4 40 A4 40 A4 40 A4 40 A4 40 A4
40 A4 40 A4 40 A4 38 A4 40 A4
@ffe4
40 A4 40 A4 40 A4 40 A4 40 A4 40 A4 40 A4 00 A4
40 A4 40 A4 40 A4 40 A4 40 A4 1E A4 2A 14 8F 00
00 00 9F 00 00 00 04 24 8C 00 00 00 B1 13 FA 00
40 18 1A 42 5C 01 40 18 B2 40 80 5A 5C 01 8F 00
4C A4 9F 00 54 A4 13 24 89 00 5C A4 88 00 64 A4
0C 3C 0C 09 7F 4C 5F 06 00 18 5F 4F 4C A4 A9 00
04 00 0D 09 4F 13 A9 00 04 00 D9 08 F2 23 7A C2
3A D0 08 5A 40 18 82 4A 5C 01 B1 13 98 02 8F 00
00 00 9F 00 00 00 09 24 8A 00 00 00 03 3C 6A 13
AA 00 04 00 9A 00 00 00 FA 23 28 16 10 01 2A 14
78 4C 09 43 26 3C AC 00 01 00 3E 90 12 00 0C 20
7F 4C 3F B0 80 00 07 24 7A 4C 3F F0 7F 00 4A 4A
46 18 0A 5A 0F DA 0E 5F 4B 0E 4B 0D CF 0D FF 0B
BF 00 01 00 AD 00 01 00 FD 4F FF FF 1E 83 FA 23
04 3C AD 00 01 00 FD 4C FF FF 58 03 19 53 39 92
D7 37 18 B3 F6 23 7B 4C 6E 4C 5B 0E 4F 4E 5F 0F
0B DF 4E 4E 3E F0 0F 00 3E 50 03 00 3B 90 FF 0F
CA 23 28 16 10 01 1A 14 C9 0C 1B 49 02 00 0A 43
29 3C CC 0A 3D 40 0C 00 B1 13 2E 02 2C 52 4C 0E
4C 0D EC 09 1E 4C 08 00 8C 93 0A 00 0D 0C 3F 0C
04 00 CC 0F 12 20 0E 93 10 20 8E 00 4C A4 9E 00
54 A4 0F 24 6E 4D 5E 06 00 18 5E 4E 4C A4 AD 00
01 00 CC 0D CD 0F 4E 13 02 3C B1 13 5C 02 1B 49
02 00 1A 53 0A 9B D5 2B 19 16 10 01 B2 40 80 5A
5C 01 B1 13 B0 01 B1 13 EC 01 0D 14 3D 40 02 0D
1D 83 FE 23 0D 16 D2 D3 05 02 D2 D3 03 02 B2 40
1C 5A 5C 01 92 D3 00 01 F2 90 52 00 00 24 09 20
7C 40 52 00 B1 13 82 02 32 C2 03 43 3F 40 00 10
4F 13 03 43 32 D2 03 43 EF 3F 03 43 B2 40 20 00
66 01 B2 D0 00 02 68 01 32 D0 40 00 82 43 60 01
B2 40 50 00 62 01 B2 40 F9 10 64 01 32 C0 40 00
1E 14 3D 40 80 8B 0E 43 1D 83 0E 73 FD 23 0D 93
FB 23 1D 16 03 43 10 01 F2 D0 C0 00 2B 02 D2 D3
80 06 F2 D0 80 00 80 06 F2 40 45 00 86 06 C2 43
87 06 D2 C3 80 06 D2 D3 9C 06 10 01 CF 0C 09 3C
6C 4F B1 13 82 02 AF 00 01 00 3C 40 05 00 B1 13
46 02 CF 93 00 00 F4 23 10 01 02 12 32 C2 03 43
82 4C C0 04 82 4D C8 04 1C 42 CA 04 32 41 03 43
10 01 0C 93 08 24 0D 14 3D 40 4A 01 1D 83 FE 23
0D 16 1C 83 F8 23 10 01 CF 0C 0E 93 06 24 AF 00
01 00 FF 4D FF FF 1E 83 FA 23 10 01 CF 0C CC 0D
CD 0F AD 00 05 00 1E 4F 01 00 80 01 5C 02 E2 B3
9D 06 FD 27 C2 4C 8E 06 10 01 03 43 FF 3F 03 43
1C 43 10 01 10 01
q

Thanks & Regards,
Vivek
Viewing all 22106 articles
Browse latest View live


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