Reducing DAC jitter
Hi,
I'm writing data to a 24 bit register of an AD5664 DAC from an STM32F429 discovery board which I am using to produce sinewaves and slower sawtooth ramps. The full loop lasts approximately 200000 bytes which gives sufficient resolution over all waveforms.
At the moment I am getting quite a lot of jitter on the sinewaves of about 2.5hz at approx 400Hz sinewave frequency. Ideally I'd like below 0.1Hz if possible via this method.
I have streamlined the loop to be as small as possible but the jitter is still similar to my previous much longer loop. I've tried HAL_SPI_Transmit, HAL_SPI_Transmit_IT which was too slow to reach 400Hz, DMA didn't produce data that worked with the DAC for some reason. I'm not sure it would help much though. I've stripped quite a lot of code out from the HAL_SPI_Transmit function which has greatly increased my effective resolution for a given freq, but not so much the jitter. I also tried using a one pulse timer for the NSS/SYNC line but it actually seemed to perform worse.
Is there a way to reduce the jitter further? I understand there will be quite a large number of instruction cycles involved so perhaps I am quite close to what can be achieved for a relatively complex operation.
for(p=0;p<200000;p+=3)
{
GPIOG->BSRR = 0x10000000; // NSS/SYNC low
//if (hspi1.State != HAL_SPI_STATE_BUSY_RX) //Commented out as working without
HAL_SPI_Transmit(&hspi1,&first[p],3,0); // Send a 24 bit packet as 3x8 bytes
GPIOG->BSRR = 0x1000; // NSS/SYNC high
**Accurate 15uS delay code here**
}I need to change between different modes where the sinewave DAC channel changes to a sawtooth, etc which is why I'm not just smoothing out square waves or using an external generator IC. Any help would be greatly appreciated.
Thanks,
