• 0
Mingfei

Changing data rate of Pmod AD5

Question

Hi everyone,

I'm using Pmod AD5 on PYNQ Z1 board. I used the demo code and it works fine. I'm wondering if I can change the data rate of Pmod AD5? By default it is about 6 samples per second and I want to change it to about 50. I checked the AD7193 datasheet and it says the last 10 bits of mode registers control the data rate (FS[0] to FS[9]). I found a function in demo code called "AD5_WriteConfig(PmodAD5* InstancePtr)" . Can I ask that should I change values in Bytes[3] to change data rate? Since I tried some numbers in Bytes[3], it doesn't work.

Function:

image.png.746c1710655c189b7b2a3fbe1ae1d7df.png

Datasheet:

image.png.0413ce0be487f05fe57547e352864cee.pngimage.png.d76bb19a1cf267caeac7e03584153331.png

 

Thank you for your help

Mingfei

Share this post


Link to post
Share on other sites

3 answers to this question

Recommended Posts

  • 0

Hi @Mingfei,

Sorry for the delay, to write to the mode register you would want to add an additional XSpi_Transfer in the AD5_WriteConfig

something like this:

void AD5_WriteConfig(PmodAD5* InstancePtr)

{

u8 bytes[4];

bytes[0] = 0x08; //first byte is sent to the communication register which sets communication to

//writing the next 3 bytes to the mode register

//then configure the mode register how you would like it (page 24 of the datasheet)

bytes[1] = 0x00;// you decide mode register configuration

bytes[2] = 0x00;//you decide mode register configuration

bytes[3] = 0x00;//you decide mode register configuration

 

XSpi_Transfer(&InstancePtr->AD5Spi, bytes, bytes, 4);

 

bytes[0] = 0x10; //first byte is sent to the communication register which sets communication to

//writing the next 3 bytes to the Configuration register

//gain is set to 1 and in differential mode

bytes[1] = 0x00;

bytes[2] = 0x01;

bytes[3] = 0x10;

XSpi_Transfer(&InstancePtr->AD5Spi, bytes, bytes, 4);

 

}

 best regards,

Jon

Share this post


Link to post
Share on other sites
  • 0

Hi Jon,

Thank you so much for helping me out! Forgive me for late reply. I was working on my final report recently. Just one more question, in "main" function in demo code. I noticed that there is a sleep(10); function which can set 10 seconds delay before generating the next output. By changing this delay, the output data rate from SDK console can also be changed. So can I ask that if the data rate we set in "mode register" is the maximum data rate that can be achieved?

Mingfei 

Share this post


Link to post
Share on other sites
  • 0

Hi @Mingfei,

We added the sleep(10) to ensure that all of the current processes on the IC are complete before trying to get additional data from the IC. If you are wanting to increase the data rate I would suggest to reduce the sleep delay and or remove it. I would also look through the datasheet for timing constraints with the IC to ensure that you are not giving the IC the needed time to finish current processes.

best regards,

Jon

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now