2009-08-18 11:04:11     High Resolution Timers

Document created by Aaronwu Employee on Aug 16, 2013
Version 1Show Document
  • View in full screen mode

2009-08-18 11:04:11     High Resolution Timers

Matthew Barousse (UNITED STATES)

Message: 78999   

 

Hi all. I have followed the timer_test module example and have that working. We need to sample from our ADC at a sample rate of about 100 kHz, and have that acurately timed. I was going to use a system timer to drop the sync line to initiate conversion, and then have SPORT read in the value before the next sample.

 

It seems, however, the fastest the system will let me sample at (via kernel config, system timer tick) is 1000Hz. Is there a way to trigger the timer on a unit faster than a jiffy? I read about high resolution timer support, but I could not find enough information on that to get me anywhere. Is there another method people normally use to get accuracy and samples at this speed?

 

Any advice or push in the right direction would be wonderfull.

 

Thanks alot,

Matt

QuoteReplyEditDelete

 

 

2009-08-18 11:18:34     High Resolution Timers

Michael Hennerich (GERMANY)

Message: 79000    Typically people use the SPORT with internal generated clock and frame

syncs for periodic transfers.

Please consult the Blackfin Peripheral Hardware Reference Manual for

more information.

 

Just in case the SPORT alone doesn't provide what you need - you can

alternatively use Blackfin Hardware Timers in PWM Output mode to

generate Sync signals.

 

-Michael

QuoteReplyEditDelete

 

 

2009-08-18 12:05:14     Re: High Resolution Timers

Matthew Barousse (UNITED STATES)

Message: 79002   

 

Thanks for the reply. Sorry I wasn't very clear on our application. The reason we're triggering the sync's using a GPIO is because the system we're working on is a Software Defined Radio. We need to have both I and Q data (two ADCs) for the same instant in time. I drop the sync for both simultaneously, they convert, then I read in one after another.

 

I tried writing a simple userspace program to read from SPORT using the provided driver, but the fastest it will operate is about 100Hz, which is where I'm currently stuck. I suppose my problem isn't really with timers, but in getting SPORT to read faster.

QuoteReplyEditDelete

 

 

2009-08-18 12:16:11     Re: High Resolution Timers

Michael Hennerich (GERMANY)

Message: 79005    For your SDR - I would use the sound driver layer.

Use a Multichannel Sound Codec/ADC with TDM or I2S interface. Connect I

and Q to the same CODEC and sample with 100KHz.

Then you simply read IQ which would be just like STEREO left and right

channel.

 

The Blackfin I2C or TDM drivers will do all the DMA etc. for you.

 

73 de DL6SEG

 

-Michael

QuoteReplyEditDelete

 

 

2009-08-18 12:53:49     Re: High Resolution Timers

Matthew Barousse (UNITED STATES)

Message: 79007   

 

Thanks alot for the help. I never realized I could utilize the audio system like that. Unfortunately we're on a university budget, so we probably can't afford to order a different ADC and DAC, much less the protoboards for them anytime soon. The ones we are currently working with are SPORT compatible, so that's why we're using them in this way.

 

That method sounds prommising, though. The ADCs and DACs we have currently support SPI. Would that work with the TDM method you described?

 

-Matthew

KE5VYM

QuoteReplyEditDelete

 

 

2009-08-18 16:12:23     Re: High Resolution Timers

Michael Hennerich (GERMANY)

Message: 79011    I strongly recommend using the audio layer for your purposes - It's the

least painful way, since almost everything you need is sanely

implemented.

 

If you like to implement a streaming interface your own, it's up to you.

You definitely need to use SPORT DMA - in addition you need to use HW

generated framesync.

Incase you want to use two separate ADC devices, then use a single SPORT

Primary and Secondary Channels.

(Framesync and Clocks are routed to both ADC only dedicated Serial Data

Strobes per Channel)

 

-Michael

QuoteReplyEditDelete

 

 

2009-08-19 10:12:52     Re: High Resolution Timers

Matthew Barousse (UNITED STATES)

Message: 79057   

 

We might be able to get a new codec. The device we're looking at is the ADAU1361. This codec supports I2S mode. How hard do you think it would be to modify the audio system in the kernel to work with this chip? I suppose I would need to start with a driver utilizing SPORT, but I'm not 100% sure of the steps that would be involved.

 

Thanks again for the help.

Matt

QuoteReplyEditDelete

 

 

2009-08-19 10:58:43     Re: High Resolution Timers

Michael Hennerich (GERMANY)

Message: 79060    It's actually quite simple -

I would start by modify

linux-2.6.x/sound/soc/codecs/ssm2603.c

for the DAU1362.

-Michael

QuoteReplyEditDelete

 

 

2009-08-19 11:23:09     Re: High Resolution Timers

Matthew Barousse (UNITED STATES)

Message: 79061   

 

Fantastic. I found the project website for the Alsa SoC Layer, which I didn't know exsisted. I'm excited, as they seem to have a good development comunity and resources, so getting a working driver for this chip shouldn't be too bad. This is very interesting and greatly simplifies what we were trying to do. Thanks alot!

 

Matthew

Attachments

    Outcomes