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