Jump to content
43oh

MSP430F550x based frequency meter


Recommended Posts

Looks like I'll have to design my own board or order @@spirilis PCBs because I didn't see stock on his board. I also found another open source design, http://www.rev0proto.com/wiki/index.php/MSP430F5510 that I might take a look at..

The MSP430F5529 is pretty much the same as 550x with extra memory and FLASH. If you're careful about that, the F5529 launchpad is a good and cheap dev board for projects that should eventually migrate to 550x.

Link to post
Share on other sites

Well if nothing else I'm going to have a few boards to play with in the next few days. I somehow missed that there was a LaunchPad board for this series so I just ordered one of those. Before that I found a low cost board from Olimex that looked interesting. As if that wasn't enough I also picked up one of the C2000 LaunchPad boards since those 200MHz parts should be able to sample fast enough for me.

 

In my application I'm going to be actually counting pulses as the signal isn't going to be a nice fixed frequency. It may turn out that I might not have to catch every pulse so we'll see once I get my hands on everything and do some sampling.

 

Thanks for your inputs!

Link to post
Share on other sites
I'm curious about your comment on it not going higher than 48MHz. I thought the whole purpose of Timer D was to go up to 256MHz on the output.

 

All my comments are related to MSP430F5xx devices without Timer D, MSP430F5510 for example.

 

In my application I'm going to be actually counting pulses as the signal isn't going to be a nice fixed frequency. It may turn out that I might not have to catch every pulse so we'll see once I get my hands on everything and do some sampling.

 

My frequency meter is doing this. It is counting pulses on Timer external input pin.

Link to post
Share on other sites

This is one of those times when I hate that TI has so many different MSP430 devices to choose from! Looking back I see now that there are only 6 devices which have this special Timer D (MSP430F51x1, MSP430F51x2) and looking at that families datasheet I see on page 43 that the "Local Clock Generator Frequency", fHRCG, goes all the way up to 1074MHz (826MHZ typical) and the "Trimmed Clock Frequencies", fTRIM, is the 256MHz that I guess I read about.

 

Right on page 45 is the "Input Capture and Output Compare Timing" specs and it shows tTD, (Timer_D input capture timing, minimum pulse duration to trigger input capture event) is 4ns typical.

 

So now I'm really curious what can really be done with one of these parts if you were able to count 48MHz with a "standard" MSP430.

 

Looks like @@RobG 's board hasn't been in stock for awhile but I found another one to add to my pile. Of all people SchmartBoard made one

Link to post
Share on other sites

Hi, I am also trying to make a frequency counter using msp430F513X. I am curious about that why your program is based on two timers but not using a capture mode? I see MSP430F550x timerB does have a capture mode and I think it could be simpler when you use only one timer.

 

For now I am using capture mode to make SMCLK measuring ACLK, but the accuracy is not good so far, so I gonna try your method and set up two timers...

 

Thanks!

Link to post
Share on other sites
  • 10 months later...

Hello

I am working whit msp432 and trying to measure frequency like you, but i have problem with the result, i can't measure more than 32888 Hz and i don't know the problem.

 

Captura_zpss1jnquq2.png

 

Would it be possible a little help? someone can see the problem?

 

 

My code is a Energia sketch:

#include <driverlib.h>

volatile uint32_t R10=0;
volatile uint32_t R20=0;
volatile uint32_t Cont=0;

const Timer_A_CaptureModeConfig captureModeConfig =
{
        TIMER_A_CAPTURECOMPARE_REGISTER_1,        // CC Register 1
        TIMER_A_CAPTUREMODE_RISING_EDGE,          // Rising Edge
        TIMER_A_CAPTURE_INPUTSELECT_CCIxB,        // CCIxB Input Select
        TIMER_A_CAPTURE_SYNCHRONOUS,              // Synchronized Capture
        TIMER_A_CAPTURECOMPARE_INTERRUPT_ENABLE,  // Enable interrupt
};
void TA1_0_IRQHandler(void)
{
  MAP_Timer_A_clearCaptureCompareInterrupt(TIMER_A1_BASE, TIMER_A_CAPTURECOMPARE_REGISTER_0); //clear
  R10++;
}

void TA2_0_IRQHandler(void)
{
  MAP_Timer_A_clearCaptureCompareInterrupt(TIMER_A2_BASE, TIMER_A_CAPTURECOMPARE_REGISTER_1); //clear
  R20++;
}

  
void setup()
{

  Serial.begin(9600);

  MAP_PCM_setPowerState(PCM_LPM0_DCDC_VCORE1);
  MAP_CS_initClockSignal(CS_SMCLK,CS_HFXTCLK_SELECT,CS_CLOCK_DIVIDER_4);      //Set system clock 12 MHz


  //Set GPIO 4.2 as timer
  MAP_GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P4, GPIO_PIN2, GPIO_PRIMARY_MODULE_FUNCTION);

  // Timer TA1 SMCLK/1
  TA1CTL = TASSEL_2;
  TA1CCTL0 = CCIE;
  TA1CCR0 = 60000;

  // Timer TA2 capture mode (CC Register 1, Rising Edge, CCIxB Input Select, Synchronized Capture, Enable interrupt)
  MAP_Timer_A_initCapture(TIMER_A2_BASE, &captureModeConfig);
  
  //Register interrupts
  MAP_Timer_A_registerInterrupt(TIMER_A2_BASE,TIMER_A_CCRX_AND_OVERFLOW_INTERRUPT, TA2_0_IRQHandler);
  MAP_Timer_A_registerInterrupt(TIMER_A1_BASE,TIMER_A_CCR0_INTERRUPT, TA1_0_IRQHandler);
 }

  
void loop()
{
  Serial.print(R20); //Timer A2 count
  Serial.print(" ");
  Serial.println(R10*60000);
  Serial.println(Cont);
  
  R10 = 0;
  R20 = 0;
  TA1R = 0; // clear timer counter
  TA2R = 0; // clear timer counter

  MAP_Timer_A_startCounter(TIMER_A2_BASE, TIMER_A_CONTINUOUS_MODE); //Star timers
  MAP_Timer_A_startCounter(TIMER_A1_BASE, TIMER_A_UP_MODE);
  
  while (R10 !=200 ){} // wait

  TA2CTL &= ~MC0; // stop timers
  TA1CTL &= ~MC1;
}
 

If i get to measure frequency before that your replies, i will share the code with everyone.

I will be working.

 

Thank you for all.

Regards.
Link to post
Share on other sites
  • 3 weeks later...

Hi

 

I'm very new and have a few basic questions about the code.

 

	/*** Timer_A Set-Up ***/
	TA0CCR0 = 20000;			// 20000*400 = 8000000 or 8MHz
        ...
	while(CounterValue != 400);	// Wait while CounterValue is not equal to 400
	

 

 

How come TA0CCR0 takes the decimal value 20000? Also, why does it need to wait for CounterValue to reach 400? My understanding is that CounterValue is incremented for each positive edge. Why does it need to wait for 400 positive edges?

 

Thanks

Link to post
Share on other sites
How come TA0CCR0 takes the decimal value 20000? Also, why does it need to wait for CounterValue to reach 400? My understanding is that CounterValue is incremented for each positive edge. Why does it need to wait for 400 positive edges?

 

One counter is counting input pulses, and another one time period (400 * 20000 = 8000000, MCLK = 8 MHz, 1 second).

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...