v1.01.02 – Update for June 17, 2022

This version replaces the [>0] button with a new [Zero] button. The new button is dual-state to you can enable or disable automatic low digit zeroing (i.e. zero digits below the tuning step frequency.

NOTE: If you use Node-RED for your user interface, be sure to download the new Node-RED flows here.

NOTE: If your current version uses a date code (02/05/22) instead of a version # (v1.00.xx), this version will move all of your Radio Port settings up one port. This is due to one of the inconsistencies I fixed where some files were 0’s based and others were 1’s based. Radio Port #s will always be 1’s based and files associated with a radio port are now all 0’s based (example: FRQMEM_0.CSV holds the frequency list for Radio Port #1). Previous versions of CTR2 firmware used 1’s based frequency file names (i.e. FRQMEM_1.CSV held the frequency list for Radio Port #1). I apologize for the inconvenience this will cause but it needed to be done.

You can use the Copy function the Radio Port page to copy radio port settings to the next lower port #. You will have to change the Port Name when you do this because port names are saved in a 0’s based list (another inconsistency).

I’ve also implemented a version numbering scheme starting at v1.00.02. This new scheme will allow me to make minor changes in the various firmware files that make up CTR2 without having to update all of them. All firmware files must match the Major and Minor revision, but they may have different Sub revision numbers (the last two digits). For instance, all v1.00.xx files are compatible with each other.

If you’re running the Node-RED user interface, you must replace your Node-RED flows.json file with the newest file. You can the Node-RED flows here.

This post contains links to all of the source code files associated with CTR2. These include firmware source code for the Teensy 4.1 development board and the Nextion display and their compiled binaries.

You’ll also need to create an SD card with the default data folders and files used by the Teensy 4.1 to store settings. You can download those files from the CTR2 Default SD Card Files post.

If you have access to a CNC mill and want to cut out your own display enclosure, download the appropriate file for your display from the Display Enclosure CNC Files post.

What You Need to Download

You’ll need to download and install the following files to get your CTR2 up an running. The Teensy and Nextion files can be found on this page, the Node-RED flows can be found here.

  • CTR2_Teensy_Executable_v1xxxx.zip or CTR2_Teensy_src_v1xxxx.zip – the latest version of firmware for the Teensy 4.1 on the HMI board
    Then one of the following:
  • CTR2_3-5_Display_TFT_v1xxxx.zip or CTR2_3-5_Display_src_v1xxxx.zip– if you’re running the 3.5″ Nextion Enhanced display, or
  • CTR2_5-0_Display_TFT_v1xxxx.zip or CTR2_5-0_Display_src_v1xxxx.zip – if you’re running the 5″ Nextion Enhanced display, or
  • CTR2_NRed_Flows_v1xxxx.zip – if you’re running the Node-RED interface (from the Node-RED download page).

NOTE: The major and minor version numbers must always be the same however the sub version # (last two digits) may be different for each firmware package.

Software License

The source code for this project is copyright 2021/2022 by Lynn H. Hansen. All code is open source and is subject to the terms of GPL3 (GNU GENERAL PUBLIC LICENSE, Version 3.0, 29 June 2007). You may download, modify, and use this software for your own personal use. The right to manufacture or otherwise commercialize CTR2 hardware and/or software is not granted by this license.

CTR2 Teensy 4.1 Source Code and Executable

There are two ways to load the firmware on your Teensy 4.1… the easy way and the hard way. Let’s look at the easy way first!

The Easy Way

PJRC.com was gracious enough to provide a loader program that can download the compiled .HEX file to your Teensy without you needing to go through the pain of compiling. I highly suggest going this route.

Download the loader program from the PJRC.com web site here: https://www.pjrc.com/teensy/loader.html There are three versions, one for Mac, one for Linux, and one for Windows. Download the one that works for you.

Next, download the Teensy Executable v1xxxx file below. Unzip the .HEX file to a convenient location on your hard drive.

Connect the micro-USB port on the Teensy 4.1 on the HMI board to your PC. Make a note of the COM port assignment for your operating system. Next, start the loader program and click the File menu. Navigate to the location of the CTR2 .HEX file you unzipped above and select it. The loader program will connect to your Teensy and download the executable file to it.

That’s it! No setting up a development system (IDE), looking for libraries, or compiling, just download the .HEX file.

The Hard Way

For the more adventurous out there, the CTR2 source code for the Teensy 4.1 development board on the HMI can be downloaded below. It was created using the Arduino IDE (or an Arduino compatible IDE). Because of the size of the source code I split the CTR2.ino file into many sub-files. All files must be copied to a folder named CTR2. The CTR2.ino can be thought of as the master file and is the one you open in the Arduino IDE. It has the global declarations for variables used by the other files. The other files contain code for specific functions and will automatically load into the Arduino IDE when the CTR2.ino file is opened.

Visit my FW – Setting up your programming environment and uploading firmware post for instructions on how to use these files.

To compile the CTR2 firmware you’ll need to install the latest version of Teensyduino. It can be download from the PJRC.com website here. Next, open CTR2.ino in your IDE, select the Teensy 4.1 board, USB Type Serial, MIDI, and Audio, and compile it. Once this is done compile it and download it to the Teensy board.

Nextion Display Executables and Source Code Files

The code for the Nextion display is created in the Nextion IDE. The compiled file uses the .tft name extension. It is copied to your display by copying it to a micro-SD card that is then inserted into the micro-SD card slot on the back of the display. There are two ways to get the .tft firmware into your display. Again, the easy way and the hard way…

The Easy way:

  1. Download the CTR2_x-x_Display_TFT.zip file
  2. Unzip it to a micro-SD card
  3. Insert the micro-SD card into the micro-SD card slot on your display
  4. Power up CTR2 and wait for the file to be copied to the display
  5. Turn off CTR2 and remove the micro-SD card from the display

Executable (.tft) files for the Nextion 3.5″ and 5″ Enhanced displays

The Hard way:

  1. Download the CTR2_x-x_Display_src_v1xxxx.zip source files for your display
  2. Unzip the files into a separate folder then open the .HMI file in the Nextion IDE
  3. In the IDE, select the File – TFT file output menu option to create the .tft file. You will be asked where you want to save the .tft file. Save it somewhere you can find it again!
  4. Copy the .tft file to a micro-SD card then follow steps 3 to 5 above.

Source files for the Nextion 3.5″ and 5″ Enhanced displays

Revision Notes

June 17, 2022 – Rev 1.01.02 – Minor update

  1. Changed [>0] (zero low digits) button to [Zero] and made it two-state to you can enable and disable automatic low digit zeroing. When enabled this feature will automatically zero the frequency digits below the step frequency.

March 21, 2022 – Rev 1.01.01 – Minor update

  1. I added the auto-keyer speed option that was added to CTR2-Mini v1.02.08
    • With this option, just bracket the text you want to send faster in your CW transmit buffer with *’s. When the buffer reads the * it will increase the keyer’s speed 50%. The next * in the buffer will reset the speed to normal. This is useful for contesters that sent ‘599’ RST reports in every contest exchange. Just enter *599* in the buffer and the RST will be sent at a higher rate.

March 18, 2022 – Rev 1.01.00 – Major Flex firmware upgrade

  1. I totally redesigned the Flex communications code to eliminate the sporadic encoder tuning that has been a problem on Flex radios since, well, day 1. This included reworking the Initialization, Rx, Tx, and Parsing routines. Tuning is much improved now.
    • I found that the ESP8266 was blocking on the large data updates the Flex spews out each time you change the frequency of the selected slice. This data is only sent if Tx is enabled on that slice.
    • This firmware will now temporarily disable Tx on the selected slice (if it was enabled) while tuning is in process then re-enable Tx after 3 seconds of no tuning activity. This stops the flood of data from the Flex so the ESP8266 isn’t overwhelmed with data.
    • NOTE: There may be a slight delay when you start tuning before the Flex responds if Tx is enabled on the selected slice. This is normal.
  2. I added a new WiFi Auto-Connect option to the Config page. Enabling this option will cause CTR2 to automatically connect to WiFi, and the Flex radio (if it’s the selected radio CAT) when booting the HMI for the first time. Holding down the encoder during the boot cycle will invert the auto-connect setting.

Feb 22, 2022 – Rev1.00.06 – minor changes in Flex

  1. Revised Flex Rx routine
  2. Move to selected frequency when enabling Tx on that slice

Feb. 21, 2022 – Rev 1.00.04/.05 – minor changes in Flex

  1. Fine-tuning Flex radio algorithm to make it more responsive
  2. Disable Tx on CTR2 when another slice goes active (if using CTR2-Mini to control the other slice)

Feb. 19, 2022 – Rev 1.00.02 – changes in the firmware since the February 5, 2022 release

  1. Implemented a version numbering system starting at v1.00.02. All versions of Teensy, Nextion, and Node-RED will be compatible if the Major and Minor rev#’s match. For instance, v1.00.xx Teensy firmware will be compatible with all other v1.02.xx firmwares.
  2. Refactoring fixed inconsistent port/file numbering. Radio Port #s are 1’s based and all supporting file names for these ports are now all 0’s based. This means that Radio Ports created on older CTR2 firmware versions will be one port higher (the radio settings on port 1 will now appear on port 2, etc.). Use the Copy function on the Radio Port page to copy settings to the next lower port to fix this problem.
  3. FlexRadio support has been further debugged an optimized. Encoder control of the radio’s frequency is now faster and more consistent.

Feb. 5, 2022 changes in the firmware since the Jan. 16, 2022 release include:

  1. Enhanced FlexRadio support:
    • You can now connect to any existing slice in the radio (previous versions were locked to slice A)
    • You can now create a new slice
    • You can now create a new panadapter when you create a new slice
    • Simplified connecting to the Flex
      • If WiFi is not on, turn it on before connecting to the Flex
      • If WiFi is on just connect to the selected slice
      • When disconnecting from the Flex, leave WiFi enabled until user turns it off

Jan. 16, 2022 changes in the firmware since the Dec. 1, 2021 release include:

  1. Bug fixes (as expected)
    • Keyer bug fix – not checking for elementCtr==0 when checking paddles
    • Update keyerDitDuration and keyerDahDuration when changing cTxSpeed
    • Fixed bugs in Node-Red key control
    • Mute Tx Monitor in voice mode when Monitor is not selected
  2. Added an Amp Sequencing page to Nextion and Node-RED UIs
    • This allows the PTT output of the Radio I/O module to enable an external linear amp (amp’s PTT input) and then activate the KEY output of the Radio I/O module to key the transceivers PTT or Key input after predetermined pre and post delays. Delays have 1 millisecond resolution so full-break in is supported.
  3. Changed the keyboard keyer prosigns to match the prosigns K1EL uses on the WinKeyer to eliminate operator confusion.

Dec 1, 2021 changes in the firmware since the Nov 7, 2021 release include:

  1. Bug fixes (of course)
    • Fixed Delete Log bug in Node-RED interface
    • Not listing RTTY calls in Auto Log fixed
    • Fixed CAT PTT issues for digital programs such as WSJT-X
  2. Timestamp beacon calls saved to Auto Log page
  3. Added buttons for QRZ call look ups, Reverse Beacon Network, and PSK Reporter to Node-RED Log Entry panel.
  4. Added Login options to Node-RED
    • Share CTR2 with other users on the internet
    • One owner – login once with no time limit
    • Any number of users – limited to 30 minute sessions
    • Each user has their own username and password
    • All user logins are logged
    • Disable the login feature by disabling the Login flow

Verifying Code Revisions

To verify that you have the correct code versions loaded on your HMI and display, navigate to the Settings -> Config page. The two text boxes under the Delete Log button will show the Code ver: and Disp ver: for the Teensy and the display (or Node-RED flow).

Major and Minor revision #s MUST match. The Sub revision # (last two digits) may be different.

For example, all v1.00.xx firmwares are compatible. However, v1.00.xx is not compatible with v1.01.xx firmware.