Yep, application note AVR320 details SPI implementation.
EEPROM is great, but you don't want to write each volume change to it, as:
1) its slow
2) it has limited write operations
EEPROM is great, but you don't want to write each volume change to it, as:
1) its slow
2) it has limited write operations
Storing volume position.
You see .. her comes a company ... RAMTRON they make FERRORAM with nearly unlimited write cycles.. And they are pin compatible with 24C16 etc.
The price ?? the same as at24c16 from atmel or xicor or st or .. or ..
The homepage is http://www.ramtron.com
Isn't that nice.
🙂
The thing about storing position .. why not do this when the volume have been stable for ... let's say 1 sec. ?
Then it is fast. You don't need to store after each "click" on a rotary switch.
About solidstate switch .. If it has to have as little impact on the sound then the voltage has to be virtuel ground so it is only the current that changes. If you do that the on-resistance is as flat as possible. Check the datasheet. It is the same problem when you use TRIMDAC, Digital potentiometer or whatever they call them!
If they are used in series with the PGA or CS3310 then go for high quality relays.
Sonny
You see .. her comes a company ... RAMTRON they make FERRORAM with nearly unlimited write cycles.. And they are pin compatible with 24C16 etc.
The price ?? the same as at24c16 from atmel or xicor or st or .. or ..
The homepage is http://www.ramtron.com
Isn't that nice.
🙂
The thing about storing position .. why not do this when the volume have been stable for ... let's say 1 sec. ?
Then it is fast. You don't need to store after each "click" on a rotary switch.
About solidstate switch .. If it has to have as little impact on the sound then the voltage has to be virtuel ground so it is only the current that changes. If you do that the on-resistance is as flat as possible. Check the datasheet. It is the same problem when you use TRIMDAC, Digital potentiometer or whatever they call them!
If they are used in series with the PGA or CS3310 then go for high quality relays.
Sonny
Ya, well something has to be done to limit the amount of writes, an extra component isn't needed and just adds cost and complexity.
Even at 1 second, if the system is glitchy and accidently records a change every second. You'll evaporate the lifetime of the eeprom in 1 day.
Even at 1 second, if the system is glitchy and accidently records a change every second. You'll evaporate the lifetime of the eeprom in 1 day.
When i am writing programs i do insert a moving filter on my inputs.
You have to do this. I don't think that i will sound good when you transmit data to the PGA or CS3310 all the time just because you have noisy switches.
I think when you check companies who produce encoder (like bourns) then they want you to incorporate some kind of filter.
BOURNS say that they PEC12 has a contact bounce of ~ 5msec.
Sonny
You have to do this. I don't think that i will sound good when you transmit data to the PGA or CS3310 all the time just because you have noisy switches.
I think when you check companies who produce encoder (like bourns) then they want you to incorporate some kind of filter.
BOURNS say that they PEC12 has a contact bounce of ~ 5msec.
Sonny
Another method of storing the volume position would be to utilize a absolute reference control knob.
Thereby the volume position is stored physically in the control knob. This is nearly identical to a analog potentiometer solution and I think the easiest on all accounts.
Thereby the volume position is stored physically in the control knob. This is nearly identical to a analog potentiometer solution and I think the easiest on all accounts.
Storing volume setting
Typically, a powerfail interrupt can be used to store information before the micro dies from losing power. It requires a comparator of some kind on the input side of the power supply voltage regulator, or detection of the AC power input. The micro detects that it is about to lose power, so it stores the current volume setting in EEPROM (perhaps first checking if the current value is different than the stored value). All this is done while the power supply filter capacitor is keeping the micro running. This keeps the number of writes to a minimum.
This complication is why I was planning to use a standard linear potentiometer fed from a DC source as the means of setting volume. The setting, as ertyu says, is "stored" by the physical position of the knob. It requires an analog input on the micro, but most have one with probably 8-bit resolution, giving up to 255 possible volume settings.
Typically, a powerfail interrupt can be used to store information before the micro dies from losing power. It requires a comparator of some kind on the input side of the power supply voltage regulator, or detection of the AC power input. The micro detects that it is about to lose power, so it stores the current volume setting in EEPROM (perhaps first checking if the current value is different than the stored value). All this is done while the power supply filter capacitor is keeping the micro running. This keeps the number of writes to a minimum.
This complication is why I was planning to use a standard linear potentiometer fed from a DC source as the means of setting volume. The setting, as ertyu says, is "stored" by the physical position of the knob. It requires an analog input on the micro, but most have one with probably 8-bit resolution, giving up to 255 possible volume settings.
I was really thinking about a absolute reference rotary encoder, but to each his own.
The encoder is probably more expensive, but has direct digital output.
The encoder is probably more expensive, but has direct digital output.
Re: Storing volume setting
Not a bad approach at all. There should be enough time to store. Typical the EEprom uses about 10 msec. So after a powerfail the powersupply has to keep the uC alive for let's say 100msec. Then there should be enough time to store what is needed.
The thing about using a POT and a A/D converter .. mmmhh .. what if the value on the POT is standing between to values ... example : 100 and 101 and the noise from the uC or a bad layout is able to get it to pop between 100 and 101? Then your PGA2310 or CS3310 is also changing between those two values. It is as much as 0.5 dB on the PGA2310.
Sonny
paulb said:Typically, a powerfail interrupt can be used to store information before the micro dies from losing power. It requires a comparator of some kind on the input side of the power supply voltage regulator, or detection of the AC power input. The micro detects that it is about to lose power, so it stores the current volume setting in EEPROM (perhaps first checking if the current value is different than the stored value). All this is done while the power supply filter capacitor is keeping the micro running. This keeps the number of writes to a minimum.
This complication is why I was planning to use a standard linear potentiometer fed from a DC source as the means of setting volume. The setting, as ertyu says, is "stored" by the physical position of the knob. It requires an analog input on the micro, but most have one with probably 8-bit resolution, giving up to 255 possible volume settings.
Not a bad approach at all. There should be enough time to store. Typical the EEprom uses about 10 msec. So after a powerfail the powersupply has to keep the uC alive for let's say 100msec. Then there should be enough time to store what is needed.
The thing about using a POT and a A/D converter .. mmmhh .. what if the value on the POT is standing between to values ... example : 100 and 101 and the noise from the uC or a bad layout is able to get it to pop between 100 and 101? Then your PGA2310 or CS3310 is also changing between those two values. It is as much as 0.5 dB on the PGA2310.
Sonny
Re: Re: Storing volume setting
A combination of some analog filtering and some clever debouncing software on the micro, shouldn't be a problem. Good point, though, something to watch out for. I like the idea of the absolute position encoder, too, I didn't know such a thing existed.
sonnya said:...what if the value on the POT is standing between to values ... example : 100 and 101 and the noise from the uC or a bad layout is able to get it to pop between 100 and 101? Then your PGA2310 or CS3310 is also changing between those two values. It is as much as 0.5 dB on the PGA2310.
Sonny [/B]
A combination of some analog filtering and some clever debouncing software on the micro, shouldn't be a problem. Good point, though, something to watch out for. I like the idea of the absolute position encoder, too, I didn't know such a thing existed.
I just posted the code I mentioned earlier for the AVR8515 which I received from a person in Germany. I tried to get his permission but the email bounces (it's been at least a year). It also contains some RC-5 remote control stuff as well.
The text files are his email. The asm file is the actual code.
http://www.enteract.com/~mlloyd1/audio/mdac-volume-control/
Anybody have code for the rotary encoder to AVR?
Michael
The text files are his email. The asm file is the actual code.
http://www.enteract.com/~mlloyd1/audio/mdac-volume-control/
Anybody have code for the rotary encoder to AVR?
Michael
If we are going to use a display like he did in his code, we could make a table with text in different language who is easy to change.
Sonny
Sonny
ertyu said:I was really thinking about a absolute reference rotary encoder, but to each his own.
The encoder is probably more expensive, but has direct digital output.
ertyu, where would I find an example of such a device? Does it provide "absolute" setting data somehow? I thought encoders only provided deltas, meaning that the micro has to keep track of the absolute position.
Here are some examples of absolute rotary encoders:
http://www.cuistack.com/encoders/encd_absolute.htm
http://www.bourns.com/pdf/ACE.pdf
The CuiStack part provides full 8 bit resolution, which matches the PGA2310 resolution.
The Bourns device has 7 bit resolution, so which would work out to 1dB resolution on the PGA2310.
These provide an absolute reference to the current position, the device itself is much more complicated, but it makes integration so much easier.
http://www.cuistack.com/encoders/encd_absolute.htm
http://www.bourns.com/pdf/ACE.pdf
The CuiStack part provides full 8 bit resolution, which matches the PGA2310 resolution.
The Bourns device has 7 bit resolution, so which would work out to 1dB resolution on the PGA2310.
These provide an absolute reference to the current position, the device itself is much more complicated, but it makes integration so much easier.
Got a quote on the CuiStack part, $240 qty 1.
Yikes, guess thats out. Can get a free sample of the bourns part though.
Yikes, guess thats out. Can get a free sample of the bourns part though.
Whoa, those things are cool. But, at least for the Bourns, it doesn't look like there are any stops to keep somebody from rotating it back through 0, so you'd jump from minimum to maximum volume!
I'll bet the Bourns is pricey too. Oh well, back to analog.
I'll bet the Bourns is pricey too. Oh well, back to analog.
On the bourns you can get it with the stop, I think thats the most common config.
I ordered a sample, we'll see how it goes.
I ordered a sample, we'll see how it goes.
<b>About an absolute position encoder</b>
I think the use of an absolute position encoder limits flexibility a bit, for example in case if you wanted to make the amp remote controllable. Suppose, you had set the volume to some level using the absolute pos. encoder and then changed the volume with the remote controller. Then you would have the absolute pos. encoder and the device volume level "out of sync". So, in that case, you probably should use an incremental encoder or you should make the absolute pos. encoder motor driven.
Another "minus" with the absolute pos. encoder is, that it uses more microcontroller pins than an incremental encoder. This only matters of course if you are about to run out of the pins.
You may do as you think is the best, that's the freedom of DIY:ing and that's good. 🙂
Janne
I think the use of an absolute position encoder limits flexibility a bit, for example in case if you wanted to make the amp remote controllable. Suppose, you had set the volume to some level using the absolute pos. encoder and then changed the volume with the remote controller. Then you would have the absolute pos. encoder and the device volume level "out of sync". So, in that case, you probably should use an incremental encoder or you should make the absolute pos. encoder motor driven.
Another "minus" with the absolute pos. encoder is, that it uses more microcontroller pins than an incremental encoder. This only matters of course if you are about to run out of the pins.
You may do as you think is the best, that's the freedom of DIY:ing and that's good. 🙂
Janne
I agree, it's not practical if you have a remote volume control (my system won't). With a remote, I'd probably go with a display and default to a presettable value on startup, which keeps things simple.
Doh, your right, I forgot to take that into consideration.
Motorized is hard to find, well, absolute is hard to find.
Back to the good old incremental encoder.
Just ends up with a lot of things to "poll" on the micro.
Motorized is hard to find, well, absolute is hard to find.
Back to the good old incremental encoder.
Just ends up with a lot of things to "poll" on the micro.
PGA Eval Board still vaporware ...
For those that are interested, this is the response I got to a query about availability of the PGA2310 Eval Board:
Mr Lloyd,
Thank You for contacting the Texas Instruments Product Information Center. I contacted a person in the Amplifier Group and was informed that the EVM for the PGA2310 is not yet available. Though I was not given a timeframe, I am told that it will be released in the near future. I also forwarded your name and information to the group, as they requested. So, they may have contacted you or will contact you when it becomes available. If you would like to check periodically, the Marketing number is 800-477-8924. This is the number that you would call to place the order. They will not know the direct status but will be able to tell you if it is available.
If you have any other questions or concerns, feel free in giving us a call.
Thanks and Regards
Douglas Helm
Sr Product Information Specialist
E-mail : support@ti.com
Product Information Center
972-644-5580
For those that are interested, this is the response I got to a query about availability of the PGA2310 Eval Board:
Mr Lloyd,
Thank You for contacting the Texas Instruments Product Information Center. I contacted a person in the Amplifier Group and was informed that the EVM for the PGA2310 is not yet available. Though I was not given a timeframe, I am told that it will be released in the near future. I also forwarded your name and information to the group, as they requested. So, they may have contacted you or will contact you when it becomes available. If you would like to check periodically, the Marketing number is 800-477-8924. This is the number that you would call to place the order. They will not know the direct status but will be able to tell you if it is available.
If you have any other questions or concerns, feel free in giving us a call.
Thanks and Regards
Douglas Helm
Sr Product Information Specialist
E-mail : support@ti.com
Product Information Center
972-644-5580
- Home
- Amplifiers
- Solid State
- PGA2310 Digital Volume Control