[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4756: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3891)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4758: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3891)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4759: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3891)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4760: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3891)
Open Music Labs Forums • View topic - DAC in Audio Codec Shield

DAC in Audio Codec Shield

Re: DAC in Audio Codec Shield

Postby guest » Sun Sep 23, 2012 12:57 pm

answers to your points above:

0. in needs to go to L_IN, at the solder pad, which is what it looks like you have. this bypasses the analog high-pass filter. you also need to set ADCHPD 1 in the code, which the example above does. this shuts off the digital high-pass filter on the codec.

1. with the code above, you no longer use loop(), so this shouldnt be a problem. the ISR is called automatically, at a rate set by SAMPLE_RATE. i would reccomend setting SAMPLE_RATE to the lowest value you can get away with. this will give you maximum processing time.

2. the codec on the shield can theoretically go to 24bit, but the noise level in the codec isnt much better than 16b, and your signal will probably not be any better than that as well, so to go to 24b would just make things more complicated for very little gain. also, the codecshield library isnt setup to handle 24b numbers. so some new functions would need to be written.

1. the values are int because they are 16b signed numbers coming out of the codec. that is how the codec produces the data

2. the ADC that is being referred to in the read_me is on the arduino, not the codec. so the arduino ADC is limited to 10b, but the codec ADC is 16b.

3. i would reccomend using the interrupt, as it will keep the timing better, give more processing time, and you wont have to worry if your variables are getting clobbered during the interrupt. the interrupt is required for the codec to operate. if you need to do some things in the main loop, let me know, and i can help with that. it is a bit complicated, as you need to declare some variables volatile, and then disable interrupts while certain variables are being altered. its a bit of a pain, and should be avoided.
guest
Site Admin
 
Posts: 449
Joined: Thu May 20, 2010 11:58 pm

Re: DAC in Audio Codec Shield

Postby vickyjungade » Wed Sep 26, 2012 6:24 am

vickyjungade
 
Posts: 6
Joined: Tue Sep 18, 2012 3:33 am
Location: Dombivli, Mumbai, Maharashtra, India

Re: DAC in Audio Codec Shield

Postby guest » Wed Sep 26, 2012 9:52 am

digitalwrite() takes a really long time.

in setup() put this line:
DDRD |= 0x4; // sets pin2 to output

then replace digitalwrite with:
PORTD = (PORTD & 0x04) ^ PORTD; // toggles pin2
guest
Site Admin
 
Posts: 449
Joined: Thu May 20, 2010 11:58 pm

Re: DAC in Audio Codec Shield

Postby vickyjungade » Mon Oct 01, 2012 8:44 am

vickyjungade
 
Posts: 6
Joined: Tue Sep 18, 2012 3:33 am
Location: Dombivli, Mumbai, Maharashtra, India

Re: DAC in Audio Codec Shield

Postby guest » Mon Oct 01, 2012 12:06 pm

audiocodec_init() kills the delay timer. the codec needs to be run at a very consistent timing interval, or it stops sending data, and the delay timer messes with this. so you cant use delay(). this is also why audiocodec_data() needs to be in the ISR. another thing, is that variables altered in the ISR need to be declared as "volatile", otherwise the compiler doesnt know its being changed. this is probably the main thing thats causing trouble.
guest
Site Admin
 
Posts: 449
Joined: Thu May 20, 2010 11:58 pm

Re: DAC in Audio Codec Shield

Postby vickyjungade » Tue Oct 02, 2012 11:17 pm

vickyjungade
 
Posts: 6
Joined: Tue Sep 18, 2012 3:33 am
Location: Dombivli, Mumbai, Maharashtra, India

Re: DAC in Audio Codec Shield

Postby guest » Wed Oct 03, 2012 2:40 pm

guest
Site Admin
 
Posts: 449
Joined: Thu May 20, 2010 11:58 pm

Re: DAC in Audio Codec Shield

Postby liner » Wed May 14, 2014 6:02 am

Hi,

I would like to use the ADC on the board and also the DAC, similarly to what has been here reported. The problem that I am facing is that I am not able to read signals from 0 to 3.3 V but rather from 250 mV to 3V. Any ideas why? and how to solve this?
I do not see why I can't read signals below 250mV if the resolution should be more than enough (16 bits)

Thanks for your time.
liner
 
Posts: 6
Joined: Fri Jun 29, 2012 2:11 am

Re: DAC in Audio Codec Shield

Postby guest » Wed May 14, 2014 4:10 pm

interesting. ive never measured the actual DC input range of the DAC or ADC. it might be that the internal opamps are not rail-to-rail, so those last values are truncated. it might be possible to reduce your input signal, so that a 0-3.3V signal gets shrunk to 1v-2.5v or so, and therefore fits in the range.

what is your test setup? how are you applying the singal, measuring the input voltage, and measuring the output values?
guest
Site Admin
 
Posts: 449
Joined: Thu May 20, 2010 11:58 pm

Re: DAC in Audio Codec Shield

Postby liner » Thu May 15, 2014 1:42 am

Hi,

Thanks for your answer. Do you have any suggestions in doing that shrink on my input signal?

In a summary, I would like to have an analogue input, read it and according to it adjust the output signal from the DAC. So, what I have done so far is to read the analog signal using the IN pins provided by the Audio Codec Shield and if the voltage is below 250 mV the read value is always the same. Only when going above 250 mV it starts to change.
liner
 
Posts: 6
Joined: Fri Jun 29, 2012 2:11 am

PreviousNext

Return to Audio Codec Shield

Who is online

Users browsing this forum: Bing [Bot] and 1 guest


cron