Friday, 30 July 2021

Part 2 Of A Digital VFO For The G6LBQ Irwell HF Transceiver

For part 1 of the Digital VFO click here.

Digital VFO & RF Oscillator Module

"For The G6LBQ Irwell HF Transceiver"

Welcome to part 2 of my blog post series in which I present further details of my Digital VFO and RF oscillator module for the “Irwell HF Transceiver project”. This is a significant building block as it will be solely responsible for frequency generation and the control of other modules in the project.

Since I posted part 1 on the blog I have made good progress with the software changes that I outlined. I have added additional commands to JA2GQP’s source code for the I2C Multiplexer and I am now at the stage where I can communicate with two SI5351 devices to produce two chip independent clock signals. In order to achieve this, I have had to make changes to both the main code as well as the SI5351 library file.

For now, I only need to generate two clock signals for my transceiver, one for the VFO and the other for the BFO, this will permit the radio to run as a single conversion superhet in its current state. Once further modules are developed the receiver will be upgraded to a dual conversion superhet which will require a third clock signal for the  conversion oscillator.

The additional software code required to support a third SI5351 is going to be a bit more difficult for me to implement, I hope to replicate JA2GQP’s BFO oscillator code parts for this as it includes a routine for calibrating the BFO frequency and saving it to memory and If I can do this it should pave the way for implementing an IF shift control.

For transparency and clarity, I have commented all of the changes and additions that I have made to JA2GQP’s source code which will be available to download from my Groups.io community group website once I have finished documenting the VFO & RF Oscillator on the blog!

Joining my group is free just click on the button below.

Join G6LBQ on Groups.io

JA2GQP's source code can be obtained from his own download site by clicking on the following web link;

https://drive.google.com/drive/folders/1VpsnNi6JbRnYKEr_JuoT2aHemHWDkQxx


The code additions required to implement the TCA9548 are actually not that complicated though I did struggle to get it working at first.  I made the mistake of adding my software changes entirely to the primary software file
(AKA Sketch) then later realized some of the changes needed to be made to the additional SI5351 library file.


In the main sketch three lines of code that were added to the void setup block as illustrated below;



Next I made the following changes to the SI5351 library;

First the address of the TCA9548 IC must be defined in software to match the address configured by the chips A0, A1 & A2 pins. I recommend that you view the manufactures data sheet for the full range of programmable hex addresses.

 

Next the TCA9548 IC is setup and initialized to communicate on the I2C bus using  the Arduino wire library.


Finally the function declaration is made to send data to the relevant TCA9548 slave port and subsequent SI5351 device.



The multiplexer on the I2C bus is working well at controlling the SI5351 IC's and to date I have experienced no anomalies with the VFO so I decided to press on with the software development as I wanted to add further code for controlling the transceivers band-pass & low-pass filter modules. The STM32 "Blue Pill" micro-controller does not have enough spare I/O pins to control the filter modules on its own so I looked at using I/O expander devices to do the job.
 
Research was carried out and I settled on using the popular PCF8574 IC and like the aforementioned multiplexer IC the PCF8574 uses the same I2C bus for data communication. The chip is available in two variants each having its own unique set of 8 configurable hardware addresses, this basically means you can have up-to 16 of the IC's together on the I2C bus which equates to 128 I/O s... That's a lot!

The PCF8574 is a popular choice of I/O expander amongst the Arduino community so it was no surprise to discover that our friends in China produce ready made modules delivered to the UK for under 3 UK pounds.
 
Did I mention😏

I ordered a couple of the Chinese modules to experiment with and here's an image of one of the modules that I received.

During my research of the PCF8574 expander IC I came across various Arduino libraries written to simplify the job of adding the devices functionality into a sketch, however I chose not to use them as they appeared over complicated for my particular application and my programming skills, instead I modified the main sketch file by adding the following blocks of code;

First integers are defined for each of the PCF8574 expander IC's to match the hex addresses configured by the chips A0, A1 & A2 pins. Again I recommend that you view the manufactures data sheet for the full range of programmable hex addresses.


Next
the PCF8574 IC's are setup and initialized to communicate on the I2C bus using  the arduino wire library.


Finally a function declaration is made in the Arduino's void loop that monitors the VFO frequency, it does this in a cascading block of 
if - else if  - else  statements and depending on the frequency determined data gets sent to the PCF8574 IC to switch on one of the eight I/O pins  thus enabling the appropriate BandPass Filter.

This snippet of code shows the first two filters in the cascading block of eight.


And here is the code for the last two filters in the cascading block of eight.


The same code is recycled for the LowPass filter control using a second PCF8574 IC and further IC's can be added for additional I/O expansion. 

I am sure there are other ways in which the multiplexer and I/O expander IC's can be implemented in software but with the methods outlined everything works and is proving to be reliable.
 
If you have any constructive comments or suggestions on ways in which my software implementations could be improved please drop me an email with code examples that I can follow and learn from, you can contact me using the form displayed in the top right hand corner of each blog page. 
 
There are other smaller changes that I have made to the original software code that I wont cover on the blog but for your interest these include:
  • Added additional mode control outputs
  • Added additional frequency steps
  • Increased the amount of selectable band segments from 6 to 8


It should be noted that the PCF8574 IC has a total package sink capability of 80 mA which is not sufficient for driving the relays on the filter modules.  To deal with the current switching demands I will include a darlington array IC between the PCF outputs and the filter modules
.

In part 3 I will be providing details of the VFO hardware along with schematic diagrams. 

For part 3 of the Digital VFO click here.

Until next time... 
 
73's From Andy G6LBQ
Its all About The Radio Ga Ga...

 

No comments:

Post a Comment

I appreciate your comments on the blog content, however the blog has been subject to idiots trying to use the comments facility as a means to post advertisements & spam so all comments are now approved and moderated.