Custom Search

Category Archives: MSP430

WP mobile app test & update

0
Filed under electronics, General, Hardware, MSP430

Hopefully this will help me stay motivated to keep posting. my current side project

image

My motor driver should be done this weekend. 

image

msp430 BMP counter, its getting there

0
Filed under Hardware, MSP430

Doing some more testing on my BPM counter,  the beat detection circuit is getting closer and closer.

 

Using NightBass “Sky Ride extended mix(A1)”  I have tested the circuit and finally have some results.  See video below.

The signal is coming from my turntable, through the mixer, and into my low pass filter, then the signal is read by the SD16, every time the threshold is reached the LED is turned on.

 

Test Code

/*****************************************************************************/
//Author- Justin Solarski
//Copyright 2011 justinstech.org
#include
/*****************************************************************************/
volatile unsigned int results = 0;
/*****************************************************************************/
/*****************************************************************************/
void main(void) {
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
//basic clock settings
DCOCTL = CALDCO_1MHZ;
BCSCTL1 = CALBC1_1MHZ;
BCSCTL2 |= DIVS_3; //divide smclk/8 125000Hz
//GPIO setup
P2DIR |= BIT7;
P1DIR |= BIT6;
//sd16 settings
SD16CTL = SD16REFON + SD16SSEL_1; // 1.2V ref, SMCLK
//SD16CTL |= SD16XDIV_3; //
SD16INCTL0 = SD16INCH_0; // A1+/- P1.2
SD16CCTL0 = SD16IE; // 256OSR, bipolar offset, interrupt enable
SD16AE = SD16AE0; // P1.0 A0+, A0- = VSS
SD16CCTL0 |= SD16SC; // Set bit to start conversion
_BIS_SR(LPM0_bits + GIE);
}
/*****************************************************************************/
// SD16 ISR
#define THRSHMAX 0xc000 // not used yet
#define THRSHMIN 0x4000 // not used yet
__attribute__((interrupt(SD16_VECTOR)))
void Sd16_Isr(void){ // 0000 - FFFF -- 8000 = halfway point or 1.2V
//P1DIR ^= BIT6;
results = SD16MEM0;
if (results < 0x4000) { //results is less then 0x4000 P1OUT |= BIT6; } else if ( results > 0xc000) { // results greater then 0x9000
P1OUT |= BIT6; }
else { P1OUT = 0; }
}

the code needs to be tweaked a little more to show better results, maybe adding a adjustable threshold would be nice. only a few more things to finish, like calculations of BPM and the 3x 7 segment display. hopefully it will be the majority will be finished sometime this next week, and then clean up and find a nice project box for everything.

once i get the calculations done I will do a bigger write up, explaining how it all works…….Please let me know what you think

Thanks
Justin

MSP430 BPM counter ….coming soon

0
Filed under Hardware, MSP430

I am almost finished with my BPM counter :)

There will be a Post coming this weekend, with most of it finished except the small final touches, like the enclosure and finalized board.

Also I am so excited that i get to enter it into the http://43oh.com project of the month contest for August…..

MSP430 – different Interrupts for different compilers

0
Filed under MSP430, programing

The different compilers out there for msp430 chips and Launchpad have different syntax for each one -

Hopefully this post will help you find out which one you need.

(all examples are for chip msp430g2231, just substitute your chip that you are working with)

First – CSS/IAR — TI officially supported compilers/IDEs

#pragma vector=TIMERA1_VECTOR
__interrupt void Timer_A1(void)    { //ISR code

}

 

 

second – mspgcc4 – IDE of your choice

Makefile — must have this option to compile correctly to chip -mmcu=msp430x2231 –most chips are supported but you will have to find the correct one for yours.

Main.c file or main project file

you must include these

#include <msp430g2231.h>
#include <signal.h>

and then the syntax for your ISR

interrupt(TIMERA0_VECTOR) Timer_A (void) {  //code goes here}

 

Third — Uniarch mspgcc – Newest compiler – replacement for mspgcc4

 

makefile– -mmcu=msp430g2231   you must use the one specific for your chip and should not include an x in the mmcu option since that is for the depreciated mspgcc4

inlcude these header files

#include <msp430.h>
#include <legacymsp430.h>

ISR syntax

interrupt(TIMERA0_VECTOR) Timer_A (void)
{  //code goes here}

 

Fourth way– Offiacial uniarch mspgcc ISR syntax

makefile – same as before

no extra includes needed, just the msp430.h or specific chip header

__attribute__((interrupt(TIMERA0_VECTOR)))
void Timer_A(void){ //code goes here }

Source link

 

This is not complete, I am waiting for an answer on what the syntax should be for uniarch branch of mspgcc for interrupts. So far my testing has only allowed using interrupts using the lgacymsp430.h header. Once I get an answer I will update this post.

update –


so far this alternative works – (works == compiles with no errors)

The syntax for declaring an interrupt with gcc is (as far as I learnt so far)

__attribute__((interrupt(VECTOR_NAME)))
void irq_handler_for_vector(void);

with VECOR_NAME the name of the IRQ vector. example:

__attribute__((interrupt(USCI_A2_VECTOR)))
void usbRxISR(void){ 

Thank you Matthias - for this alternative.

MSP430 Uniarch mspgcc or mspgcc4?

8
Filed under MSP430, programing

You are probably asking yourself which compiler for your launchpad/msp430, you should use. Me personally, I don’t really care which one works Better, I just need one to compile for my launchpad and supports the chips I use.

some similarities  –

Both create files for your msp430 chip,

both are compiled  with GCC 4.x+

Both use libc for the msp430.

They pretty much fill the same function.

 

Now some of the major differences, mspgcc4 is stable and  can be used with production code, Uniarch is still being developed and is changing a lot still. mspgcc4 supports most of the chips for msp430 except the very newest (since it is hard to add newer chips with out rebuilding and adding a lot of code).  Uniarch is trying to make adding chip support as easy as possible, and unifying all the branches of mspgcc. Even coding is slightly different, interrupts are coded different and even the headers you use may be different(FYI).

 

So which one should I choose?

Well that is a tough question, what are your goals?

are you trying to get one just up and running or do you need support for the newest chips? — Have you compiled programs from source or are you new to linux?

Will you give up after you get an error or will you work through it and figure it out?

 

Well if you need just something up and running just to be able to compile a few programs for your launch pad , I would suggest using mspgcc4 , using the build script or using the pre-built binaries. pre- built binaries, to install, you just add a folder to usr/local/ and call it mspgcc4 and unpack your binaries in there and that it.  The build script is pretty self explanatory, and it compiles everything from source . I have used it multiple times and works as long as you have all the dependencies. IE(ncurses-dev, cvs, lidreadline-dev etc…)

A very simple way to get it up and running -

 

Now if you want access to the New uniarch mspgcc, that supports the new chips like msp430g2452 or others. you will need to go the long and hard route of patching compiling linking and more compiling lol. but there are some great directions to do it. Here (Thank you sergio). But it is not for the faint of heart….lol /JK

Read More »