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

MSP432P401R: Sampling Audio and Storing with DMA

$
0
0

Part Number:MSP432P401R

My end goal for this project is to sample audio from an amplified electret microphone, and store it in SRAM (short sample, I know) using DMA. 

Currently, the output of my microphone circuit looks perfect through an oscilloscope. I'm running my MSP432 at 48 MHz; so I should be able to sample at 44.1 kHz without a problem, though I will probably sample slower just to save RAM. 

My ideal scenario is as follows: 

  1. Automatically trigger ADC conversions at a rate of 44.1 kHz using Timer_A0. 
  2. When each conversion is completed, automatically transfer sample to memory.

The problem I am running into is that I can't get the ADC to trigger automatically using a timer. I can't find any example code that doesn't use the DriverLib API. 

So FOR NOW, I am trying to manually trigger a conversion at 44.1 kHz using a timer interrupt. I configured Timer_A0 in UP mode, with a CCR0 value that triggers a timer overflow interrupt at a rate of 44.1 kHz. So my timer is working perfectly, but when I start a conversion inside my timer interrupt function (and manually store the data inside a conversion complete interrupt), I get wonky ADC results when I look at the data after pausing the program. 

Here is my code as of now: 

#include "msp.h"

#define A0 BIT5

#define num_samples 100

#define startConversion() ADC14->CTL0 |= ADC14_CTL0_ENC | ADC14_CTL0_SC

#define startSampling() TIMER_A0->CCR[0] =	271 // Corresponds to 44.1 kHz sampling rate
#define stopSampling() TIMER_A0->CCR[0] = 0;

void VCORE1();
void FLASH_init();
void CLK_init();
void ADC_init();
void TIMER_init();

volatile uint16_t audio[num_samples];
volatile uint16_t i = 0;

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

	//P2->DIR |= BIT7;

	//Enable MCLK clock output on P4.3
	//P4->DIR |= BIT3;
	//P4->SEL0 |= BIT3;

	VCORE1();				//Go to VCORE1 mode before setting clock to 48 MHz
	FLASH_init();
	CLK_init();				//Set clock to 48 MHz
	ADC_init();				//Initializes ADC, waiting for Timer to start conversions
	TIMER_init();

	NVIC_EnableIRQ(ADC14_IRQn);
	NVIC_EnableIRQ(TA0_0_IRQn);

	__enable_irq();

	startSampling();

	while(1);
}

void ADC14_IRQHandler(void)
{
	audio[i] = ADC14->MEM[0];	//Save sample, clears flag
}

void TA0_0_IRQHandler(void)
{
	TIMER_A0->CCTL[0] &= ~TIMER_A_CCTLN_CCIFG;	//Clear timer flag
	//P2->OUT |= BIT7; //For testing timer
	startConversion();
}

void VCORE1()
{
	while(PCM->CTL1 & PCM_CTL1_PMR_BUSY);
	PCM->CTL0 = PCM_CTL0_KEY_VAL | PCM_CTL0_AMR__AM_LDO_VCORE1;
	while(PCM->CTL1 & PCM_CTL1_PMR_BUSY);
}

void FLASH_init()
{
	//Configure Flash wait-state to 1 for both banks 0 & 1
	FLCTL->BANK0_RDCTL = (FLCTL->BANK0_RDCTL & ~(FLCTL_BANK0_RDCTL_WAIT_MASK)) |
			FLCTL_BANK0_RDCTL_WAIT_1;
	FLCTL->BANK1_RDCTL  = (FLCTL->BANK0_RDCTL & ~(FLCTL_BANK1_RDCTL_WAIT_MASK)) |
			FLCTL_BANK1_RDCTL_WAIT_1;
}

void CLK_init()
{
	//Set clock to 48 MHz
	CS->KEY 	= 	CS_KEY_VAL;				//Unlock CS registers
	CS->CTL0 	= 	CS_CTL0_DCOEN 	|
					CS_CTL0_DCORSEL_5;		//Choose 24MHz MHz clock speed
	CS->CTL1 	= 	CS_CTL1_SELS_3 	|
					CS_CTL1_SELM_3;			//Use DCOCLK as source for MCLK, SMCLK + HSMCLK
	CS->KEY		=	0;						//Re-lock CS registers
}

void ADC_init()
{
	P5->DIR &= ~(A0);	//Set ADC pin as input

	P5->SEL0 |= A0;		//Choose ADC as port function
	P5->SEL1 |= A0;

	ADC14->CTL0	=	//ADC14_CTL0_SHS_1	|	//Use TA0 to start conversion
					ADC14_CTL0_SHP	 	|	//??
					ADC14_CTL0_ON;		 	//Turn ADC module on
	ADC14->CTL1	=	ADC14_CTL1_RES__14BIT;	//Set 14-bit resolution
	ADC14->IER0 = 	ADC14_IER0_IE0;			//Enable interrupt when conversion on A0 is complete
}

void TIMER_init()
{
	TIMER_A0->CCTL[0] 	=	TIMER_A_CCTLN_CCIE;			//Enable CC interrupt

	TIMER_A0->CTL 		=	TIMER_A_CTL_TASSEL_2 	|	//Select SMCLK as source for timer
							TIMER_A_CTL_ID_2		|	//Divide clock by 4 (this yields 6 MHz for the timer clock)
							TIMER_A_CTL_MC_1		|	//Up mode
							TIMER_A_CTL_CLR			;	//Clear timer count

}


MSP430F427A: Waht is maximum Saple Rate (SPS) for ADC port?

CCS/MSP430F2122: CCS6 Load program Error

$
0
0

Part Number:MSP430F2122

Tool/software: Code Composer Studio

Hello Everyone,

I use CCS6 to edit my old projects which was created by CCS4 late in the days.

But I have some troubles while I doing "Debug".

I press DEBUG, and there is a message box appear and tell to me:

Load program Error

File:

C:\User...<my path>...\01_Project.out:Load failed.

I tried to create a new project use CCS6. The trouble is still exist.

The same chip, same JTAG, same coding environment can debug before the error first time appear.

How can I solve it?

Thanks to all of you.

Sincerely,

Norton

MSP430FR5738: Reset of Entry Address through MSPFLASHER Read

$
0
0

Part Number:MSP430FR5738

Hi,

It happens from time to time that when I create a complete Firmware Image by using the -r command of the MSP430Flasher.exe the Code Entry Address is reset to 0xFFFF.

command:

C:\ti\MSPFlasher_1.3.11\MSP430Flasher.exe -r [example_readout.hex , MAIN] -j "slow" -z [RESET,VCC=3000]

example of corrupted entry address in hex file

...

:20FFE00004FD04FD04FDFFFF04FDC2FB04FD12D004FD04FD04FDC0FC04FD04FD04FDFFFF9F

...

example of correct entry address in hex file

:20FFE00004FD04FD04FDFFFF04FDC2FB04FD12D004FD04FD04FDC0FC04FD04FD04FD24FC7D
:00000001FF

I would be happy If someone could give me any Ideas of how this might happen and how to prevent. 

b.r.

David

MSP430I2040: MSP430i2040 EVM, Sub metering module

$
0
0

Part Number:MSP430I2040

Deal all,

The MSP430I2040 EVM Sub metering module comes with its example code, which has the "emters" IAR workspace. When i try to build it, I get errors; 

1> [Og007]: Assembler list file generation not allowed in this version of the compiler

2> Fatal Error[Pe1696]: cannot open source file "...........metrology-foreground.c "

3> Error while running C/C++ Compiler 

        metrology-flash.c

These errors keep repeating over and over again for different .c files. 

As stated in the Readme.1st, the source file is not provided, but rather its compiled version is given, "emeter-metrology-i2041.r43".

Now my question is, how do I flash this example code on to my MSP430I2040 EVM, and could I get the source code?  I would really appreciate the dumbed down version.

Thanks in advance

P.S; I am using the latest IAR version; IAR 7.10

With Warm Regards

Subhronil

MSP432P401R: XMS432P401R becomes hot

$
0
0

Part Number:MSP432P401R

xms432p401r becomes hot when connected to usb port and when connected to different usb port in just a second.

Please help me out,thanks.

MSP432P401R: MinHMM Example Code: Touch LCD interrupt issue.

$
0
0

Part Number:MSP432P401R

Hi,

I recently configured touch LCD to work with MinHMM exmaple code. I am facing issues with respect to touch detection.

1. Touch detects for first few times and then later there's no response to touch- meaning there's no interrupt being generated i guess.

2. After [1] happens if I press any of the switches, and then try touch response it works. Again after few touch inputs. It goes back to state [1]. 

Would do you think could be the issue?

PS: I am using both AUDIO and Kentec Touch LCD booster packs.

RTOS/MSP432P401R: SPI not working using ti rtos example

$
0
0

Part Number:MSP432P401R

Tool/software:TI-RTOS

Hi,

I used the TI RTOS SPI example for the msp432 from TI resource explorer and its not working how i should. I have connected both microcontrollers in 3 wire SPI mode and followed the html guide but it only shows this in the console:

[CORTEX_M4_0] Starting the SPI loop-back example
System provider is set to SysMin. Halt the target to view any SysMin contents in ROV.
This example requires external wires to be connected to the header pins. Please see the Getting Started Guide for details.
SPI initialized
SPI initialized
Master:
Done

The slave message nor the master message is printed at all. Any help would be appreciated.

/* XDCtools Header files */
#include <xdc/std.h>
#include <xdc/runtime/System.h>

/* BIOS Header files */
#include <ti/sysbios/BIOS.h>
#include <ti/sysbios/knl/Task.h>

/* TI-RTOS Header files */
#include <ti/drivers/GPIO.h>
#include <ti/drivers/SPI.h>

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

#define SPI_MSG_LENGTH    26

#define TASKSTACKSIZE     768

/* Allocate buffers in .dma section of memory for concerto devices */
#ifdef MWARE
#pragma DATA_SECTION(masterRxBuffer, ".dma");
#pragma DATA_SECTION(masterTxBuffer, ".dma");
#pragma DATA_SECTION(slaveRxBuffer, ".dma");
#pragma DATA_SECTION(slaveTxBuffer, ".dma");
#endif

Task_Struct task0Struct, task1Struct;
Char task0Stack[TASKSTACKSIZE], task1Stack[TASKSTACKSIZE];

unsigned char masterRxBuffer[SPI_MSG_LENGTH];
unsigned char masterTxBuffer[SPI_MSG_LENGTH] = "Hello, this is master SPI";

unsigned char slaveRxBuffer[SPI_MSG_LENGTH];
unsigned char slaveTxBuffer[SPI_MSG_LENGTH] =  "Hello, this is slave SPI";
/* *  ======== slaveTaskFxn ========
 *  Task function for slave task.
 *
 *  This task runs on a higher priority, since slave
 *  has to be ready for master. Slave SPI sends a
 *  message to master and also receives message from
 *  master. Task for this function is created
 *  statically. See the project's .cfg file.
 */
Void slaveTaskFxn (UArg arg0, UArg arg1)
{
    SPI_Handle slaveSpi;
    SPI_Params slaveSpiParams;
    SPI_Transaction slaveTransaction;
    bool transferOK;

    /* Initialize SPI handle with slave mode */
    SPI_Params_init(&slaveSpiParams);
    slaveSpiParams.mode = SPI_SLAVE;
    slaveSpi = SPI_open(Board_SPI1, &slaveSpiParams);
    if (slaveSpi == NULL) {
        System_abort("Error initializing SPI\n");
    }
    else {
        System_printf("SPI initialized\n");
    }

    /* Initialize slave SPI transaction structure */
    slaveTransaction.count = SPI_MSG_LENGTH;
    slaveTransaction.txBuf = (Ptr)slaveTxBuffer;
    slaveTransaction.rxBuf = (Ptr)slaveRxBuffer;

    /* Initiate SPI transfer */
    transferOK = SPI_transfer(slaveSpi, &slaveTransaction);

    if(transferOK) {
        /* Print contents of slave receive buffer */
        System_printf("Slave: %s\n", slaveRxBuffer);
    }
    else {
        System_printf("Unsuccessful slave SPI transfer");
    }

    /* Deinitialize SPI */
    SPI_close(slaveSpi);
}
/*
 *  ======== masterTaskFxn ========
 *  Task function for master task.
 *
 *  This task runs at a lower priority after the slave
 *  task to ensure it is ready for a transaction.
 *  Master SPI sends a message to slave and also
 *  receives message from slave. Task for this function
 *  is created statically. See the project's .cfg
 *  file.
 */
Void masterTaskFxn (UArg arg0, UArg arg1)
{
    SPI_Handle masterSpi;
    SPI_Transaction masterTransaction;
    bool transferOK;

    /* Initialize SPI handle as default master */
    masterSpi = SPI_open(Board_SPI0, NULL);
    if (masterSpi == NULL) {
        System_abort("Error initializing SPI\n");
    }
    else {
        System_printf("SPI initialized\n");
    }

    /* Initialize master SPI transaction structure */
    masterTransaction.count = SPI_MSG_LENGTH;
    masterTransaction.txBuf = (Ptr)masterTxBuffer;
    masterTransaction.rxBuf = (Ptr)masterRxBuffer;

    /* Initiate SPI transfer */
    transferOK = SPI_transfer(masterSpi, &masterTransaction);

    if(transferOK) {
        /* Print contents of master receive buffer */
        System_printf("Master: %s\n", masterRxBuffer);
    }
    else {
        System_printf("Unsuccessful master SPI transfer");
    }

    /* Deinitialize SPI */
    SPI_close(masterSpi);

    System_printf("Done\n");

    System_flush();
}
/*
 *  ======== main ========
 */
int main(void)
{
    /* Construct BIOS objects */
    Task_Params taskParams;

    /* Call board init functions. */
    Board_initGeneral();
    Board_initGPIO();
    Board_initSPI();

    /* Construct master/slave Task threads */
    Task_Params_init(&taskParams);
    taskParams.priority = 1;
    taskParams.stackSize = TASKSTACKSIZE;
    taskParams.stack = &task0Stack;
    Task_construct(&task0Struct, (Task_FuncPtr)masterTaskFxn, &taskParams, NULL);

    taskParams.stack = &task1Stack;
    taskParams.priority = 2;
    Task_construct(&task1Struct, (Task_FuncPtr)slaveTaskFxn, &taskParams, NULL);

    /* Turn on user LED */
    GPIO_write(Board_LED0, Board_LED_ON);

    System_printf("Starting the SPI loop-back example\nSystem provider is set to"
                  " SysMin. Halt the target to view any SysMin contents in ROV.\n");
    /* SysMin will only print to the console when you call flush or exit */
    System_flush();
    System_printf("This example requires external wires to be connected to the "
                  "header pins. Please see the Getting Started Guide for "
                  "details.\n");
    /* SysMin will only print to the console when you call flush or exit */
    System_flush();

    /* Start BIOS */
    BIOS_start();

    return (0);
}


MSP-TS430PW24: Connection betweeen Jtag of MSP-TS430PW24 and pc

$
0
0

Part Number:MSP-TS430PW24

Hi,

i am recently start work on Texas till now i am working on cypress so i am new on this platform. i just purchase MSP-TS430PW24 board from Ti store. there is Jtag for programming but i cant find any jtag to usb type wire in kit. can anyone tell me how can i start programming with it??

MSP430FR2311: How to use SPI and Transimpedance Amplifier at same time as two funtion using same I/O

$
0
0

Part Number:MSP430FR2311

My customer is designing a smoke detector project with MSP430FR2311PW16, need to use 1 channel SPI, but MSP430FR2311PW16 two channels SPI is used by Transimpedance Amplifier funtion, question is how to use SPI meanwhile?(Pic from MSP430FR2311 Microcontroller IR Reflection Sensing Schematic)

MSP430 PMBus Device Support

$
0
0

Hi team,

We are looking to use the MSP430 in a PMBus application with the TPS53679. From the PMBus Library's User Guide, it says that we have support for the MSP430G2xx3 and MSP430FR5xx_6xx devices and I see that for these families we have examples in our resource explorer. Are these the only families that we can use with this library? 

We are interested in having a devices with 2 I2C ports and looking at potentially using the MSP430F5308. Are there any considerations we would have to take when looking at this device or other devices?

If need be, can we use the PMBus library with the software I2C ports as well?

Regards,

Akash Patel

CCS/MSP430G2553: Log timings is varying in same series of controller

$
0
0

Part Number:MSP430G2553

Tool/software: Code Composer Studio

Hi,

I am using multiple MSP430g2553 controllers (enabling DCO clock source) to log file in SD card every 15 minute. After week of logging the log stamp varies in between different SD cards. Why do same controller log value at different rate even though DCO is stable clock source.

Is there any statistical model which is there to correct for timing errors. Any help will be appreciated.  

Regards,

MSP432P401R: Not seeing hard reset during programming MSP432 with XDS110/200

$
0
0

Part Number:MSP432P401R

We're trying to track down programming unreliability, where sometimes it will error out with not being able to reset the MSP432. We are using a XDS200, but I also tested with a LaunchPad/XDS110.

The options to hard reset the device before and after programming are selected, but I don't see any pulses on the reset line. Does a 'hard' reset not use the reset line? If not, then what is the difference with a soft reset and how does it work?

Thanks.

Getting an interrupt from input sequence

$
0
0

Hello all,

Im using the MSP430 connecting to a device which outputs 4 bits sequence (parallel) every once in a while  and I want to get an interrupt for each new input sequence in port 1.

The input sequence voltage level is 5V and the MSP powered from the micro-USB (connected to the PC).

I also connected the GND of the device to the GND of the MSP.

this is my code just to make sure the problem isn''t there. i think its the voltage levels - Im using Energia

void setup(){
Serial.begin(9600);

pinMode(P1_2,INPUT); 
pinMode(P1_3,INPUT); 
pinMode(P1_4,INPUT);
pinMode(P1_5,INPUT);

attachInterrupt(P1,intFunc,CHANGE); 

};

void intFunc(){

Serial.print("this is an interrupt - the value of P3.1 is :");
Serial.println(digitalRead(P1_3));

}


void loop()
{
delay(2000);
Serial.println("the is the main routine");
}

CCS/MSP430FR5969: Do processors work better on Byte and Words than Bits?

$
0
0

Part Number:MSP430FR5969

Tool/software: Code Composer Studio

Hi,

I was going through TI's CRC Guide - Page 3 where I found a statement that says 

"Processors tend to be much better at operating on bytes and words than bits"

Could someone please clarify what does it mean by "better" over here? Is it in terms of number of machine cycles taken by instructions? If I am not mistaken then, then the last time, I checked machine cycles of each instruction, byte instructions such as DIV and MUL took 4 machine cycles for the ancient Intel CPU's which more than any other instruction. Am I being mistaken when I say than bit operations such as Left Shift or right Shift are inefficient when compared to Byte Operations?


MSP430FR6047: USS module function

$
0
0

Part Number:MSP430FR6047

Hi,

Now I will use MSP430FR6047 to Gas meter.

transducer specification as below:

-excitation frequency:300kHz-1MHz

-drive voltage: 30V

Can MSP430  support above spec, with external/discrete solution or not?

best regards,

kyt

MSP432P401R: MSP432P401R with keil

$
0
0

Part Number:MSP432P401R

I am working with Keil IDE for programming MSP432 , but when i am trying to flash i am getting the above error . can anyone can help me to rectify this.

* i have already found the driver file in the exact path shown in the figure

MSP430F6736: The single phase 3 wires electricity meter reference design

WEBENCH® Tools/MSP430FR5994: MSP430FR5994-LEA support 1024 point FFT?

$
0
0

Part Number:MSP430FR5994

Tool/software: WEBENCH® Design Tools

Does the LEA support 1024 point FFT?

MSP-TS432PZ100: Board layout file

$
0
0

Part Number:MSP-TS432PZ100

Hi TI Experts,

Would you please show me the way to open the "MSP-TS432PZ100.brd" file?

I tried to open this file with Allegro viewer, but I met the error as below.

  

If you have any questions, please let me know.

Best regards.

Kaka

Viewing all 22417 articles
Browse latest View live


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