• 0
Nianyu Jiang

PmodIA with External Clock

Question

Hello!

I am trying to add external clock (32KHz) to the PmodIA for low frequency generation, however, I have no idea how to change the Arduino code, could anyone tell me how to modify my arduino code or even library to make things work?

The code works good calling internal clock, the information is attached below.

Thanks for the help!

External Clock information:

https://www.digikey.com/product-detail/en/abracon-llc/ASFLK-32.768KHZ-LJ-T/535-9546-6-ND/1882844

PmodIA_front.jpg

PmodIA_Back.jpg

 

 

 

Edited by Nianyu Jiang
Privet

Share this post


Link to post
Share on other sites

7 answers to this question

Recommended Posts

  • 0

Hi @Nianyu Jiang,

Welcome to the forums. I have not added an external clock to the Pmod IA as of yet. I do know that you add the external clock by loading IC4 on the PmodIA  like you have in the attached picture. Then you need to set bit 3 in the control register (register address 0x80 and 0x81).

I believe in the code you attached you would use the function:

bool setExtClock(bool);

In the INO on line 34 you change the line from 

 AD5933.setExtClock(false);

to 

 AD5933.setExtClock(true); 

Let us know the results.

cheers,

Jon

Share this post


Link to post
Share on other sites
  • 0

Hi @Nianyu Jiang,

To add onto what @jpeyron said, I took a look at the AD5933 datasheet (the embedded chip on the Pmod IA) and wasn't able to find if there is a limitation as to what the external clock rate or crystal oscillator should be. However, looking at the schematic for the Pmod IA, there are some suggested external oscillators on the page, though they are all for 16 MHz oscillators rather than a 32 kHz oscillator you are looking at, so I am not certain how the chip would respond to a much lower clock rate/oscillator frequency.

Thanks,
JColvin

Share this post


Link to post
Share on other sites
  • 0
1 hour ago, JColvin said:

Hi @Nianyu Jiang,

To add onto what @jpeyron said, I took a look at the AD5933 datasheet (the embedded chip on the Pmod IA) and wasn't able to find if there is a limitation as to what the external clock rate or crystal oscillator should be. However, looking at the schematic for the Pmod IA, there are some suggested external oscillators on the page, though they are all for 16 MHz oscillators rather than a 32 kHz oscillator you are looking at, so I am not certain how the chip would respond to a much lower clock rate/oscillator frequency.

Thanks,
JColvin

Hi Colvin,

Thanks for the response.

Yes, the datasheet doesn't say anything about the limitation of the oscillator frequency, but I was reading a lot of paper works which connected lower frequency clock to the chip.

I will try the method suggested by Peyron and posted here.

Share this post


Link to post
Share on other sites
  • 0
8 hours ago, jpeyron said:

Hi @Nianyu Jiang,

Welcome to the forums. I have not added an external clock to the Pmod IA as of yet. I do know that you add the external clock by loading IC4 on the PmodIA  like you have in the attached picture. Then you need to set bit 3 in the control register (register address 0x80 and 0x81).

I believe in the code you attached you would use the function:

bool setExtClock(bool);

In the INO on line 34 you change the line from 

 AD5933.setExtClock(false);

to 

 AD5933.setExtClock(true); 

Let us know the results.

cheers,

Jon

Hello Jon,

The system cannot work by simply changing "false" to "true", I think it might be the problem of the library. I will try to contact with the author of library and ask his opinion.

Thanks.

Nianyu Jiang

Share this post


Link to post
Share on other sites
  • 0

Hi @Nianyu Jiang,

Looking at the setExtClock function (line 89 in the .cpp you attached), setting the external clock to be true just sets a parameter to 16 MHz rather than the internal 16.776 MHz. What I would guess that would need to be done for other frequencies is to add another parameter in that function to allow the user to provide their own frequency that matches the oscillator/chip they provided.

Thanks,
JColvin

Share this post


Link to post
Share on other sites
  • 0

Hi guys,

Just fixed the problem. In the library (.cpp), the register address of calling external clock is wrong (0x08).

By changing it to 0x80, the code works good right now. I tested 500 and 100Hz, which works perfectly fine.

Thanks again to Colvin and Jon for your time and help.

Nianyu Jiang

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