[alsa-devel] alsa on Atmel at91

Michel Benoit murpme at gmail.com
Sun Apr 15 21:38:32 CEST 2007


Hello

I am trying to run alsa on an ARM based target AT91SAM9260 based
board. The cpu is connected over i2s (atmel's ssc) to a PCM1725 chip.
I modifed the AT73C213 driver available in the latest experimental
patches from www.at91.com to behave correctly for the PCM1725 chip.
Basically all I have done is remove the spi communication with the
AT73C213 that regulates the sound output volume. The PCM chip has no
such volume control and I use the i2s interface setup as is to send
sample data.

I cross compile alsa lib and run the program test/pcm_min which
generates as expected random noise on the speaker output.  However
when I try to run test/pcm I get a divide by zero floating point
exception because the library returns a period_size of 0.  This
despite the fact that the period time is set to 100000 and buffer time
is set to 500000.  I enabled some debug info in the library and I see
the following data dumped to the console.

ACCESS:  RW_INTERLEAVED
FORMAT:  S16_LE
SUBFORMAT:  STD
SAMPLE_BITS: 16
FRAME_BITS: 32
CHANNELS: 2
RATE: 48000
PERIOD_TIME: (20354 20355)
PERIOD_SIZE: 977
PERIOD_BYTES: 3908
PERIODS: (4 5)
BUFFER_TIME: (81479 81480)
BUFFER_SIZE: 3911
BUFFER_BYTES: 15644
TICK_TIME: 10000

How is it possible that the following code from test/pcm.c

err = snd_pcm_hw_params_set_period_time_near(handle, params,
&period_time, &dir);
	if (err < 0) {
		printf("Unable to set period time %i for playback: %s\n",
period_time, snd_strerror(err));
		return err;
	}
	err = snd_pcm_hw_params_get_period_size(params, &size, &dir);
	if (err < 0) {
		printf("Unable to get period size for playback: %s\n", snd_strerror(err));
		return err;
	}

returns a period_size of 0 when the debug output shows that the
period_size has been calculated to be 977?

Can it be that the driver has not initialised the alsa structures
properly (the driver file is attached to this email)? Have I mucked
something up by removing the spi comm. with the at73c213?

Could this be due to a problem in the cross compilation of alsa-lib?
I use the following configure command line:

CC=arm-linux-gcc ./configure \
    --host=arm-linux\
    --prefix=$HOME/bsp/rootfs/buildroot/build_arm/root/usr\
    --with-softfloat

(note: I have also tried it without --with-softfloat)

I have tried digging through the alsa lib code but it is not very
clear to me where the returned value for period_size comes from.  I
appreciate any pointers, hints or tips that can help me to solve
and/or understand this problem.

Thanks in advance!

Michel


More information about the Alsa-devel mailing list