replacing 20MHz crystal on NGW100

Go To Last Post
12 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

hi all..
has anybody tried replacing the 20MHz crystal on the NGW100 by, for instance, a 24.576MHz one. I want to do this to get standard audio sampling rates on the DAC.
It doesn't look that complicated to do the task, but I want to hear some opinions before breaking the only NGW I have here.

Thanks!

Carlos

----edit----------------
Also, does anyone know AP7000's XTAL pins capacitance, since it's rated as TBD in the datasheet. The NGW100 schematic shows 22pF external caps, but nothing about the XTAL specific model. thanks

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

hi

i have an evk1101 with an uc3b0256 and i replaced the 12 MHz crystal with a 13 MHz one. the only thing you have to look at is the SR (series resistance) of the crystal. The value for the uc3b is between 20 and 50 ohm. (have a look in the datasheet)

Dender

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

thanks for the information. I will try to replace it, hope I get things right :P

thanks

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

hi cbecker, did this mod work OK? Also, may I ask what app you're using to generate sound, file types etc.?
rob

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi robert,
I'm receiving the new crystals tomorrow, I will let you know if I succeed in replacing them.

To generate sounds or convert them to pure PCM I use goldwave (www.goldwave.com), but any other app can be used. Goldwave can also resample and/or dither a sound, so you can play with that and upload it to the ngw100 and test some sounds :P

good luck,
Carlos

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well I got my xtals yesterday. I was able to replace them and now the NGW100 is working just fine except that I haven't replaced U-Boot, so the baudrate with the new crystal is set to (approx) 141558 BPS, so the only way to command u-boot is to use (for instance) a ft232 which allows custom baudrates. Since I don't own a JTAG I won't be able to burn u-boot again (well, I don't want to risk my board if something goes wrong).

Except from that, I just had to recompile the kernel and change the old value (20000000) to 24576000 in arch/avr32/mach-at32ap/at32ap700x.c. Just look for this:

unsigned long at32ap7000_osc_rates[3] = {
...etc..etc
}

The new kernel will set 115200 as the serial baudrate, so the only "not-easy-usable" part is the u-boot.

now the DAC works fine with 48000 and 96000 Hz sampling rate. Note that if you want to use 44100 another crystal will be needed! (ie 22.5792 MHz )

Also note that now the avr32 is running at 160MHz (actually 159.744 MHz ), but everything seems to be fine. To lower it down u-boot can be modified, altough there are some other options to do that too.

so, in the end, it is possible and it works!

TIP: before replacing the xtal set everything up so that you can telnet or ssh to the NGW100. Thus, you can update the kernel image located in flash in an easy way through ethernet.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks for the info Carlos - and nice work with the xtal!

Also, what app are you running on the ngw to play the sound files via the DAC?

Rob.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm not using any special app. I only tried playing RAW stereo sound files using this proggie:

#include 
#include 
#include 
#include 
#include 
#include 


int main( int argc, char *argv[]  )
{

	int ver;
	int ret, format, rate;
	int rate_original;

	int fd;

	FILE	*f;

	if ( argc != 3 )	//2nd argument is sample rate
	{
		printf("Use: ./test  \n");
		return -1;
	}

	rate = atoi( argv[1] );
	rate_original = rate;


	format = AFMT_S16_LE;	//little endian!

	printf("Opening /dev/dsp %s.....\n", argv[1]);

	fd = open(	"/dev/dsp", O_WRONLY, 0);

	if ( fd == -1 )
	{
		printf( "Error opening /dev/dsp\n");
		return -1;
	}

	//
	ret = ioctl(fd, OSS_GETVERSION, &ver);

	if ( ret == -1 )
	{
		printf("Error getversion: %s\n", strerror(errno));
		return 1;
	}

	
	//set format
	ret = ioctl( fd, SNDCTL_DSP_SETFMT, &format );
	if ( ret == -1 )
	{
		printf("Error set format %s\n" , strerror(errno));
		return -1;
	}




	ret = ioctl( fd, SNDCTL_DSP_SPEED, &rate );

	if ( ret == -1 )
		printf("Error setting sampling rate\n" );
	else
		printf("OK! New BRATE=%d\n", rate);


	#define	BLOCK_SIZE	512
	unsigned char buf[BLOCK_SIZE];
	
	f = fopen( argv[2], "rb");

	if ( f == NULL )
		printf("ERror opening soundfile!\n");

	//escribimos..
	unsigned long i = 0;
	
	#define	TOTAL		(rate_original*2*2*30L)  //stereo

	for (i=0; i < TOTAL/BLOCK_SIZE; i++)
	{
		fread( buf, 1, BLOCK_SIZE, f );
		write( fd, buf, BLOCK_SIZE );
	}
	
	return 1;
}

However, I heard of mplayer and other's optimized versions for avr32. Try searching this forum with google.

good luck!

Carlos

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If you can boot Linux, you can reflash u-boot, see here:
http://avr32linux.org/twiki/bin/...

I like cats, too. Let's exchange recipes.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

yes I know, but I don't want to risk my board until I have a JTAG loader in case I mess things up :S

now everything is working fine (except u-boot uart baudrate).

thanks

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi Carlos, Thanks for the code above, I eventually got round to trying it out - ideal basis for my needs being small and lightweight.

I've been trying all kinds of things to try and vary the playback volume by adding another command line arg but always ends up sounding like a dalek or nothing at all - could you (or anyone) point me in the right direction as to how this could be done?
thanks
rob

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi rob,
since it's just a DAC there isn't much you can do to vary the playback volume without modifying playback resolution.
A nice way would be to use a PGA (programmable gain amplifier) at the output, after low passing and such things. You can do that with an specific IC or by using a digital potentiometer and an opamp.
Usually these devices are controlled by SPI but there are other interfaces too. I know microchip and linear provide such ICs

good luck,

carlos