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.

BOOSTXL-AUDIO: Real time audio system using Audio Signal Processing Boosterpack and MSP432

Part Number: BOOSTXL-AUDIO

Hello,

I'm working on a system to do real-time audio processing for an input signal. I'm using the MSP432 launchpad (obviously), as well as the Audio Signal Processing Boosterpack (BOOSTXL-AUDIO).

For initial testing, I have done a simple record-playback system using pushbuttons, and have observed reasonable quality when recording, but poor playback quality. For playback, I am using the SPI protocol, programmed as follows

/* Initialize eUSCI_B settings for writing to DAC */
void Audio_DAC_Setup(void) {
	/* Rest eUSCI_B */
	EUSCI_B0->CTLW0 |= EUSCI_B_CTLW0_SWRST;

	/* Set eUSCI_B registers */
	EUSCI_B0->CTLW0 =
			EUSCI_B_CTLW0_SWRST |		//remain at rest (redundant)
			EUSCI_B_CTLW0_MST |			//master mode
			EUSCI_B_CTLW0_SYNC |		//synchronous mode
			EUSCI_B_CTLW0_MODE_0 |		//3-pin SPI mode
			EUSCI_B_CTLW0_MSB |			//most-significant-bit first mode
			EUSCI_B_CTLW0_CKPL | 		// Set clock polarity high
			EUSCI_B_CTLW0_SSEL__SMCLK;	//SMCLK select

	/* Enable eUSCI_B */
	EUSCI_B0->CTLW0 &= ~EUSCI_B_CTLW0_SWRST;
}

/* Write value to DAC */
void Audio_Write_DAC(uint16_t data) {
	/* Bring SYNC pin to enable DAC8311 */
	SYNC_PORT->OUT &= ~SYNC_PIN;
	
	/* Clip leading two bits of data for DAC8311 to be in "normal mode" */
	data &= ~0xC000;
	
	/* Wait for buffer to be ready */
	while(!(EUSCI_B0->IFG & EUSCI_B_IFG_TXIFG));
	
	/* Write MSB to transmission register */
	EUSCI_B0->TXBUF = (uint8_t)(data >> 8);

	/* Wait for transmission to finish */
	while(!(EUSCI_B0->IFG & EUSCI_B_IFG_TXIFG));

	/* Write LSB to transmission register */
	EUSCI_B0->TXBUF = (uint8_t)(data);

	/* Wait for transmission to finish */
	while(EUSCI_B0->STATW & EUSCI_B_STATW_BUSY);

	/* Bring SYNC pin high to finish SPI with DAC8311 */
	SYNC_PORT->OUT |= SYNC_PIN;
}

The first function is called once in the main routine, and the second function is used in an ISR for a timer. Is there anything apparently wrong with the way I'm approaching this?

Thank you

  • Thomas,

    One thing that is missing from your configuration is the SPI bit-clock rate. Typically this would be the EUSCI_B0->BRW = 2;

    And the baud rate divider for this configuration should be a minimum of 2.

    I am assuming your SPI pins are already pre-configured.

    Also, try playing back a sinusoid tone to see what the output looks like? Create an array in memory and try playing it back to see what is going on (if it is skipping or writing an incorrect value or the playback rate is off).

    William
  • William,

    I went ahead and added the line EUSCI_B0->BRW=2; to my SPI initialization function. When you say that the baud rate divider configuration should be a minimum of 2, I am correct in assuming that line of code sets that, yes?

    You were correct in assuming all of the SPI pins are configured for output, I have pasted that bit of code below

    /* Setup pins for writing value to DAC */
    void Audio_Output_Pin_Setup(void) {
    	/* Configure SCLK and MOSI pins for SPI */
    	MOSI_PORT->SEL0 |= MOSI_PIN;
    	SCLK_PORT->SEL0 |= SCLK_PIN;
    
    	/* Configure SYNC pin for output */
    	SYNC_PORT->DIR |= SYNC_PIN;
    	SYNC_PORT->OUT |= SYNC_PIN;
    
    	/* Enable active-low AMP power */
    	AMP_PORT->DIR |= AMP_PIN;
    	AMP_PORT->OUT &= ~AMP_PIN;
    }

    I tested playback using a hardcoded sinusoid, below I have plotted the sinusoid as it appears in the MSP432's memory and as I recorded it.

    It seems like it might be skipping values, but I'm unsure what would cause this. The timer module is configured to run at a rate of 22.05 kHz with a clock setting of 48 MHz. I'm having trouble seeing how timing could be a problem here, do you have any suggestions for approaching this problem?

    Thanks,

    Thomas

    (aside: I recognized your name from a lot of software demos available for the MSP432. I found those very helpful for understanding the configuration of the device, thank you.)

**Attention** This is a public forum