Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Message

Re: [AVR-Chat] PWM based audio

2012-08-05 by Jim Wagner

Register structure is similar and consistent, but not identical among devices. Within a single family (example Mega48/88/168/328) it will be, with very few exceptions, identical. Not so when you make larger jumps. 

Another example, AVRs with a single UART used to name the data register UDR. Then, came chips with more than one UART, and they were named UDR0 and UDR1. Now, all the newer chips with a single UART have data register UDR0. 

Jim Wagner
Oregon Research Electronics

On Aug 4, 2012, at 5:57 PM, englsprogeny1 wrote:

> Hi guys,
> 
> I want to start including audio in my projects a bit more. So far I've designed using MP3 modules that I purchased on EBAY. I now want to design using the AVR's 16 bit PWM to create audio.
> 
> I've found a project that does this:
> 
> http://elm-chan.org/works/sd20p/report.html
> 
> When I download and build the 'firmware' found at:
> http://elm-chan.org/works/sd20p/sdsg.zip
> 
> Everything builds ok.
> 
> Unfortunately when I change the processor from attiny861
> to an attiny2313 (in the makefile) the build does not work.
> 
> ### Target device
> #DEVICE = attiny861
> DEVICE = attiny2313
> 
> Build results:
> 
> main.c :
> avr-gcc -c -std=gnu89 -gdwarf-2 -mmcu=attiny2313 -Os -mcall-prologues -Wall -Wextra -DF_CPU=16000000UL -DMODE=2 -Wp,-M,-MP,-MT,obj_hr/main.o,-MF,obj_hr/main.d main.c -o obj_hr/main.o
> main.c: In function 'chk_input':
> main.c:93: error: 'GIFR' undeclared (first use in this function)
> main.c:93: error: (Each undeclared identifier is reported only once
> main.c:93: error: for each function it appears in.)
> main.c: In function 'audio_on':
> main.c:135: error: 'PLLCSR' undeclared (first use in this function)
> main.c: In function 'wait_status':
> main.c:178: error: 'PCIE1' undeclared (first use in this function)
> main.c:179: error: 'WDTCR' undeclared (first use in this function)
> main.c: In function 'main':
> main.c:339: error: 'WDTCR' undeclared (first use in this function)
> main.c:341: error: 'PCMSK0' undeclared (first use in this function)
> main.c:342: error: 'PCMSK1' undeclared (first use in this function)
> make.exe: *** [obj_hr/main.o] Error 1
> 
> > Process Exit Code: 2
> > Time Taken: 00:01
> 
> ----------------------------------------------
> 
> Looking at the datasheet for the attiny2313 I don't see the GIFR (register) and others listed above. I thought that the register structure for all AVRs would be the same or at least the same within the 'tiny_xx' versions. 
> 
> When I change the processor to an atmega8
> I get different issues with the build. It points to the assembly file within this project. I thought that assembly was the same across all AVR processors.
> 
> Thanks for any input.
> 
> I'm not stuck with implementing this project using the source that I found above (If anyone has any other suggestions).
> 
> 



[Non-text portions of this message have been removed]

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.