MSP430: SDA16? what would I ever use that for.

SDA16 is a 16Bit sigma-delta ADC, and is one of the options for MSP430 line of chips. But then you ask, doesn’t the mps430 have a ADC with 10 to 12 bits? Yes it does but the SDA is a different beast all together, with more settings and registers. For more information on how it works please feel free to read some application notes and the Wiki. I personally cant answer how or why you need to send your oversampled , comb filtered, decimated and modulated signal to get 16 Bit resolution.

application notes on SDADC
WIKI on how its done.

But lets get started by going over some of the Registers you will need to setup and or modify.

SD16CTL – control register
controls Clock source, power mode, clock divider, V ref selection, overflow interrupt.

SD16CCTL0 – channel register
Controls Buffer mode(no buffer in F2013), Bipolar or unipolar, conversion mode over
sampling and LSBACC enable, conversion interrupt, data format, interrupt flag and
conversion start

SD16INCTL0 – input control
Sampling rate, preamplifier gain, differential pair select

SD16AE – analog enable
Selects external Analog input

SD16IV – Interrupt vector – self explanatory

SD16MEM0 – conversion memory – where your conversion will end up when sda16 is finished with conversion.

** all these registers mentioned are reset with PUC

Yes I know it looks like a lot, but it really doesn’t take that much to start getting readings .
So the first thing you need to do is select your differential pair/ Pins you will be using. ** you will have to use the Data sheet to pick your Pairs, and remember if you are using an external VREF P1.3 will be used on the F2013 so that leaves open 7 other pairs to select from.

So the basic setup – This is the same as any other project, like turn off WDT+, then setup the pins, then the rest of the peripherals.

Basic SD16 setup – continuous read on pin, output toggles LED if VREF >.3v or 1/2 of internal ref or 1.2v.

SD16CTL = SD16REFON + SD16SSEL_1; // 1.2V ref, SMCLK
SD16INCTL0 = SD16INCH_1; // A1+/-
SD16CCTL0 = SD16UNI + SD16IE; // 256OSR, unipolar, interrupt enable
SD16AE = SD16AE2; // P1.2 A1+, A1- = VSS
SD16CCTL0 |= SD16SC; // Set bit to start conversion

this is taken from the TI SD16 code examples
Just add the ISR like so and you have a good start of something

#pragma vector = SD16_VECTOR
__interrupt void SD16ISR(void)
if (SD16MEM0 < 0x7FFF) // SD16MEM0 > 0.3V?, clears IFG
P1OUT &= ~0x01;
P1OUT |= 0x01;

***may not work for mspgcc***

msp430x20x3_sd16A_01Full code example from TI.

Now with Grace’s Point and click config tool, you would think that learning these registers are not necessary, but I think they are….what if you need to change a setting to the peripheral that grace had setup up, what if you need a new sampling rate after every conversion, or choose a different VREF. With Grace you lose this flexibility and should learn what registers modify what, so you can make the uC work for you.

So lets start with SD16CTL
options that you will need to set to get things working

SD16SSEL_x – this selects your clock source for SD16
0 MCLK – default

SD16REFON – selects if you are using the reference generator or an external VREF
Its either enabled or disabled – you will have to choose the what works best for you.

That’s all you really need to set to get that- so on to the next one

SD16CCTL0 – there’s not too many things to set here for basic setup
SD16UNI – this sets bipolar or unipolar mode, this affects your SD16 values – you will have to look at the user guide to figure out which mode is best for you.

SD16SNGL – this sets if its a single conversion or continuous conversion

SD16IE – enable interrupt – you need this if you use interrupts and not SW to poll
SD16SC — starts and stops conversion – any questions?

SD16INCTL0 – input control – where you select your gain and pins that you use
SD16INCH_x – 0 – 7 pins – your choice – don’t forget to look at the data sheet
SD16GAIN_x – pre amp gain 0-6 or 1x to 32x

SD16AE – turn on or off the differential pair or tie the (neg) to VSS

The rest of the registers you will use but don’t have to setup, but this will get you a basic understanding on how to use SD16 peripherals – remember TIs code examples can give you a great place to start coding from. —- next we will implement the SDA16 on my BPM counter for a proof of concept .

Until next time – thanks for reading
PS let me know if i need to correct or change anything