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

MSP430F5310: Weird analog problem

$
0
0

Part Number:MSP430F5310

I'm not sure this is the right forum for this, but I'll start here and see where it goes.

I'm attempting to measure the current on a 48-VDC bus. I have a 50-mΩ high-side shunt resistor that is being monitored by an INA168 with a 100-kΩ output resistor. When the bus current is 14 mA, the output of the INA168 is 14 mV. So far, so good. I then buffer this through an LMV342 op-amp connected as a unity-gain buffer. The output of the op-amp is 14 mV. Still good. The output of the op-amp is connected to a series 470-Ω resistor (thick film, 0603) and a 1-µF capacitor to ground (X7R, 0603) – a passive low-pass filter. This is then connected to an analog input (P6.1, pin 2) of the MSP430F5310– and nothing else. The voltage here is 82 mV. Huh? Where did that come from? The ADC in the MSP430 dutifully reads the voltage as 82 mV, which corresponds to a current almost six times higher than the actual current!

I cannot figure out what is causing this. The only things between the output of the buffer amp (where the voltage is 14 mV) and the analog input of the MSP430 (where the voltage is 82 mV) is a resistor and capacitor.

In total, I am reading 4 analog channels (P6.0–P6.3) in repeated autoscan mode, and the other three channels are all fine. P6.2, which is scanned right before this one, has an identical op-amp buffer + RC low-pass filter input configuration. I've checked the GPIO configuration bits, and they all look fine.

Is current somehow being sourced from the MSP430's input pin? Is this bleed from the previously scanned channel? (But it seems like if this was bleed, only the conversion result would be affected. In this case, the voltage is actually physically there on the board.)


MSP430FR2111: MSP430FR2111 IO support Capacitive Touch ?

$
0
0

Part Number:MSP430FR2111

Hello TI employee,

In  FR2111 ‘s  datasheet , it seems FR2311 support Capacitive Touch, however, when I go throuht the PORT schematic for details ,I see no oscillation circuit like G2303.

so I need your confirm, Thanks a lot.

FR2111 functional Block.

FR2111  port:

G2303:

MSP432P401R: When opening Internal reference for ADC, the current will rise up to 500uA. Is it normal ?

$
0
0

Part Number:MSP432P401R

Hi team

 When opening Internal reference for ADC, the current will rise up to 500uA. Is it normal ? (MSP432P401R). where can I find the description about this power consumption? any idea to reduce this ?

 

MSP430FR5972: MSP430FR5972 ADC12 AND COMP Function Setting

$
0
0

Part Number:MSP430FR5972

Hi Team,

In the data sheet, page 9, we can see that, P9SEL1 and P9SEL0 is all set to 1, the port function is Axx or Cxx, but no information whether Axx or Cxx is used. 

There is also no much information in the user guide. Is it automatic choose by the MCU Core? Please help clarify. Thanks.

MSP430FR5849: MSP-FET430UIF Spy-Bi-Wire connection

$
0
0

Part Number:MSP430FR5849

Hello,

the ti wiki and the FR5849 datasheet both show the spy-bi-wire connection to be like this:

1: RST, 2: VCC, 7: TST, 9 GND

http://processors.wiki.ti.com/index.php/JTAG_(MSP430)

http://www.ti.com/product/MSP430FR5849/datasheet/applications-implementation-and-layout

Yet I get no device found.

If I use the following connection including R2:

http://processors.wiki.ti.com/index.php/JTAG_(MSP430)#Spy_Bi-Wire_.282_Wire_JTAG.29_for_MSP430F2xx.2C_MSP430G2xx.2C_and_MSP430F4xx

It works.

Can someone please explain why the pinout shown in the datasheet does not work?

I use a old, grey msp-fet430uif v1.4a, does that matter?

Best regards,

Lo2

CCS/MSP430F5529: Reading 6 bits string with the msp430

$
0
0

Part Number:MSP430F5529

Tool/software: Code Composer Studio

Hello !

Im doing a project for Uni. and I want the MSP430 to read from a 6-bits parallel data bus (the string is generated by a voice recognition circuit) and write a code over thos strings that I get.

Should I choose a port (for example P6) ? How can i read the data simultaneously and perform some operations on it (with respect to the specific string that i get)?

Voltage levels are matched.
Im using CC5.

Thanks in advanced,

Nir

CCS/MSP-EXP430G2: Facing problem Communication between two MSP430G2553 Launchpad using nRF24L01+

$
0
0

Part Number:MSP-EXP430G2

Tool/software: Code Composer Studio

I want to do wireless communication between two "MSP430G2553" launchpads using "nRF224L01+" . The program for Transmitter and Receiver  are listed below. I am using"GitHub - spirilis/msprf24: nRF24L01+ Library for MSP430 micro controller line" library. There are no error shown in both the program the problem is my program LED should be glow but nothing is happening. please provide me some guidance.

These transmitter and receiver code are from library in which given as the Test_Programs. I have also provide link at the title of the program

#include <msp430.h>
#include "msprf24.h"
#include "nrf_userconfig.h"
#include "stdint.h"
volatile unsigned int user;
int main()
{
uint8_t addr[5];
uint8_t buf[32];
WDTCTL = WDTHOLD | WDTPW;
DCOCTL = CALDCO_16MHZ;
BCSCTL1 = CALBC1_16MHZ;
BCSCTL2 = DIVS_1;  // SMCLK = DCOCLK/2
// SPI (USCI) uses SMCLK, prefer SMCLK < 10MHz (SPI speed limit for nRF24 = 10MHz)
// Red, Green LED used for status
P1DIR |= 0x41;
P1OUT &= ~0x41;
user = 0xFE;
/* Initial values for nRF24L01+ library config variables */
rf_crc = RF24_EN_CRC | RF24_CRCO; // CRC enabled, 16-bit
rf_addr_width      = 5;
rf_speed_power     = RF24_SPEED_1MBPS | RF24_POWER_0DBM;
rf_channel         = 120;
msprf24_init();  // All RX pipes closed by default
msprf24_set_pipe_packetsize(0, 32);
msprf24_open_pipe(0, 1);  // Open pipe#0 with Enhanced ShockBurst enabled for receiving Auto-ACKs
        // Note: Pipe#0 is hardcoded in the transceiver hardware as the designated "pipe" for a TX node to receive
        // auto-ACKs.  This does not have to match the pipe# used on the RX side.
// Transmit to 'rad01' (0x72 0x61 0x64 0x30 0x31)
msprf24_standby();
user = msprf24_current_state();
addr[0] = 0xDE; addr[1] = 0xAD; addr[2] = 0xBE; addr[3] = 0xEF; addr[4] = 0x00;
w_tx_addr(addr);
w_rx_addr(0, addr);  // Pipe 0 receives auto-ack's, autoacks are sent back to the TX addr so the PTX node
            // needs to listen to the TX addr on pipe#0 to receive them.
while(1){
__delay_cycles(800000);
if(buf[0]=='0'){buf[0] = '1';buf[1] = '0';}
else {buf[0] = '0';buf[1] = '1';}
w_tx_payload(32, buf);
msprf24_activate_tx();
LPM4;
if (rf_irq & RF24_IRQ_FLAGGED) {
rf_irq &= ~RF24_IRQ_FLAGGED;
msprf24_get_irq_reason();
if (rf_irq & RF24_IRQ_TX){
P1OUT &= ~BIT0; // Red LED off
P1OUT |= 0x40;  // Green LED on
}
if (rf_irq & RF24_IRQ_TXFAILED){
P1OUT &= ~BIT6; // Green LED off
P1OUT |= BIT0;  // Red LED on
}
msprf24_irq_clear(rf_irq);
user = msprf24_get_last_retransmits();
}
}
return 0;
}

Code For Receiver:- link--" https://github.com/spirilis/msprf24/blob/master/TESTPROGS/g2553/ike-uscia-rx.c "

#include <msp430.h>
#include "msprf24.h"
#include "nrf_userconfig.h"
#include "stdint.h"
volatile unsigned int user;
int main()
{
uint8_t addr[5];
uint8_t buf[32];
WDTCTL = WDTHOLD | WDTPW;
DCOCTL = CALDCO_16MHZ;
BCSCTL1 = CALBC1_16MHZ;
BCSCTL2 = DIVS_1;  // SMCLK = DCOCLK/2
// SPI (USCI) uses SMCLK, prefer SMCLK < 10MHz (SPI speed limit for nRF24 = 10MHz)
// Red LED will be our output
P1DIR |= BIT0+BIT6;
P1OUT &= ~(BIT0+BIT6);
user = 0xFE;
/* Initial values for nRF24L01+ library config variables */
rf_crc = RF24_EN_CRC | RF24_CRCO; // CRC enabled, 16-bit
rf_addr_width      = 5;
rf_speed_power     = RF24_SPEED_1MBPS | RF24_POWER_0DBM;
rf_channel         = 120;
msprf24_init();
msprf24_set_pipe_packetsize(0, 32);
msprf24_open_pipe(0, 1);  // Open pipe#0 with Enhanced ShockBurst
// Set our RX address
addr[0] = 0xDE; addr[1] = 0xAD; addr[2] = 0xBE; addr[3] = 0xEF; addr[4] = 0x00;
w_rx_addr(0, addr);
// Receive mode
if (!(RF24_QUEUE_RXEMPTY & msprf24_queue_state())) {
flush_rx();
}
msprf24_activate_rx();
LPM4;
while (1) {
if (rf_irq & RF24_IRQ_FLAGGED) {
rf_irq &= ~RF24_IRQ_FLAGGED;
msprf24_get_irq_reason();
}
if (rf_irq & RF24_IRQ_RX || msprf24_rx_pending()) {
r_rx_payload(32, buf);
msprf24_irq_clear(RF24_IRQ_RX);
user = buf[0];
if (buf[0] == '0')
P1OUT &= ~BIT0;
if (buf[0] == '1')
P1OUT |= BIT0;
if (buf[1] == '0')
P1OUT &= ~BIT6;
if (buf[1] == '1')
P1OUT |= BIT6;
} else {
user = 0xFF;
}
LPM4;
}
return 0;
}

 

MSP-GANG430: JTAG isolation to attach to GANG programmer?


RTOS/MSP432P401R: Multitasking won't work with ADCBuf continuos mode

$
0
0

Part Number:MSP432P401R

Tool/software:TI-RTOS

CCS version 7.1.0.00016

Simplink MSP432 SDK version 1.30.00.40

Hi every one,

I'm working on a simple audio project on the MSP-EXP432P401R launch pad with TI-RTOS and TI drivers.

I have 3 tasks:

The first one is ADC task. This task initializes the ADCBuf module in continous mode, the sampling frequency is 48kHz, and then this task will be terminated. Analog signal will be sampled in background, converted to microvolt and store it into a buffer, let me call it AudioBuffer_In[AUDIO_BUFFER_SIZE]. The ADC task has priority level of 3.

Source code of ADC task:

//============= ADCtask.h ======================

#ifndef SOURCEFILES_TASKS_ADCTASK_H_
#define SOURCEFILES_TASKS_ADCTASK_H_

/* ADC sampling frequency in Hz */
#define ADC_SAMPLING_FREQ   48000

#endif /* SOURCEFILES_TASKS_ADCTASK_H_ */



//============= ADCTask.c ======================

/* Standard header files */
#include <unistd.h>
#include <stdint.h>
#include <stddef.h>

/* XDC module Headers */
#include <xdc/std.h>
#include <xdc/runtime/System.h>
#include <xdc/runtime/Error.h>

/* TI-RTOS Headers */
#include <ti/sysbios/BIOS.h>
#include <ti/sysbios/knl/Task.h>
#include <ti/sysbios/knl/Semaphore.h>

/* TI driver Headers */
#include <ti/drivers/GPIO.h>
#include <ti/drivers/ADCBuf.h>

/* Board Header */
#include "Board.h"

#include <SourceFiles/Tasks/MainTask.h>
#include <SourceFiles/Tasks/ADCTask.h>

/*
 * Private variables
 */
ADCBuf_Handle        adcBuf;
ADCBuf_Params        adcBuf_Params;
ADCBuf_Conversion    adcBuf_ContinuousConversion[2];
uint16_t             sampleBufferOne[2][AUDIO_BUFFER_LENGTH];
uint16_t             sampleBufferTwo[2][AUDIO_BUFFER_LENGTH];

/*
 * Functions declaration
 */
void adcTask_Function(UArg arg0, UArg arg1);
void adcBuf_CallBack(ADCBuf_Handle handle, ADCBuf_Conversion *conversion, void *completedADCBuffer, uint32_t completedChannel);

/*
 * Initialize ADC thread.
 */
void ADCTask_Init(void) {

    Task_Handle         adcTask;
    Task_Params         adcTask_Params;
    Error_Block         errorBlock;

    /* Initialize drivers */
    ADCBuf_init();

    /* Initialize error block */
    Error_init(&errorBlock);

    /* Create main task */
    Task_Params_init(&adcTask_Params);
    adcTask_Params.stackSize = ADC_TASK_STACK_SIZE;
    adcTask_Params.priority = ADC_TASK_PRIORITY;
    adcTask = Task_create((Task_FuncPtr)adcTask_Function, &adcTask_Params, &errorBlock);
    if (adcTask == NULL) {
        /* Failed to create ADC task */
        while (1);
    }
}

/*
 * ADC task function.
 */
void adcTask_Function(UArg arg0, UArg arg1) {

    /* Initialize the ADCBuf parameters */
    ADCBuf_Params_init(&adcBuf_Params);
    adcBuf_Params.samplingFrequency = ADC_SAMPLING_FREQ;
    adcBuf_Params.recurrenceMode = ADCBuf_RECURRENCE_MODE_CONTINUOUS;
    adcBuf_Params.returnMode = ADCBuf_RETURN_MODE_CALLBACK;
    adcBuf_Params.callbackFxn = adcBuf_CallBack;

    /* Open the ADCBuf0 */
    adcBuf = ADCBuf_open(Board_ADCBUF0, &adcBuf_Params);
    if (!adcBuf){
        /* AdcBuf did not open correctly. */
        while(1);
    }

    /* Configure the conversion structure */
    adcBuf_ContinuousConversion[0].arg = NULL;
    adcBuf_ContinuousConversion[0].adcChannel = Board_ADCBUF0CHANNEL0;
    adcBuf_ContinuousConversion[0].sampleBuffer = sampleBufferOne[0];
    adcBuf_ContinuousConversion[0].sampleBufferTwo = sampleBufferTwo[0];
    adcBuf_ContinuousConversion[0].samplesRequestedCount = AUDIO_BUFFER_LENGTH;
    adcBuf_ContinuousConversion[1].arg = NULL;
    adcBuf_ContinuousConversion[1].adcChannel = Board_ADCBUF0CHANNEL1;
    adcBuf_ContinuousConversion[1].sampleBuffer = sampleBufferOne[1];
    adcBuf_ContinuousConversion[1].sampleBufferTwo = sampleBufferTwo[1];
    adcBuf_ContinuousConversion[1].samplesRequestedCount = AUDIO_BUFFER_LENGTH;

    /* Start converting */
    if (ADCBuf_convert(adcBuf, adcBuf_ContinuousConversion, 2) != ADCBuf_STATUS_SUCCESS) {
        /* Did not start conversion process correctly. */
        while(1);
    }
}

/*
 * ADCBuf call back function.
 */
void adcBuf_CallBack (ADCBuf_Handle handle, ADCBuf_Conversion *conversion, void *completedADCBuffer, uint32_t completedChannel) {
    /* Adjust raw adc values */
    ADCBuf_adjustRawValues(handle, completedADCBuffer, AUDIO_BUFFER_LENGTH, completedChannel);

    /* Convert ADC values to microvolts and save them into the input audio buffer */
    ADCBuf_convertAdjustedToMicroVolts(handle, completedChannel, completedADCBuffer, AudioBuffer_In[completedChannel], AUDIO_BUFFER_LENGTH);
}

The second one is Main task. This task initialize the 2 other tasks first and then go to a infinite while loop. In the while loop, it take the data in AudioBuffer_In, process the data and store processed data in to another buffer, the AudioBuffer_Out[AUDIO_BUFFER_SIZE]. After that, it will send a semaphore post signal to tell the third task, which is PWM task, to do thier job. The Main task has priority level of 1.

Main task source code:

//================ MainTask.h ====================


#ifndef SOURCEFILES_TASKS_MAINTASK_H_
#define SOURCEFILES_TASKS_MAINTASK_H_

#include <ti/sysbios/knl/Semaphore.h>

/* Main task priority and stack size in bytes */
#define MAIN_TASK_PRIORITY      1
#define MAIN_TASK_STACK_SIZE    1024

/* PWM task priority and stack size in bytes */
#define PWM_TASK_PRIORITY       2
#define PWM_TASK_STACK_SIZE     1024

/* ADC task priority and stack size in bytes */
#define ADC_TASK_PRIORITY       3
#define ADC_TASK_STACK_SIZE     1024

/* Audio buffers length */
#define AUDIO_BUFFER_LENGTH     1024

/* Global variables */
extern Semaphore_Handle         Semaphore;
extern uint32_t                 AudioBuffer_In[2][AUDIO_BUFFER_LENGTH];
extern uint32_t                 AudioBuffer_Out[2][AUDIO_BUFFER_LENGTH];

/* Initialize main task */
extern void                     MainTask_Init(void);

#endif /* SOURCEFILES_TASKS_MAINTASK_H_ */


//================ MainTask.c ====================


/* Standard header files */
#include <unistd.h>
#include <stdint.h>
#include <stddef.h>

/* XDC module Headers */
#include <xdc/std.h>
#include <xdc/runtime/System.h>
#include <xdc/runtime/Error.h>

/* TI-RTOS Headers */
#include <ti/sysbios/BIOS.h>
#include <ti/sysbios/knl/Task.h>
#include <ti/sysbios/knl/Semaphore.h>

/* TI driver Headers */
#include <ti/drivers/GPIO.h>

/* Board Header */
#include "Board.h"

#include <SourceFiles/Tasks/MainTask.h>
#include <SourceFiles/Tasks/PWMTask.h>
#include <SourceFiles/Tasks/ADCTask.h>
#include <SourceFiles/AudioEffects/EchoEffect.h>

/*
 * Global variables
 */
Semaphore_Handle    Semaphore;
uint32_t            AudioBuffer_In[2][AUDIO_BUFFER_LENGTH];
uint32_t            AudioBuffer_Out[2][AUDIO_BUFFER_LENGTH];

/*
 * Private variables.
 */
/* Echo effect variables */
EchoEffect_Params   echoEffect_Params = { 5, 200, 2 };

/*
 * Functions declaration.
 */
void mainTask_Function(UArg arg0, UArg arg1);

/*
 * Initialize main thread.
 */
void MainTask_Init(void) {

    Task_Handle         mainTask;
    Task_Params         mainTask_Params;
    Error_Block         errorBlock;
    Semaphore_Params    semaphore_Params;

    /* Initialize drivers */
    GPIO_init();

    /* Initialize error block */
    Error_init(&errorBlock);

    /* Create main task */
    Task_Params_init(&mainTask_Params);
    mainTask_Params.stackSize = MAIN_TASK_STACK_SIZE;
    mainTask_Params.priority = MAIN_TASK_PRIORITY;
    mainTask = Task_create((Task_FuncPtr)mainTask_Function, &mainTask_Params, &errorBlock);
    if (mainTask == NULL) {
        /* Failed to create main task */
        while (1);
    }

    /* Create a semaphore handle */
    Semaphore_Params_init(&semaphore_Params);
    Semaphore = Semaphore_create(1, &semaphore_Params, &errorBlock);
    if (Semaphore == NULL) {
        /* Failed to create semaphore object */
        while (1);
    }
}

/*
 *  Main task function.
 */
void mainTask_Function(UArg arg0, UArg arg1) {

    /* Initialize ADC task */
    //ADCTask_Init();

    /* Initialize PWM task */
    PWMTask_Init();

    /* Loop forever */
    while(1) {

        GPIO_toggle(Board_GPIO_LED0);

        /* Apply audio effects */
        EchoEffect_ApplyEffect(AudioBuffer_In[0], AudioBuffer_Out[0], AUDIO_BUFFER_LENGTH, &echoEffect_Params);
        EchoEffect_ApplyEffect(AudioBuffer_In[1], AudioBuffer_Out[1], AUDIO_BUFFER_LENGTH, &echoEffect_Params);

        /* Post semaphore */
        Semaphore_post(Semaphore);

        sleep(1);
    }
}

The third task as I mentioned above is PWM task. This task initialize the PWM module first, and in its while loop, it wait for a semaphore signal from the Main task while get blocked by calling a semaphore pend. When the signal comes in, it take the data in AudioBuffer_Out, calculate required duty cycle for each value in that buffer and then change the duty cycle of PWM signal. The PWM has frequency of 250kHz. This task has priority level of 2.

Source code for the PWM task:

//===================== PWMTask.h ===========================


#ifndef SOURCEFILES_TASKS_PWMTASK_H_
#define SOURCEFILES_TASKS_PWMTASK_H_

/* PWM frequency in Hz */
#define PWM_FREQ            250000

/* Initialize the PWM task. */
extern void PWMTask_Init(void);

#endif /* SOURCEFILES_TASKS_PWMTASK_H_ */


//===================== PWMTask.c ===========================


/* Standard header files */
#include <unistd.h>
#include <stdint.h>
#include <stddef.h>

/* XDC module Headers */
#include <xdc/std.h>
#include <xdc/runtime/System.h>
#include <xdc/runtime/Error.h>

/* TI-RTOS Headers */
#include <ti/sysbios/BIOS.h>
#include <ti/sysbios/knl/Task.h>
#include <ti/sysbios/knl/Semaphore.h>

/* TI driver Headers */
#include <ti/drivers/GPIO.h>
#include <ti/drivers/PWM.h>

/* Board Header */
#include "Board.h"

#include <SourceFiles/Tasks/MainTask.h>
#include <SourceFiles/Tasks/PWMTask.h>

/*
 * Functions declaration
 */
void pwmTask_Function(UArg arg0, UArg arg1);

/*
 * Initialize PWM thread.
 */
void PWMTask_Init(void) {

    Task_Handle         pwmTask;
    Task_Params         pwmTask_Params;
    Error_Block         errorBlock;

    /* Initialize drivers */
    PWM_init();

    /* Initialize error block */
    Error_init(&errorBlock);

    /* Create main task */
    Task_Params_init(&pwmTask_Params);
    pwmTask_Params.stackSize = PWM_TASK_STACK_SIZE;
    pwmTask_Params.priority = PWM_TASK_PRIORITY;
    pwmTask = Task_create((Task_FuncPtr)pwmTask_Function, &pwmTask_Params, &errorBlock);
    if (pwmTask == NULL) {
        /* Failed to create PWM task */
        while (1);
    }
}

/*
 * PWM task function.
 */
void pwmTask_Function(UArg arg0, UArg arg1) {

    /* PWM handle and parameters */
    PWM_Handle pwm[2];
    PWM_Params pwmParams;

    /* Initialize the PWM parameters */
    PWM_Params_init(&pwmParams);
    pwmParams.idleLevel = PWM_IDLE_LOW;
    pwmParams.dutyUnits = PWM_DUTY_FRACTION;
    pwmParams.dutyValue = PWM_DUTY_FRACTION_MAX / 2;
    pwmParams.periodUnits = PWM_PERIOD_HZ;
    pwmParams.periodValue = PWM_FREQ;

    /* Open and start the pwm[0] */
    pwm[0] = PWM_open(Board_PWM0, &pwmParams);
    if (pwm[0] == NULL) {
        /* Failed to open PWM0 */
        while (1);
    }
    PWM_start(pwm[0]);

    /* Open and start the pwm[1] */
    pwm[1] = PWM_open(Board_PWM1, &pwmParams);
    if (pwm[1] == NULL) {
        /* Failed to open PWM1 */
        while (1);
    }
    PWM_start(pwm[1]);

    /* Loop forever */
    while (1) {

        /* Wait for semaphore to be posted by main task */
        Semaphore_pend(Semaphore, BIOS_WAIT_FOREVER);

        uint16_t i;

        for (i = 0; i < AUDIO_BUFFER_LENGTH; i++) {
            PWM_setDuty(pwm[0], (uint32_t)((((float)AudioBuffer_Out[0][i]) / 2500000) * PWM_DUTY_FRACTION_MAX));
            PWM_setDuty(pwm[1], (uint32_t)((((float)AudioBuffer_Out[1][i]) / 2500000) * PWM_DUTY_FRACTION_MAX));
        }

        GPIO_toggle(Board_GPIO_LED1);
    }
}

The Main task will be initialized right before the BIOS_start() calling. The 2 others will be initialized in main task function.

The problem is the Main task and the PWM task won't work well if I initialize the ADC task. If I don't, the Main task and the PWM task just work well, the Main task take data in AudioBuffer_In (in this case, all values are equal to 0), process the data and send a semaphore post signal. The PWM take the signal immediately because it has higher priority. PWM task do its job and got blocked by calling a semaphore pend, and the Main task run again, and so on. Let look at the line ADCTask_Init(); in the main task function. If I comment this out, that mean there is no ADC task, so the others task just work fine.

Any one help me, please.

CCS/MSP432P401R: Disabling JTAG/SWD access repeatability

$
0
0

Part Number:MSP432P401R

Tool/software: Code Composer Studio

Hi,

I have a basic question about the JTAG/SWD behavior after it has been disabled once.

Using the sample code provided here  "www.ti.com/.../slaa659" , I was able to successfully lock access to the MSP432401R dev board (Rev 2.1) using the "disable_jtag_swd" sample project. I performed a factory reset to regain access to the device and successfully loaded another simple blink led program to corroborate accessibility to the device.

I then attempted to disable  JTAG/SWD by using the "disable_jtag_swd" sample project once more, but it seems that I have debug access to the device no matter what now. I do not need to do a factory reset anymore. As far as I understand ,the JTAG/SWD disable/enable functionality can be done/undone repeatedly as I described using a factory reset.

Am i missing something basic on the expected JTAG/SWD disable/enable functionality? 

Any help is greatly appreciated.

Thanks,

-Edgar

MSP430F5529: The need of interrupts when reading a very-low-fruquency string

$
0
0

Part Number:MSP430F5529

Hello,

I am very new to the MSP430 world, doing my first project using it.

Q1 : I get a 4-bit input string that changes very slowly (~ 0.5Hz ) and I want to read it and perform an operation (lets call it "routine A" ) with respect to its specific value.
As I understood so far, I should configure P1 pins as input and interrupt pins, then to call my routine of operation every time I get an interrupt from those pins.

Is there more simple way to implement it without using interrupts? 
I dont care what happened when there is no input string, if that matter.

Q2: Is the voltage level of the msp430F5229 is 3.3V? I found a mess in the datasheet about it.

Thanks in advanced.

MSP430FR5994: MSP430FR5994

MSP430G2553: Problems using I2C in energia with 2 launchpads msp430g2553 after having tested in Code Composer studio successfully

$
0
0

Part Number:MSP430G2553

Hello everyone.

I used to program the msp430g2553 launchpad in Code Composer studio but this time I need to use energia to connect 2 msp430 to each other with i2c, I programmed both msps with Code Composer studio (disconnecting the jumper between the green LED and pin p1.6 on both launchpads and connecting the p1.6 and p1.7 pins of the launchpads with 10k pull-up resistors) and everything works correctly. But when I program the launchpads with energia with the example programs master_reader and slave_sender, the sda and scl signals are held high and nothing more. I tried to connect the slave first and then the master and I also tried to connect the master first and the slave after, and I tried to use the p2.1 and p2.2 pins as the picture shows.launchpads msp430g2 pins mapsNothing works.

Please, I need help and thanks beforehand for all

MSP430F5419A: LPM4.5 Mode of MSP430F5419A

$
0
0

Part Number:MSP430F5419A

Hi,

I am using MSP430F5419A for the MCU of the development. Now I need the MSP430F5419A to enter the LPM4.5 and exit from a GPIO  interruption.

I have three questions

(1) Assume that the MCU is already been in the mode of LPM4.5 and the corresponding GPIO bit is assigned for the interruption (P1.0), when the trigger of P1.0 comes to generate the interruption, the MCU will directly reboot from the beginning of the main() function, OR, the MCU will enter the interruption handler  PORT1_Isr() ?

(2) I use the following to make MCU enter the LPM4.5, is that correct? (I use the watchdog, and  timer B0 for the tick of the system)

UCS_turnOffXT1();
WDT_A_hold(WDT_A_BASE);
Timer_B_stop(TIMER_B0_BASE);
PMMCTL0_H = PMMPW_H; // open PMM
PMMCTL0_L |= PMMREGOFF; // set Flag to enter LPM4.5 with LPM4 request

__bis_SR_register(LPM4_bits|GIE);
__no_operation();

(3)Is there any approach to check if the MCU is actually in LPM4.5 but not anything else like LPM4 ?

Thanks a lot!

CCS/MSP430F5500: LIS3DH always returns 0xFF on SPI I/F to MSP430F5500

$
0
0

Part Number:MSP430F5500

Tool/software: Code Composer Studio

I am trying to configure LIS3DH chip via SPI İnterface. Here is my code :

#include <msp430.h>
#include <stdint.h>
#include <string.h>
#include <stdio.h>
#include <stdbool.h>


#define CS BIT3 // PORT4, bit3
#define SELECT() do { P4OUT &= ~CS; unsigned int a; for(a=50;a>0;a--); } while ( 0 )
#define DESELECT() do { P4OUT |= CS; } while ( 0 )
#define LIS3DH_REG_WHOAMI 0x0F
#define I_AM_LIS3DH ((uint8_t)0x33)
#define LIS3DH_REG_CTRL1 0x20
#define LIS3DH_REG_CTRL2 0x21
#define LIS3DH_REG_CTRL3 0x22
#define LIS3DH_REG_CTRL4 0x23
#define LIS3DH_REG_CTRL5 0x24
#define LIS3DH_REG_CTRL6 0x25
#define LIS3DH_REG_OUT_X_L 0x28
#define LIS3DH_REG_OUT_Y_L 0x2A
#define LIS3DH_REG_OUT_Z_L 0x2C


typedef struct{
float accel_x;
float accel_y;
float accel_z;
}accel_str;

void InitSPI(void);
int8_t InitMEMS(void);
void setWriteMode(uint8_t addr);
void writeByte(uint8_t data);
void setReadMode(uint8_t addr);
uint8_t readByte();
void read(uint8_t* readData, uint8_t addr, uint8_t numBytes);
void writeRegister(uint8_t addr, uint8_t data);
void accelLoad(accel_str* x_accel);

accel_str x_accel; // main accel struct that contains all sensor outputs

int main(void)
{

WDTCTL = WDTPW + WDTHOLD; // Stop WDT
InitSPI();
InitMEMS();
accelLoad(&x_accel); // get accelerometer results

}

/* P4.5 – UCA1SOMI
P4.4 – UCA1SIMO
P4.0 – UCA1CLK
P4.3 - ChipSelect */

void InitSPI(void){
P4SEL |= BIT0 + BIT4 + BIT5;
P4OUT |= BIT3;
P4DIR |= BIT3;
UCA1CTL1 |= UCSWRST;
UCA1CTL0 = UCCKPL | UCMSB | UCMST | UCMODE_0 | UCSYNC;
UCA1CTL1 = UCSSEL_2;
UCA1BR0 = 32;
UCA1BR1 = 0; //
UCA1MCTL = 0; // No modulation
UCA1CTL1 &= ~UCSWRST;
}

int8_t InitMEMS(void){

uint8_t deviceId;

read(&deviceId, LIS3DH_REG_WHOAMI , 1); // First detect if module is attached

if(deviceId != I_AM_LIS3DH)
return -1; //error

writeRegister(LIS3DH_REG_CTRL1, 0x57); //All axes, normal, 100Hz
writeRegister(LIS3DH_REG_CTRL2, 0x00); // No HighPass filter
writeRegister(LIS3DH_REG_CTRL3, 0x00); // No interrupts
writeRegister(LIS3DH_REG_CTRL4, 0x00); // all defaults
writeRegister(LIS3DH_REG_CTRL5, 0x00); // all defaults
writeRegister(LIS3DH_REG_CTRL6, 0x00); // all defaults

return 1; // success
}

/**
* Write an initial byte
*/
void setWriteMode(uint8_t addr){

while (!(UCA1IFG & UCTXIFG)); // TX buffer ready?
UCA1TXBUF = (addr | 0x00); // 1 = read / 0 = write
while (!(UCA1IFG & UCTXIFG)); // TX buffer ready?

}

/**
* Write a single byte
*/
void writeByte(uint8_t data){

while (!(UCA1IFG & UCTXIFG)); // TX buffer ready?
UCA1TXBUF = data; // send data
while (!(UCA1IFG & UCTXIFG)); // TX buffer ready?

}
/**
* Read a single byte
*/
void setReadMode(uint8_t addr){

while (!(UCA1IFG & UCTXIFG)); // TX buffer ready?
UCA1TXBUF = (addr | 0x80); // 1 = read / 0 = write
while (!(UCA1IFG & UCTXIFG)); // TX buffer ready?

}
uint8_t readByte(){

while (!(UCA1IFG & UCTXIFG)); // TX buffer ready?
UCA1TXBUF = 0xAA; // send garbage
while (!(UCA1IFG & UCTXIFG)); // TX buffer ready?
while (!(UCA1IFG & UCRXIFG)); // RX Received?


return UCA1RXBUF; // Store received data
}

/**
* Reads any number of bytes from a specific address. Make sure that
* the sensor will self-increment its register pointer after subsequent reads
*/
void read(uint8_t* readData, uint8_t addr, uint8_t numBytes){
uint8_t i;
SELECT();

setReadMode(addr);
for(i = 0; i != numBytes; i++){
*readData = readByte();
readData++; // increase to next address
}

DESELECT();
}
/**
* Writes a single byte to a single register
*/
void writeRegister(uint8_t addr, uint8_t data){
SELECT();

setWriteMode(addr);
writeByte(data);

DESELECT();
}

/**
* Get all 3-axis accelerometer readings. Convert from mg to g.
*/
void accelLoad(accel_str* x_accel){
int16_t tmp;
read((uint8_t*)&tmp,LIS3DH_REG_OUT_X_L, 2);
x_accel->accel_x = (tmp * 0.061) / 1000.0;
read((uint8_t*)&tmp,LIS3DH_REG_OUT_Y_L, 2);
x_accel->accel_y = (tmp * 0.061) / 1000.0;
read((uint8_t*)&tmp,LIS3DH_REG_OUT_Z_L , 2);
x_accel->accel_z = (tmp * 0.061) / 1000.0;
}

Problem: the lis3dh register with address 0x0F keeps constant 51 (type of device of something). when I send request to read this register (Reg address plus set MSB bit) via SPI interface Msp430f5500 SPI RX Register gives me 0xFF at first. Is it normal or have I missed something?

 


CCS/MSP430FR5739: Connecting with MPU9250 (accelerometer&gyro) through I2c

$
0
0

Part Number:MSP430FR5739

Tool/software: Code Composer Studio

Has anyone successfully used these two together? If so, is there any sample code? We are trying to read from the MPU9250 and print it on CCS console

MSP430FR2311: The power distribution of MSP430FR2311

$
0
0

Part Number:MSP430FR2311

Dear Experts

Do we have any document for the MSP430FR serial chip power distribution?

For example, customers want toknow the power consumption of each internal module or state definition or others.

Thank you.

MSP430L092: TEMPERATURE SENSOR DELAYING PROBLEM

$
0
0

Part Number:MSP430L092

I used MSP430L092 example code for measuring temperature sensor value but It seems that there is a delay for operation. For example; I set a condition that if DegC is greater than 30, P1.4 port that is tied LED is high. After 42 seconds, my LEDis high. I don't understand this delay. Respectively, If I set greater than 20 this sensor result, it is high later 30 seconds. I put below example code that I rearranged.

/* --COPYRIGHT--,BSD_EX
* Copyright (c) 2012, 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.
*
*******************************************************************************
*
* MSP430 CODE EXAMPLE DISCLAIMER
*
* MSP430 code examples are self-contained low-level programs that typically
* demonstrate a single peripheral function or device feature in a highly
* concise manner. For this the code may rely on the device's power-on default
* register values and settings such as the clock configuration and care must
* be taken when combining code from several examples to avoid potential side
* effects. Also see www.ti.com/grace for a GUI- and www.ti.com/msp430ware
* for an API functional library-approach to peripheral configuration.
*
* --/COPYRIGHT--*/
/* Description: ADC Temperature Sample */
/****************************A_POOL ADC Conversion *******************************/
/* */
/* */
/* +----L092---+ */
/* |*1 14 | */
/* | 2 13 | */
/* | 3 12 | */
/* | 4 11 | */
/* | 5 10 | */
/* | 6 9 | */
/* | 7 8 | */
/* +-----------+ */
/* */
/* D.Dang/ D.Archbold/ D.Szmulewicz /F. Chen */
/* Texas Instruments Inc. */
/* Built with IAR Version 5.51.1 and CCS Verison 5.3.00090 */
/*********************************************************************************/

#include <msp430.h>

int Result;
volatile short int DegC;


int main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop WDT

// Begin Configuration of the A-POOL registers

APCTL = 0; // Clear APCTL register
APIE |= EOCIE; // Enable Interrupt for End of Conversion
APTRIM = REFTSEL;
APVDIV = TMPSEN; // Enable Temperature Sensor
APCNF = CMPON+DBON+CONVON+APREFON+CLKSEL_MCLK; // Configure A-POOL elements, Select MCLK as A-POOL Clock Source
P1DIR |= (BIT4+BIT5+BIT6);

while(1)
{

APCTL = OSEL+ODEN+OSWP+APPSEL_4+APNSEL_5; // Set Channels and Start Conversion--+ODEN+
APINT = 0x00; // Clear ADC-DAC-REG
APIFG = 0;
APCTL |= CBSTP+SBSTP+RUNSTOP;
__bis_SR_register(LPM0_bits + GIE); // Enter LPM0 w/ interrupts enabled

Result = APINT;
DegC =(((Result-179)*125)/58) + 30; // Refer to datasheet for accuracy and offset specs

if(DegC>20){
P1OUT|=BIT4;
}

else{
P1OUT&=~BIT4;

}

__no_operation(); // SET BREAKPOINT HERE

}

}


//A_POOL Interrupt Service Routine
#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
#pragma vector=APOOL_VECTOR
__interrupt void A_POOL(void)
#elif defined(__GNUC__)
void __attribute__ ((interrupt(APOOL_VECTOR))) A_POOL (void)
#else
#error Compiler not supported!
#endif
{
APIFG = 0; // Clear Interrupt Flag
__bic_SR_register_on_exit(LPM0_bits); // Exit Active to calculate Temperature


}

Please, Can someone give me an advice prevent this delay?

Thanks in advance

EVM430-F6779: EVM430-F6779

$
0
0

Part Number:EVM430-F6779

Hi. I'm Korean, not good at english..

This question uses a Google Translator.

Please understand if it is strange.

I purchased the EVM430-F6779. Power is not supplied. 

I connected to VA, VB, and VN using a three-stranded AC cord, and the contents were initially displayed on the LCD, but suddenly the breaker went down and nothing was displayed on the LCD.

The breaker keeps going down when power is supplied after raising the breaker. 

What should I do?

MSP430FR6972: Power consumption difference of Rev A&Rev B

$
0
0

Part Number:MSP430FR6972

Hi Dears,

My customers use minimum system test power consumption,use empty loop code,3.3V,power series 10 ohm resistance measurement voltage indicate power consumption。

As below Pic of voltage we found the frequency of A is two times of B,but the peak value of A is 1/2 B,as result we test REV B power consumption is greater than REV A

Do you have the same result? Can we solve it? Thanks~

Rev B:Yellow

Rev A:Green

Viewing all 22233 articles
Browse latest View live


Latest Images

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