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

CHARGER

$
0
0

interested in having a MCU based, Li-ion switching charger.

 The requirement for switching is coming from efficiency.

The requirement for MCU is coming from the need to report on the process using our proprietary protocol.

Below is an old solution from TI.

Is there something mor up to date.

 

http://www.ti.com/lit/an/slaa287/slaa287.pdf


MSP430F5438A: Low Power: Unused I/Os to pull-down vs output=0

$
0
0

Part Number:MSP430F5438A

As we know, it is recommended to pull unused I/Os to GND to avoid floating and causing unnecessary current consumption due to that flipping (and flopping ;)

Especially during development I would like to pull unused I/Os to GND via the MCU's internal pull-downs instead of pulling them active low (to avoid shortcuts, when working around with probes etc).

Is this idea feasible or not? I do also think about using that configuration in the field.

MSP430FR2311: How to use DCO Calibration Value

$
0
0

Part Number:MSP430FR2311

I see the datasheet for the MSP430FR2311 has calibrated DCO tap settings for 16Mhz (at 30C). The note in the datasheet says "This value can be directly loaded into the DCO bits in the CSCTL0 register to get an accurate 16-MHz frequency...". 

Is there any example code from TI that uses this calibration value? Specifically, what are the recommended values for the other registers - CSCTL1, CSCTL2, and CSCTL3?

Thank you,
Chad C.

MSP430F6779A: Rogowski softdidt

$
0
0

Part Number:MSP430F6779A

I’m developing an application similar to a 3 phase e-meter application using Rogowski coils.

I’m using TI provided library softdidt for IAR and MSP430F6779A.

I have a custom pcb based on TI designs.

In the attached file you can see some samples I stored and the graphs generated.

I saved the didt, the vt, ifiltered and vfiltered for a 230V, 6A, 0º load.

The Rogowski output lags 90º from the system current and after integration lags another 90º, making the ifiltered 180º from system current. This is the Rogowski working principle as my understanding.

My understanding is that my system should compensate for all this 180º delay, right? So my ifiltered should be in phase with vfiltered and not 180º apart. Is my assumption correct?

Regards,

Jorge Cunha(Please visit the site to view this file)

Compiler/MSP430G2553: 1934-D concatenation with ";" , "("

$
0
0

Part Number:MSP430G2553

Tool/software: TI C/C++ Compiler

Hello I am using downloaded SPI code to read and write data in SPI bus. While compiling code I am getting following warnings.

Appreciated any help on this:

Warning:

Description Resource Path Location Type
#1934-D concatenation with ";" in macro "MCU_IO_CLR_PREP" does not create a valid token CC110x.c /

Area in Code:

#define st(x)      do { x } while (__LINE__ == -1)

#define HAL_SPI_BEGIN       st( HAL_SPI_CS_ASSERT; while(HAL_SPI_SOMI_VAL); )

static uint8_t halSpiStrobe(uint8_t cmd)
{
    uint8_t rc;

    HAL_SPI_BEGIN;
    HAL_SPI_TXBUF_SET(cmd);
    HAL_SPI_WAIT_RXFIN;      //wait for completion of TX (which is also an RX)
   	rc = HAL_SPI_RXBUF;
    HAL_SPI_END;
    return(rc);
}

Similarly another warning:

#1934-D concatenation with ")" in macro "MCU_IO_GET_PREP" does not create a valid token CC110x.c

#define MCU_IO_GET_PREP(port, pin)         (P##port##IN & BIT##pin##)

#define MCU_IO_GET(port, pin)          MCU_IO_GET_PREP(port, pin)

#define HAL_SPI_SOMI_VAL    MCU_IO_GET(HAL_SPI_SOMI_PORT, HAL_SPI_SOMI_PIN)

void CC110xResetChip(void)
{

	 // Toggle chip select signal
	 HAL_SPI_CS_DEASSERT;
	 DelayForUS(20);
	 HAL_SPI_CS_ASSERT;
	 DelayForUS(20);
	 HAL_SPI_CS_DEASSERT;
	 DelayForUS(60);

   // Send SRES command
	HAL_SPI_CS_ASSERT;

	while(HAL_SPI_SOMI_VAL);
	HAL_SPI_TXBUF_SET(CC1100_CMD_SRES);
	HAL_SPI_WAIT_RXFIN;
//	while(UCB0STAT&UCBUSY);
	DelayForUS(5);
	// Wait for chip to finish internal reset
	while (HAL_SPI_SOMI_VAL);
	HAL_SPI_CS_DEASSERT;
}

Starterware/MSP432P401R: MSP432,uart

$
0
0

Part Number:MSP432P401R

Tool/software: Starterware

thanks for reading,

       I met with a problem.When I want to test the UART on launchpad of MSP432 (V1.0),I cannot receive the correct frame.Imported The  "MSP432P401 Demo - eUSCI_A0 UART echo at 9600 baud using BRCLK = 12MHz" Demo.My UART via onboard-debuger cannot work from the beginning.So I directly connected PC serial to RXD & TXD on board (P1.2&P1.3).No matter how I programmed,The board returned the same thing that I sended to the board.I don't think it is what the chip sended,because when I deleted sending code,the board still send the same thing as I sended from PC.What's wrong with it?

                                                                                                                                                                                                                                                                                                                   thanks again.

CCS/MSP432P401R: Outputting Multiple PWM signals

$
0
0

Part Number:MSP432P401R

Tool/software: Code Composer Studio

Hi all,

So after tinkering for a while with the timer_a_pwm_mode project, I was successfully able to drive a brushless motor at varying speeds.

However, when I attempt to do the same for 4 different pins, only the first pin set as a peripheral output actually generates a PWM signal.

As shown in the code below (highlighted yellow), I have attempted to use a different base for timer A configuration as well as the seconday module, but that yielded no changes.

// DriverLib Includes
#include <ti/devices/msp432p4xx/driverlib/driverlib.h>

// Standard Includes
#include <stdint.h>

#include <stdbool.h>

// Timer_A PWM Configuration Parameter
Timer_A_PWMConfig pwmConfig0 =
{
        TIMER_A_CLOCKSOURCE_SMCLK,
        TIMER_A_CLOCKSOURCE_DIVIDER_1,
        1280, // this num/ 64k = period       OG 32000
        TIMER_A_CAPTURECOMPARE_REGISTER_1,
        TIMER_A_OUTPUTMODE_RESET_SET,
        64 // 5% or 1ms duty cycle             OG 3200
};
// Timer_A1 PWM Configuration Parameter
Timer_A_PWMConfig pwmConfig1 =
{
        TIMER_A_CLOCKSOURCE_SMCLK,
        TIMER_A_CLOCKSOURCE_DIVIDER_1,
        1280, // this num/ 64k = period       OG 32000
        TIMER_A_CAPTURECOMPARE_REGISTER_1,
        TIMER_A_OUTPUTMODE_RESET_SET,
        96 // 7.5% or 1.5ms duty cycle             OG 3200
};

int main(void)
{

    // Halting the watchdog
    MAP_WDT_A_holdTimer();

    // Setting MCLK to REFO at 128Khz for LF mode
    // Setting SMCLK to 64Khz
    MAP_CS_setReferenceOscillatorFrequency(CS_REFO_128KHZ);
    MAP_CS_initClockSignal(CS_MCLK, CS_REFOCLK_SELECT, CS_CLOCK_DIVIDER_1);
    MAP_CS_initClockSignal(CS_SMCLK, CS_REFOCLK_SELECT, CS_CLOCK_DIVIDER_2);
    MAP_PCM_setPowerState(PCM_AM_LF_VCORE0);

    // Configuring GPIO 2.4 as peripheral output for PWM  and P1.1 for button interrupt
    MAP_GPIO_setAsPeripheralModuleFunctionOutputPin(GPIO_PORT_P2, GPIO_PIN4,GPIO_PRIMARY_MODULE_FUNCTION);
    MAP_GPIO_setAsInputPinWithPullUpResistor(GPIO_PORT_P1, GPIO_PIN1);
    MAP_GPIO_clearInterruptFlag(GPIO_PORT_P1, GPIO_PIN1);
    MAP_GPIO_enableInterrupt(GPIO_PORT_P1, GPIO_PIN1);

    // Configuring GPIO 2.7, 2.6, 5.6 as peripheral outputs for PWM
    MAP_GPIO_setAsPeripheralModuleFunctionOutputPin(GPIO_PORT_P2, GPIO_PIN7,GPIO_SECONDARY_MODULE_FUNCTION);
 //   MAP_GPIO_setAsPeripheralModuleFunctionOutputPin(GPIO_PORT_P2, GPIO_PIN6,GPIO_PRIMARY_MODULE_FUNCTION);
 //   MAP_GPIO_setAsPeripheralModuleFunctionOutputPin(GPIO_PORT_P5, GPIO_PIN6,GPIO_PRIMARY_MODULE_FUNCTION);


    // Set P1.0 to output direction (LED)
    MAP_GPIO_setAsOutputPin(GPIO_PORT_P1,GPIO_PIN0);

    // OG Configuring Timer_A to have a period of approximately 500ms and an initial duty cycle of 10% of that (3200 ticks)
    // Configuring Timer_A to have a period of approximately 20ms and an initial duty cycle of 5% of that (64 ticks)
    MAP_Timer_A_generatePWM(TIMER_A0_BASE, &pwmConfig0);


    //
    MAP_Timer_A_generatePWM(TIMER_A1_BASE, &pwmConfig1);

    // Enabling interrupts and starting the watchdog timer
    MAP_Interrupt_enableInterrupt(INT_PORT1);
    MAP_Interrupt_enableSleepOnIsrExit();
    MAP_Interrupt_enableMaster();

    // Sleeping when not in use
    while (1)
    {
        MAP_PCM_gotoLPM0();
    }
}

// Port1 ISR - This ISR will progressively step up the duty cycle of the PWM  on a button press
void PORT1_IRQHandler(void)
{
    uint32_t status = MAP_GPIO_getEnabledInterruptStatus(GPIO_PORT_P1);
    MAP_GPIO_clearInterruptFlag(GPIO_PORT_P1, status);
    int32_t speedChange;           // %percent change on button press 16 for 1.25% increase or 0.25ms 32 for 2.5% or .5ms
    if (status & GPIO_PIN1)
    {
        if(pwmConfig0.dutyCycle == 128) //   10% cycle at 128,           OG 28800 90%
        {
            speedChange = -16;
//            pwmConfig.dutyCycle += speedChange;
        }
        if(pwmConfig0.dutyCycle == 64) //   5% cycle, 1ms          OG 28800 90%
        {
            speedChange = 16;
//            pwmConfig.dutyCycle += speedChange; //  1.25% increase or 0.25ms 32 for 2.5% or .5ms     OG 3200 10%
        }
//            pwmConfig.dutyCycle = 64;  //  reset to 5% or 1ms         3200 10%
//        else
            pwmConfig0.dutyCycle += speedChange; //  1.25% increase or 0.25ms 32 for 2.5% or .5ms     OG 3200 10%

        MAP_Timer_A_generatePWM(TIMER_A0_BASE, &pwmConfig0);
        volatile uint32_t i;

        // Button Press debug
        // Toggle P1.0 output debug button press
        MAP_GPIO_toggleOutputOnPin(GPIO_PORT_P1,GPIO_PIN0);
        // Delay
        for(i=1000; i>0; i--);
    }
}

What is required to get the other 3 pins (highlighted in blue) to output their own separate PWM signals?

Thanks, 

Robert Pulatie

MSP430I2040: DIFFERENCE BETWEEN MSP430I2040 & OTHER MSP430FR SERIES CONTROLLER

$
0
0

Part Number:MSP430I2040

HELLO

CAN ANYONE TELL ME THE DIFFERENCE BETWEEN MSP430I2040 AND OTHER MSP430FR SERIES CONTROLLER. WHAT ARE SPECIALITY OF I SERIES CONTROLLER COMPARE TO OTHER     MSP430FR

SERIES CONTROLLER LIKE MSP430FR5739/29. CAN I USE MSP430FR5739 IN PLACE OF MSP430I2040 IN METERING APPLICATION? THANKS IN ADVANCE.


REGARDS,
DIPESH KARLI


RTOS: MSP432 RTC Drift too much

$
0
0

Tool/software:TI-RTOS

Hi,

I've setted up RTC time:

RTC_C_initCalendar(&myTime, RTC_C_FORMAT_BINARY);


And for test I read it and print it on console every second.
After one hour I've noticed that the time drifted like 6-10s.
I suppose this behaviour on MSP432 is not normal.
 
Do I need to calibrate something? If yes how?

Time is really critical for my project.

Thank you for the help

MSP430F6746: Questions about Flash of MSP430F6xx

CCS/MSP432P401R: Cannot Import Example TI-RTOS Based Project from MSP432 SDK on CCS 6.2

$
0
0

Part Number:MSP432P401R

Tool/software: Code Composer Studio

Hello,

I just started using MSP432 Launchpad to develop BLE application for my project.
My getting started reference is from here:
software-dl.ti.com/.../ble_snp_sap_intro.html

But it seems the development environment have been changed such as I cannot find MSP Connectivity Library 1.10.03.01 and it is replaced by TI Simplelink MSP432 SDK Bluetooth Plugin.
So after reading the description I have installed 2 packages:

  • Simplelink MSP432 SDK 1.30..00.40
  • Simplelink MSP432 SDK Bluetooth Plugin 1.10.00.42

My installation path for all of TI Products are into:
C:\Applications\ti\simplelink_msp432_sdk_1_30_00_40
C:\Applications\ti\simplelink_msp432_sdk_bluetooth_plugin_1_10_00_42

While I can import CCS example project from MSP432 SDK which uses non-rtos, however I cannot import CCS example project which uses ti-rtos.
For example is this project:
C:\Applications\ti\simplelink_msp432_sdk_1_30_00_40\examples\rtos\MSP_EXP432P401R\drivers\gpiointerrupt

The problem seem related due to CCS cannot find project-spec file, here is the message:
Error: Imported project-spec file not found: C:\Applications\ti\simplelink_msp432_sdk_1_30_00_40\examples\rtos\MSP_EXP432P401R\drivers\gpiointerrupt\tirtos\ccs\${COM_TI_SIMPLELINK_MSP432_SDK_INSTALL_DIR}\kernel\tirtos\builds\MSP_EXP432P401R\release\ccs\tirtos_builds_MSP_EXP432P401R_release_ccs.projectspec!

I have looked inside the file C:\Applications\ti\simplelink_msp432_sdk_1_30_00_40\examples\rtos\MSP_EXP432P401R\drivers\gpiointerrupt\tirtos\ccs\gpiointerrupt_MSP_EXP432P401R_tirtos_ccs.projectspec and found this xml tag:
${COM_TI_SIMPLELINK_MSP432_SDK_INSTALL_DIR}/kernel/tirtos/builds/MSP_EXP432P401R/release/ccs/tirtos_builds_MSP_EXP432P401R_release_ccs.projectspec

I have checked the path and the tirtos_builds_MSP_EXP432P401R_release_ccs.projectspec is inside my simplelink MSP432 sdk installation directory.

Since I cannot import it successfully I am wondering how do I set the path value for ${COM_TI_SIMPLELINK_MSP432_SDK_INSTALL_DIR}.
Is this a bug on CCS 6.2? Or do I have missing something here related to path configuration?

Please advise and kind regards,
Pranata

MSP430F2617: ADC12 over voltage conversion result is not saturated

$
0
0

Part Number:MSP430F2617

I have the following setup:

ADC12 is used with internal 2.5V reference. The input is channel 0 connected to an external pin that can go as high as 5V.

Given that the voltage limit on the external pin as AVCC + 0.3V, this is certainly a problem. However, I would expect that the ADC returns 0xFFF (full scale).

Instead, I read back a low value such as 130, for example.

Is this a known artifact? I could not find it in the errata. I would just like to know if it is possible that the ADC not return fulls scale when the specified range is violated as described.

Thanks!

CCS/MSP430FR6989: How to forecast/estimate battery charge lifetime without using Energy Trace++?

$
0
0

Part Number:MSP430FR6989

Tool/software: Code Composer Studio

Hi, I have a MSP43X board connected to a battery, and I need to forecast the battery charge lifetime, therefore, I think I'd need the following:
-Measure the current battery charge;
-Measure the instantaneous power consumption in order to forecast the discharging time;
Maybe using PMM or SVS register's contents... 
Any hints, thoughts?

MSP432WARE: UART Rx interrupt is not generating

$
0
0

Part Number:MSP432WARE

Hello Everyone,

I am working on MSP432P401R EVM board.

Q)UART  Rx interrupt is not generating..

Code Tasted on 12 MHZ, 24 MHZ with possible boud rates.

Before going to my application UART, I tested driver library loop back UART code...But in this example also rx interrupt is generating.

I selected port 3.2 amd 3.3 for uart.

/* DriverLib Includes */
#include "driverlib.h"

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

#include <stdbool.h>

volatile uint8_t TXData = 1;
volatile uint8_t RXData = 0;

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_MSB_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
};


int main(void)
{
/* Halting WDT */
MAP_WDT_A_holdTimer();

/* Selecting P1.2 and P1.3 in UART mode and P1.0 as output (LED) */
MAP_GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P3,
GPIO_PIN2 | GPIO_PIN3, GPIO_PRIMARY_MODULE_FUNCTION);
MAP_GPIO_setAsOutputPin(GPIO_PORT_P1, GPIO_PIN0);
MAP_GPIO_setOutputLowOnPin(GPIO_PORT_P1, GPIO_PIN0);


MAP_PCM_setCoreVoltageLevel(PCM_VCORE1);
CS_setDCOCenteredFrequency(CS_DCO_FREQUENCY_12);   //CS_setDCOCenteredFrequency(CS_DCO_FREQUENCY_24);

 //UCA2STATW=0X0080;


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

/* Enable UART module */
MAP_UART_enableModule(EUSCI_A2_BASE);/* Enabling interrupts */

MAP_UART_enableInterrupt(EUSCI_A2_BASE, EUSCI_A_UART_RECEIVE_INTERRUPT);
MAP_Interrupt_enableInterrupt(INT_EUSCIA2);
MAP_Interrupt_enableSleepOnIsrExit();

while(1)
{
UART_transmitData(EUSCI_A2_BASE, TXData);


MAP_Interrupt_enableSleepOnIsrExit();
MAP_PCM_gotoLPM0InterruptSafe();
}
}

/* EUSCI A2 UART ISR - Echos data back to PC host */
void EUSCIA2_IRQHandler(void)
{

uint32_t status = MAP_UART_getEnabledInterruptStatus(EUSCI_A2_BASE);

MAP_UART_clearInterruptFlag(EUSCI_A2_BASE, status);

if(status & EUSCI_A_UART_RECEIVE_INTERRUPT_FLAG)
{
      RXData = MAP_UART_receiveData(EUSCI_A2_BASE);

    if(RXData != TXData) // Check value
{
     MAP_GPIO_setOutputHighOnPin(GPIO_PORT_P1, GPIO_PIN0);
      while(1); // Trap CPU
}
   TXData++;
    MAP_Interrupt_disableSleepOnIsrExit();
}


}

Where i am doing wrong please tell me.

Is that any configuration is required

CCS/MSP-EXP432P401R: Power Measurements via Energy Trace during extensive use of FPU

$
0
0

Part Number:MSP-EXP432P401R

Tool/software: Code Composer Studio

Hi,

I am currently working on a project with the MSP432P401R LaunchPad. In this project I evaluate a classification algorithm, which involves extensive use of the FPU due to filtering and feature extraction (fft analysis).
I configured the MSP432 as follows:

  • Active Mode, DCDC and VCORE0
  • MCLK is set at around 16MHz using DCO
  • unused Ports are initialized

The implementation of this algorithm is divided into different processing stages:

  • Signal acquisition: Read in 5 sec. of data via DMA (in my case the raw data is stored on the Flash and for each window I read in 5 sec. of data)
  • Preprocessing: Window containing 5sec. of data gets filtered using an IIR filter
  • Feature Extraction: Apply FFT to filtered data and from this compute various features
  • Classification: Use features as input to classification algorithm
Since this algorithm uses a lot of Floating Point operations I made sure that the FPU is actually being used. I checked this by looking at the generated assembly code (see attached files/images):

I did the same verification for the FFT, which mostly exists of complex computations, esp. multiplication (see attached files/images).



Besides that I am not using the DSPlib, because I would like to evaluate this algorithm on other platforms as well and therefore I need a common base for comparison.

Once I implemented all the different processing stages I started analyzing the algorithm using the Energy Trace plug-in of CCS (Ver: 7.1.0.00016) and using the onboard Debugger (XDS-110ET emulator).
These are the results I got for processing one window of data:

Power:

Energy:

There's one thing that surprises me about these plots namely the increase of power during the fft analysis.
By looking at the energy plot, I would assume the power to be pretty much constantly around 6.14mW and 6.29mW, as it is for the signal acquisition, filtering and classification stages.

As far as I know the debugger measures energy and derives the power from these measurements, therefore I would expect a somewhat constant line for the power.
Also the power state of the MSP432 is always set to the initial setting (Active Mode, DCDC, VCORE0). Is it possible that these settings get changed during the FFT analysis?
However, I didn't  see any state changes when looking at the states via Energy Trace++.

So basically I am trying to find an explanation for the increase of power during FFT. Is there anything I am missing?

Best regards and thanks in advance for your support,

Sebastian


MSP430FR5972: Error during debug mode

$
0
0

Part Number:MSP430FR5972

Hi all,

When I run my project it was stuck and a message comes i.e.No source available for "0x605de" 

No source available for "0x605de" 

suggest me how I solve this issue.. 

MSP430G2432: RESET pin drop issue on MSP430G2432

$
0
0

Part Number:MSP430G2432

Dear Experts

My customer followed our EVM for the DVCC and RESET circuit design as follows:

They found RESET drop to below 2V which makes MSP430 hangs up when battery drop to 9V but DVCC still keep 3.3V.

5 pcs shows this situation over totally 2000pcs products.

And this issue happens sometimes (not always) in those 5pcs failed products.

Do  you have any comment about this issue?

Should I do any further test or just send those failed for FA analysis?

Thanks for your comment.

MSP430F5342: Cannot bet BSL working again after erasing and re-programming BSL

$
0
0

Part Number:MSP430F5342

I'm trying to unprotect some previously protected MSP430's and I've run into something strange.

I erased the BSL segments (A,B,C,D at 0x1000 to 0x17ff) and re-programmed. I've used three separate images and none work. Those images are:

BSL.00.06.04.04 From the custom BSL package version 1.00.12.00

BSL.00.07.05.04 From the custom BSL package version 1.00.12.00

Additionally, I've read out the BSL from another (working) board and it is identical byte for byte with 6.04.04. I have verified that the signatures (primary and secondary) are correct, and that the BSL is actually programmed into the device. Just to re-iterate, the "bad" board worked fine until I nuked the BSL and re-programmed it.

When I look at the reset, TCK, RX and TX lines I see correct behavior (Reference SLAU319, section 1.3.2) Comparing a working device vs the non-working device I see everything the same, except that the non-working device never sends anything from it's Tx line.

Trying to debug the boot rom and the BSL is very challenging. The code protection features and some IDE/debugger features seem designed to thwart this at every turn.

I have observed that the boot rom must be calling the BSL_Protect function of the BSL because the SYSBSLPE bit of the SYSBSLC register is set, as are both size bits, which is what the BSL that's loaded into the part is supposed to do.

Is there some configuration item that could have gotten erased when the BSL was nuked that affects BSL operation? I've read everything I can find on the boot, BSL, BSL-Scripter, etc and cannot find anything that's wrong.

CCS/MSP430FR2633: Calibration Routine Infinite Loop

$
0
0

Part Number:MSP430FR2633

Tool/software: Code Composer Studio

I'm debugging an application that uses the Captivate Demo board (the 'phone' keypad) and is meant to talk to the design centre via UART. 

I've made some good progress with the code, and for the last month have had no problem with the capacitive touch. However, a couple of days ago during degbugging, suddenly the design centre is not getting messages. I tracked down the error and it seems the program is stuck in the command: 

CAPT_MANAGER_CALIBRATE_SENSOR(pApp->pSensorList[ui8SensorID]); 

There is a for loop in CAPT_Manager.c (in the sample code) that contains only this single line, but the program never progresses past it. This is a ROM command, so I can only see what it is doing if I step through the assembly code (and it's long). So, I'm wondering if anyone else has had issues with this? The issue came up as I was doing some coding on the UART to change how custom received messages are handled, so I'm not sure how I interfered with this function. Any insight would be greatly appreciated!

MSP430G2313: MSP430 USCI SPI slave recv seems to be off by one bit.

$
0
0

Part Number:MSP430G2313

Greetings

I am configuring my MSP430G2313 USCI as an SPI slave (POL=0, PH=0, 3-Wire, RX interrupt enabled) that is connected to an SPI master via a detachable connector.  When I attach the connector, there is the possibility of random noise hitting the SCK pin which can put the SPI shift register into a partially shifted state.

I get around this by monitoring the SPI busy state (UCB0STAT & UCBUSY).  If I see a busy state for > ~50ms, I’ll assume that there is partially shifted data in the shift register and I’ll reset the SPI channel via the UCSWRST bit in UCB0CTL1 to clear that condition.

My problem is that after the SPI reset, the received SPI data seems to be shifted right by one bit (i.e. My logic analyzer shows that the master sending an 0xa5, but when I get into the RX ISR, UCB0RXBUF gives me an 0x52).  Once I get into this state, (UCB0STAT & UCBUSY) says that I’m not busy, so the SPI hardware doesn’t seem to think anything is wrong.

There is an errata entry USCI40 that describes an off-by-one-bit problem, but it only shows up when PH=1 and on Xmit instead of Recv.  Perhaps it is related? 

Any ideas on what I might be doing wrong?

Thank you

Scott

Here is my init code:

// SPI setup
UCB0CTL0 = 0b00100001;	// ph=0, pol=0, MSB 1st, 8-bit, slave, 3 pin spi, sync/spi mode
UCB0CTL1 = 0b00000000;	// No reset SPI
UCB0STAT = 0b00000000;	// Clear any errors
IE2 |= UCB0RXIE;	// Enable Rx interrupt

This is called every ~8ms to check for partially shifted data:

// If SPI is stuck at a partial xfer for ~50ms, assume that
// some noise on the SCK line snuck in and reset the transfer
bool spiBusy = (UCB0STAT & UCBUSY) != 0;
if( spiBusy )
{
	if( prevSpiBusy == spiBusy )
		spiFailCount++;
	if( spiFailCount >= 6 )
	{
		spiFailCount = 0;
		UCB0CTL1 = 0x01; // Reset the SPI
		UCB0CTL1 = 0x00;
		IE2 |= UCB0RXIE; // Re-enable Rx interrupt
	}
}
else
	spiFailCount = 0;
prevSpiBusy = spiBusy;

Viewing all 22164 articles
Browse latest View live


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