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.

Problem with printf() in evmomapl138_test_audio sample

Other Parts Discussed in Thread: OMAPL138

Hello,

 

I am testing the audio program sample provided with omapl138 experimenter kit. In the source file test_audio.c, in the function testAudioLineIn( ) there is the core loop which copy the input signal in the output:

         for (sample = 0; sample < 48; sample++)
         {
            // wait for xmit ready and send a sample to the left channel.
            while (!CHKBIT(MCASP->SRCTL11, XRDY)) {}
            MCASP->XBUF11 = (sinetable[sample] << 15) | 0x00000000;

            // wait for xmit ready and send a sample to the left channel.
            while (!CHKBIT(MCASP->SRCTL11, XRDY)) {}
            MCASP->XBUF11 = (sinetable[sample] << 15) | 0x00000000;
         }

This program is working fine, but I tried to print "dat" in the standard output and it doesn't work. More precisely, it works  as soon as I don't flush stdout. For example I can set a printf( ) without flushing before the for loops because it only flushs at the end of the loops. But I can't set a printf inside the for loop, I think it's because the stack is too small, and it flush before the end of the loops. When printf flushed, the program freeze at a while (!CHKBIT(MCASP->SRCTL11, XRDY)) { } line. I noticed that the value of the register MCASP->XSTAT change from 0x50 to 0x179 after a printf( ).

I have read the wiki about printf( ) and I noticed the warning "Avoid C I/O inside interrupt handler  functions". Do you think it can be the source of my problem?

Is it really possible to write on 2 outputs ( stdout and codec input ) in the same time?

Note that I have tried to change the stack size without success.

 

Thanks in advance