This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP430F4270: Audio Feedthru

Part Number: MSP430F4270
Other Parts Discussed in Thread: MSP430FR5994

Dear all,

I'm trying to do some DSP with the 4270 since it has an A/D and D/A. I have two questions:

1. Is there a good way to synchronize the input and output sample rates?

2. What is the best way to achieve the fastest sampling? i.e., how can I increase the clock going to the A/D and D/A and should I use interrupts?

Here's my code so far:

//*****************************************************************************
//  Audio Feedthru
//
//                MSP430F4270
//            -----------------
//           |                 |
//           |        DAC0/P1.4|--> Analog Out
//           |                 |
//   Vin+ -->|A0+              |
//   Vin- -->|A0-              |
//           |                 |
//           |            VREF |---+
//           |                 |   |
//           |                 |  -+- 100nF
//           |                 |  -+-
//           |                 |   |
//           |            AVss |---+
//
//*****************************************************************************
#include <msp430.h> 
unsigned int result;

int main(void)
{
	WDTCTL = WDTPW | WDTHOLD;	              // stop watchdog timer
	FLL_CTL0 = DCOPLUS + XCAP14PF;            // DCO+ set so freq = xtal x D x N+1

	SD16CTL = SD16REFON+SD16SSEL0;            // 1.2V ref, SMCLK
	SD16CCTL0 |= SD16SNGL+SD16IE+SD16BUF_3 ;  // Single conv, enable interrupt, high impedance
	SD16INCTL0 |= SD16INTDLY_0;               // Interrupt on 4th sample

	unsigned int i;
    for (i = 0; i < 10000; i++);              // Delay for 32 kHz crystal

	__enable_interrupt();                     // Enable general interrupts

	SD16CTL = SD16REFON;                      // 1.2V ref
	DAC12_0CTL = DAC12OPS + DAC12SREF_2 + DAC12IR + DAC12AMP_5 + DAC12ENC;
	                                            // DAC o/p external, Ref Voltage = internal (SD16),
	                                            // O/p Voltage range = 1x ref, Enable conversion
	while(1){
	    DAC12_0DAT = result >> 1;               // Send A/D result to D/A
	    SD16CCTL0 |= SD16SC;                    // Set bit to start A/D conversion
	    __bis_SR_register(LPM0_bits);           // Enter LPM0
	}
}


#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
#pragma vector=SD16_VECTOR
__interrupt void SD16ISR(void)
#elif defined(__GNUC__)
void __attribute__ ((interrupt(SD16_VECTOR))) SD16ISR (void)
#else
#error Compiler not supported!
#endif
{
  switch (SD16IV)
  {
  case 2:                                   // SD16MEM Overflow
    break;
  case 4:                                   // SD16MEM0 IFG
    result = SD16MEM0;                      // Save CH0 results (clears IFG)
    break;
  }
  __bic_SR_register_on_exit(LPM0_bits);     // Exit LPM0
}

thank you,

Scott

  • Hi Scott,

    Thanks for using MSP430 device. Our team member will check your question and reply you later.
  • Hi Scott,

    1. Is there a good way to synchronize the input and output sample rates?

    Can you elaborate on this? You could use the same clock source for both. Would that achieve what you are looking for?

    2. What is the best way to achieve the fastest sampling? i.e., how can I increase the clock going to the A/D and D/A and should I use interrupts?

    The SD16 on the MSP430F4270 has a max input clock frequency of 1.1MHz(page 28 of datasheet). You can use your MCLK as the source and divider to reduce the frequency to 1.1MHz. 30-4 of the device users guide shows the block diagram and dividers available.

    Datasheet: www.ti.com/.../msp430f4270.pdf

    Users Guide: www.ti.com/.../slau056l.pdf

    You may also want to check out the Audio signal processing booster pack module as this seems pertinent to your application. Code examples are available for the MSP430FR5994. This design does use an external DAC.

    www.ti.com/.../BOOSTXL-AUDIO

**Attention** This is a public forum