Xplain sounds [semi-solved]

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

According to AVR1907:

Quote:
The preprogrammed firmware in the ATxmega128A1 runs a demo application where
sounds/tunes are played when the buttons are pushed.
I have reinstalled the original firmware and the only things that happens at power up is that there is a short softish screech from the speaker, leds 5, 6 and 7 light up.

After about 5 seconds leds 5 and 7 go out and led 5 stays on.

No matter which button I push nothing else happens.

Have I been robbed of music? :shock:

Just in case it matters the bootloader has been zapped.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

Last Edited: Tue. Nov 13, 2012 - 11:41 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Does that board have some kind of secondary storage (AT45 perhaps)? If so could it be that is where any sound data lived?

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

I have removed the bootloader and installed the demo app on an XMEGA-A1 Xplained and that works fine, although this was done by building the demo app in AS6, not using a pre-built HEX file.

I don't have an XMEGA Xplain to test. Are you loading the correct demo app (Xplain vs Xplained) for the board you have?

Gamu The Killer Narwhal
Portland, OR, US
_________________
Atmel Studio 6.2
Windows 8.1 Pro
Xplained boards mostly

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

I'm using the firmware which comes with AVR1907 for the revision 2 Xplain board "ATxmega128A1.hex".
Also tried the newer version for revision 2 and above with the same results.

Quote:
I don't have an XMEGA Xplain to test.
Post the hex file and I'll test it for you. :-)

There is no source file with AVR1907 for me to rebuild, and yes I did try to find it on the Atmel's site but, as usual, I gave up.

A search for AVR1907 brings up 52 results, the 1st one has a link to "Download Software", which sounded promising, but it only contains the PDF and hex files.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

Just to clear up things (I think..):

The board is a Green Xplain board, it has a Rev 2 sticker but it seems that it is in fact a Rev 4 of a Rev 2 PCB if that makes sense.

According to the latest AVR1907

Quote:
Revision 4 of the Xplain kit can be identified by a bar-code sticker on the back side
with the following product ID: A09-0560/4.
which is what my board has.

So I have loaded up the revision 2 and above ATxmega128A1.hex".

The initial sound at power up is like that of a drunken galah with laringitis but nothing else after the leds change as above.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

Having modified the Xplain board to get the audio signal out into a decent amplifier and speaker set I must say that "I'm suitably amused" by the quality of the drum roll sound. :-)

Unfortunately I still have to either power down the board or short out the reset line in order to get the sound, none of the switches do anything as far as I can tell.

If there is in fact a source file to the firmware I wouldn't mind getting a hold of it.

I have connected the ground for the audio to another pin soldered at the side of the USB connector but I guess the GND pin from the JATG header would also do.

In my case I have a PDI to JTAG adaptor plugged in.

EDIT If the source file could be changed to use PORTA DACs (instead of or as well as) then the mod would not be necessary.

EDIT 2 Removed picture of audio output mod as the pin can short out to the inside layers.

A better option would be to solder a pin to one of the speaker's dummy pins and then solder a cap between it and one of the live speaker pins.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

Last Edited: Mon. Nov 12, 2012 - 01:08 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Attached are zipped up AS6 projects/solutions for both boards. The HEX file is a couple of layers down in the Debug folder.

Attachment(s): 

Gamu The Killer Narwhal
Portland, OR, US
_________________
Atmel Studio 6.2
Windows 8.1 Pro
Xplained boards mostly

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

Thank you. I'll look into this a bit more later on.

Programming the hex files I can get the pretty leds doing "something" but no sounds.

Maybe it has to do with the amplifier needing to be turned on, newer version of the board seem to have the amplifier hardwired on.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

I've not looked at the newer version's schematics.

I do recall, however, that the original Xmega Xplain had a mute pin on the audio amp chip.

I also recall that the turn on time after unmuting the amp was much longer than desired, and that without the mute on, with a reasonable volume, there was a lot of background digital noise. I think that is part of the reason for the subsequent revisions to the board.

JC

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

So it seems that my speaker may be physically damaged, I have replaced it with an old pocket pager speaker and the sound is a LITTLE better.

Still not much better even with an external 2" speaker but a lot better with decent extenal amp and largish speakers.

The original "audio out" pin mod wasn't a good idea as the pin would at times short out to internal ground layers?? I have removed the picture and added a possible better solution.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

Now we have decent sound, the audio output is taken from a speaker lead via a 1.5uF cap and the dummy speaker lead serves as anchor for the pin.

The current setup with a "misterious" :roll: US made PDI programmer attached...

Attachment(s): 

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

So John, how good are you at basket weaving?

The absence of a PDI Header on the Xplain PCB is frustrating for those without a JTAG programmer, but one can make a custom Ribbon Cable which one can then use with the STK600, Dragon, AVR ISP MkII, or other custom programmers.

So much for a totally awesome "out of the box" experience. (So close, but missed the mark.) But I guess if Atmel created the PDI Standard then Atmel can break away from it when they choose to do so.

JC

Attachment(s): 

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

Quote:
how good are you at basket weaving?
Lots of experience with that at the clinic... :)

I have made a JTAG to PDI pins adaptor for the Xplain as I have been using the 4 JTAG pins as control pins for a GLCD.
I guess I could also make a ISP/PDI to Xplain PDI adaptor but the single wire connectors work well.

Attachment(s): 

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

There is what seem to be a compiler bug with the XPLAIN_DEMO.zip and the Fanfare sound (PB3).

As it was only half of the sound is correct then it seem to go into lala land, by moving the look up table for snd_fanfare at the beginning of snd_samples.h then the sound is correct.

I guess no one would have noticed with the c.....y speaker on the board, all sounds are screachy. :-)

The sounds associated with PB5,6 and 7 are also suspicious but maybe correct.

Is it possible that the compiler is wrapping around after the 64K limit and the look up tables are messed up?

Can anyone try this out?

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

Quote:

Is it possible that the compiler is wrapping around after the 64K limit and the look up tables are messed up?

If so it's not a compiler bug - it's a usage bug. The programmer should have known that AVR pointers are only 16bit and can only address 64K. If the data was larger they should have programmed for this (by controlling the 24 bit extension register beyond the boundary).

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

From sound.c:

static inline uint8_t sound_get_8_bit_sample(uint32_t snd_ptr,
		uint16_t smpl_cnt)
{
	flash_addr_t address = snd_ptr + smpl_cnt * sizeof(uint8_t);
	uint8_t val = nvm_flash_read_byte(address);

	return val;
}

While snd_ptr is 32-bits, flash_addr_t is an alias for uint16_t, so address is only 16-bits.

From nvm.h:

static inline uint8_t nvm_flash_read_byte(flash_addr_t addr)
{
	return pgm_read_byte_far(addr);
}

While nvm_flash_read_byte() uses pgm_read_byte_far(), which I'm assuming uses 24-bit addressing, the addr parameter is again 16-bits.

EDIT:

Changing this:

typedef uint16_t flash_addr_t;

to

typedef uint32_t flash_addr_t;

may be all that is necessary. I don't know where the typedef is occurring.

Gamu The Killer Narwhal
Portland, OR, US
_________________
Atmel Studio 6.2
Windows 8.1 Pro
Xplained boards mostly

Last Edited: Wed. Nov 14, 2012 - 09:02 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

All double dutch! :-) is it easily fixable?

And how could Atmel relase such an important bit of code without testing it.... :lol:

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

Quote:
is it easily fixable?

Changing this:

typedef uint16_t flash_addr_t;

to

typedef uint32_t flash_addr_t;

may be all that is necessary. I don't know where the typedef is occurring.

Gamu The Killer Narwhal
Portland, OR, US
_________________
Atmel Studio 6.2
Windows 8.1 Pro
Xplained boards mostly

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

OK may try it later on today if I get some spare time.

edit just added up the tables and it's about 118K if all the 10 sounds are used which looks like they may be.

The table I moved from the bottom to the top of the tables is 28672 bytes.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

Quote:

I have made a JTAG to PDI pins adaptor for the Xplain as I have been using the 4 JTAG pins as control pins for a GLCD.

Hello John Samperi

I have the XMEGA-A1-XPLAINED and would like to experiment with a GLCD. Would you let me know what GLCD you are using?

Thank you,

Jerry

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

I have used Kentec 3.5" and 7" types with the Xmega. I tried the Xmega with the 7" display as it gets a bit sluggish at 8MHz.

http://au.element14.com/jsp/sear...

The 7" version I have has the controller at the back and while the part number is almost the same, except that mine has a single F rather than FF, the one shown doesn't seem to have the controller on board.

The 3.5" is the same.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

In nvm.h we find

/**
 * Data type for holding flash memory addresses.
 *
 */
#if (FLASH_SIZE >= 0x10000UL) // Note: Xmega with 64KB of flash have 4KB boot flash
typedef uint32_t flash_addr_t;
#else
typedef uint16_t flash_addr_t;
#endif

so it looks like it must be a uint32_t as the FLASH_SIZE is greater than 10K.

Back to square one? :?

EDIT OF course the above is just Xplain nonsense as the smallest Xmega is 16K so it will ALWAYS be typedef uint32_t flash_addr_t; or are they holding back on the 8K Xmegas? :roll:

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

John, thank you very much for the info.

Jerry

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

js wrote:
EDIT OF course the above is just Xplain nonsense as the smallest Xmega is 16K so it will ALWAYS be typedef uint32_t flash_addr_t; or are they holding back on the 8K Xmegas? :roll:

0x10000UL is 64k, not 10k.

Jeff Nichols

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

:oops: so maybe we will be getting 8K Xmegas in the new 32 pin E devices anyway.. :)

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

I used the Electronic Assembly DOGM128x6 ("x" denotes color). 128x64 pixels, easy SPI interface, on-board charge pump/booster/regulator for generating all the necessary voltages from a 3.3V supply, and only $18 from Mouser.

Gamu The Killer Narwhal
Portland, OR, US
_________________
Atmel Studio 6.2
Windows 8.1 Pro
Xplained boards mostly

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

js wrote:

Just to clear up things (I think..):

The board is a Green Xplain board, it has a Rev 2 sticker but it seems that it is in fact a Rev 4 of a Rev 2 PCB if that makes sense.

According to the latest AVR1907

Quote:

Revision 4 of the Xplain kit can be identified by a bar-code sticker on the back side
with the following product ID: A09-0560/4.

which is what my board has.

 

So I have loaded up the revision 2 and above ATxmega128A1.hex".

The initial sound at power up is like that of a drunken galah with laringitis but nothing else after the leds change as above.

I've also applied Revision 4. Work situation is similar to you.