Forum

Please consider registering
guest

Log In Register

Register | Lost password?
Advanced Search

— Forum Scope —

  

— Match —

   

— Forum Options —

   

Minimum search word length is 4 characters - maximum search word length is 84 characters

Topic RSS
ADC programming for audio applications / free running mode
2020 年 02 月 14 日
00:41:40
ray_1
New Member
Forum Posts: 3
Member Since:
2017 年 10 月 15 日
Offline

I read that analogRead() takes up to 15us. I've also taken a look into the analogRead() implementation in wiring_analog.cpp and I can see that the CPU is essentially stalled until (io_inpb(BaseAddress + 2) & 0x01) != 0 / timeout...that's really bad news especially in the case of audio applications, e.g. reading 2 channels of audio at 31kHz sampling rate would already eat away all available CPU, which seems ridiculous for a 300Mhz i586 system.

Is there a way to perform DMA or at least set free running ADC mode at the expense of accuracy as it's the case on the Arduino in order to achieve better performance? How would I go about that?

Thanks.

2020 年 02 月 18 日
11:37:28
Android_Lin
Moderator
Forum Posts: 226
Member Since:
2014 年 04 月 01 日
Offline

Hi, ray_1,

Sorry to tell you, no ADC DMA in Vortex86EX CPU, but if the method of the expense of accuracy is acceptable for you, we can comment the below code to avoid waiting ADC hardware in the wiring_analog.cpp :
=======================================================
// for(t=timer_NowTime();(io_inpb(BaseAddress + 2) & 0x01) == 0;)
// {
// if((timer_NowTime() - t) >= 1000L)
// {
// io_RestoreINT();
// return 0xffff;
// }
// }
=======================================================

It will improve performance distinctly. (Note: This will have the expense of accuracy, maybe get the old value)

Forum Timezone: Asia/Taipei

Most Users Ever Online: 229

Currently Online:
5 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Dinosaur: 27

leutenecker: 13

mrZagg: 10

hippy: 9

smeezekitty: 8

lukeross: 8

tomka: 8

Ekkehard: 8

UIdahoCIT: 8

blaxxun: 7

Member Stats:

Guest Posters: 0

Members: 1560

Moderators: 15

Admins: 5

Forum Stats:

Groups: 2

Forums: 11

Topics: 247

Posts: 1107

Newest Members: Albert, david, line04389, cannylin, Merkiseept, physics, yoseywalk, lendice, nicole, weitin

Moderators: Glaux: 70, uaa: 11, guigra: 17, asian55: 22, Android_Lin: 226, bcarroll: 12, cucubutter: 84, recycled-air: 12, stevemork: 16, zerozaber: 52, pongraczi: 24, jejump: 11, George Andrews III: 56, poto: 11, garpastym: 20

Administrators: eveshih: 1, anthony: 31, viky6: 0, roboard: 135, hcl: 1