You are here
JAL Library for Si5351a clock generator module
This was the most challenging JAL library that I created so far. The JAL library for the Si5351a supports all features of the Si5351a clock generator module, offering an easy to use API. The module is controlled via IIC and operates on a power supply of 5 Volt due to a voltage regulator circuit on the breadboard since the chip itself operates at 3.3 Volt. This breadboard makes it easy to interface it with a PIC that is connected to 5 Volt.
The module is capable of generating clock signals varying from 2.5 kHz to 225 MHz. There are 2 variants of the Si5351a chip, one with 3 clock outputs and one with 7 clock outputs. This library is created for the version having 7 outputs but was tested with the version with 3 clock outputs. The later seems to be popular and sufficient for most needs.
As said, creating this library was not a simple task due to the complexity of the chip so I used several sample programs that I could find on the internet to get inspired although some libraries that I found where impossible for me to understand. The simplest library would be one in which the user does all the work, that is determine an output clock frequency and the required Phase Locked Loop (PLL) frequency that serves as basis for the output frequency. This JAL library goes, however, one step further.
The module has 2 PLL’s but supports more than 2 outputs so the challenge is to find PLL frequencies that can support multiple output frequencies at the same time. The Library does this. Each time a frequency is set on an output the JAL library tries to map other outputs on the same PLL. This results in more variations of output frequencies at the same time. If for example the 2 PLL’s are running at a very high frequency for generating 2 high output frequencies, it would not be possible to generate a low output frequency on a third clock output. The JAL library will then try to find a PLL frequency that supports the two high output frequencies so that the second PLL can be used for the generating the low frequency output.
There are three main functions available with the most advanced function also using the most ROM space. If your ROM space is limited, it is better not to use the most advanced function.
The following main functions are available:
• Set a given output frequency on a given output. This is the most advanced function. It will look for the best PLL frequency to produce the output frequency but this function will also try to map other output frequencies that where set previously on the same PLL. As said before, this feature uses the most ROM space.
• Set a given output frequency on a given output using a given PLL. This function will assign the given PLL to the output and determine a suitable PLL frequency. No mapping of other outputs is done here but it is possible depending on the chosen frequency, to have more than one clock output on the same PLL.
• Set a given output frequency using a given PLL frequency on a given clock using a given PLL. This is in fact a total manual action. The user has to calculate the right PLL frequency to support the given output frequency. No mapping of other outputs is done here but, depending on the chosen frequencies, it is possible to have more than one clock output on the same PLL.
Whenever an output is successfully set, a function will return TRUE. It may happen that a frequency cannot be set because of the fact that the used PLL’s do not offer the right frequency to provide for the given output frequency. In that case the function will return FALSE.
For the experts, an extensive set of procedures and functions is provided to change the settings of the chip. Using these may disturb the normal operation of the main functions so you have to know what you are doing if you want to use them.
To be able to set frequencies and test the library a sample program 16f18857_si5351.jal is available that shows a menu via the USART. By providing the right command and parameter(s), any frequency can be set. The menu also shows other features for controlling the output levels of the chip. A second more simple sample program 16f1825_si5351.jal uses the 3 main features of the library by setting different - and changing - frequencies on the 3 outputs of the module.
With various settings the library can be configured. These settings are:
• Setting the IIC address. The library uses the default address for the version with 3 outputs. The version with 7 outputs has a configurable IIC address.
• Using a hardware IIC interface or a software IIC interface. The default setting is using the hardware IIC interface.
• Using a crystal of 27 MHz instead of the default 25 MHz.
The following video demonstrates some randomly chosen frequencies using the library with the 16f18857_si5351.jal sample program: https://youtu.be/9MjLhZReArY
Due to the fact that my oscilloscope has a range up to 50 MHz I was able to test the chip up and until frequencies of 100 MHz but not higher. Because frequencies higher than 150 MHz are treated differently by the JAL Library I am looking for any feedback about the operation of the JAL library above this frequency.