Jump to content
  • 0

PmodIA with External Clock


Nianyu Jiang

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

 

 

 

Link to comment
Share on other sites

10 answers to this question

Recommended Posts

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

Hi, everyone just so that my issue is related to the discussion going on in here, I was wondering if we need to have same I2C clock as we choose external clock (MCLK) for proper functioning of PMODIA or otherwise is ok.

Link to comment
Share on other sites

Hi @asadullah967@gmail.com,

If you choose to use the external clock rather than the internally generated clock on the AD5933, you could use I2C clock as the MCLK. Note though the maximum SCL frequency based on Table 2 of it's datasheet is 400 kHz, so if you decreased the MCLK to 400 kHz, the module will likely not be accurate when measuring higher frequencies, though the lower overall frequency would be better than the nominal 16.667 MHz for lower frequency sweeps.

Thanks,
JColvin

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...