Jump to content

Low jitter, µs accurate clock source


 Share

Recommended Posts

Hi!

 

For my current project, I need to output a whole lot of analog audio signals from a STM32F4 core. I can't use I2S - it has too few channels. Instead, I want to hook up a chain of DACs to an SPI pin and supply them with their new values from a task in the software. For this I need a stable timing reference that is capable of calling a callback function with at least 40kHz. The sample rate can be changed accordingly - I don't rely on exactly 44,1kHz or anything like that.

 

Now I wonder, what to use as a timing reference. AFAIK, the MIOS32 timers are µs-accurate, but I wonder if they are stable = have low jitter.

If not, what else could I use as a timing reference?

 

Thanks

The Slow Growth

Link to comment
Share on other sites

Hi,

 

the MIOS32 timers are the best choice for this purpose.

You won't notice jitter if the priority is set to MIOS32_IRQ_PRIO_HIGHEST

This means, that no other interrupt routine could affect the execution time.

 

Best Regards, Thorsten.

Link to comment
Share on other sites

Okay, thats good news.

 

One more question: During one timer callback I have to make multiple SPI transmissions. It is not a good idea to program a task with the highest possible priority that blocks until the hardware is ready for the next transmission. Unfortunately the DMA callback runs at a lower priority (MIOS32_IRQ_PRIO_HIGH) and might be interrupted by other hardware tasks with the same settings, which then causes jitter for the following SPI transmissions to the DAC.

 

I see two possible solutions for this:

 

A)

Let the callback run at MIOS32_IRQ_PRIO_HIGHEST. (How can I do this, it seems to be hard coded in MIOS32?)

 

B)

Suspend the timer task once it has started the DMA and resume it, once the DMA is ready. The problem is, that I need a highest- priority callback for this as well...

 

It would be cool, if the SPI functions could suspend the task they came from when no callback is supplied. Right now, they just block with a while() loop.

 

What would you do?

Thanks you for your help!

Edited by TheSlowGrowth
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...