11 years, 3 months ago.

TLV320 hang-up in audio.start

Hello,

immediately after recording some sectors of audio on an SD-card, I want to playback the recorded audio. But audio.start(TRANSMIT) does not return. It hangs in NVIC_EnableIRQ(I2S_IRQn). What happens inside this function?

Running recording and playback seperatly works just fine.

Here is the code:

        audio.power(0x02);                      //power up all TLV320, just not microphone
        audio.inputVolume(0.999, 0.999);        //Set input volume to max - I don't like to use 1.0 due to rounding errors
        audio.frequency(frequency);             
        audio.format(wordWidth, (2-channels));  //note int mode = 2 - channels
       
        audio.attach(&record);                  //attach record function to audio interrupt
        for(int j = 0; j < 4096; ++j){
            circularBuffer[j] = 0;              //clear circular buffer
        }
        printf("Record\n");
        finish.mode(PullUp);         
        finish.fall(&stopRecording);            //attach stop button
        recording = true;
        audio.start(RECEIVE);                   //start recording
        streamToFile();
        printf("Stop: %d\n",write_sector);
        audio.stop();
        //while(1);
       
        printf("Playback\n");
        audio.attach(&play);                    //attach interrupt handler to send data to TLV320
        for(int j = 0; j < 4096; ++j){          //upon interrupt generation
            circularBuffer[j] = 0;              //clear circular buffer
        }
        audio.start(TRANSMIT);         <<< hang-up
        theta = 0;
        read4Pointer = 512;
        fillBuffer();                           //continually fill circular buffer
        audio.stop();
        printf("Done\n");
        while (1);

Question relating to:

1 Answer

11 years, 3 months ago.

Meanwhile I got the solution by myself. LPC_I2S->I2SIRQ has to be cleared before the audio.start for playback. Otherwise the settings for recoding will be kept.

Accepted Answer