This page will be updated as the project progresses. The current schematic is here. The project is designed to prevent hot switching of the RF bypass relay in an RF amplifier. It does this by putting the amplifier in transmit mode (activating the relay) as soon as a transmit request is received (on one of the key or PTT lines). After a user configurable delay (default 100 ms), the PTT or key signal is passed through to the transmitter. In addition, there is a user settable Key Operated Send dropout time. A front panel pot lets the user set the release time of the amplifier keying output to zero to 10 seconds after the key or PTT line is released. For example, as demonstrated in the video at the right, hitting the KeyB input immediately activates the amplifer enable output. 100 ms later, the KeyB output is enabled. When the KeyB input is released, the KeyB output is immediately released, but the amplifier enable output is not released. The amplifier stays in the transmit mode until the KOS timeout (I generally set it to 3 seconds) times out (such as 3 seconds after the KeyB input is released). KeyA behaves the same as KeyB. These two inputs and outputs typically pass a CW paddle signal through to the transmitter. If a straight key or bug is used, the KeyA and KeyB inputs can be tied together with the KeyA output driving one transmitter and the KeyB output driving another transmitter. There are two additional keying inputs: MicPTT and AuxPTT. These operate similarly to the KeyA and KeyB inputs except that on release, the amplifier transmit enable is released immediately. The amplifier PTT is released after the user confiugrable delay, the same delay that was used on transmit start, with the default being 100 ms. Finally, there is an RTTY Keyboard Operated Send input. This is wired ACROSS the Teletype. When a key on the Teletype is pressed, the start bit plus any space bits in the character result in a high voltage across the Teletype (the full loop supply voltage, which is typically 50 to 100 volts). This trips the KOS functionality of the device, causing the amplifier to be switched to transmit, then, after a delay, the transmitter PTT is enabled. However, during receive, a mark to space transition results in high voltage across the Teletype due to the selector magnet flyback voltage. However, this high voltage pulse is very short compared to a bit time (22 ms for 45.45 baud or 60 wpm). The firmware ignores any high voltage pulses shorter than 11 ms (half a bit time). HardwareRefer to the schematic.
FirmwareThe firmware is written in C and available here. main.cmain.c initializes the hardware, reads configuration data from eeprom, then enters the main loop. Timer2 is set to time out once each millisecond. When it times out, PIR1bits.TMR2IF changes from 0 to 1. Instead of having an ISR increment or decrement a bunch of RAM timers, the main loop just waits for PIR1bits.TMR2IF to be 1, then decrements the various timers and polls the inputs. When PIR1bits.TMR2IF is 0, the CommandInterpreter() is run. It accepts single letter commands with an optional parameter. KosMilliseconds is calculated from the pot ADC reading. KosMilliseconds is set based on a slope-intercept equation with m=2000/241 and b=364000/241. This causes the KosMilliseconds value to agree with the front panel markings. In addition, if KosMilliseconds is less than 2 times AmpDelayMilliseconds, KosMilliseconds is set to 2 times AmpDelayMilliseconds. BootloaderIn the XC8 linker options, the Code Offset is set to 0x600. This shifts all code up by 0x600 bytes UNLESS the __at directive is used to specify an address. This causes the application code to start at 0x600 while the bootloader code is below that address. bootloader.c uses the previously mentioned __at directive to manually place the functions used by the bootloader. Note that the optimization level is set to 1. Setting it to 0 would require moving things around. The function declarations include the __at directive setting the location of each function. Note that the BootVectors function has the naked attribute so no function prologue or epilog code is generated. BootVectors() places goto instructions at the reset and interrupt vector locations (even though this application does not use interrupts). The goto at the reset vector (0x0000) sends us to BootInit() in bootloader.c. The goto at 0x0008 (high priority interrupt vector) redirects the interrupt to AppStartAddr+0x08 (0x0608), which is where the high priority interrupt code would be after the 0x600 address offset applied in the linker. The goto at 0x0018 (low priority interrupt vector) redirects the interrupt to AppStartAddr+0x18 (0x0618), the location of the low priority interrupt code after the 0x600 offset is applied by the linker. BootInit() initializes the FSR registers that are used for the paramater and automatic local variables stack. This is normally handled by the application startup code, but that code has been moved above 0x600 as part of the application. Further, the startup code handles the allocation of global and static variables. This bootloader code uses only local automatic variables, so they are placed on the stack and disposed of on the function exit. The bootloader use of RAM therefore does not decrease the amount of RAM available to the application. BootInit() then checks PORTAbits.RA4, the KeyB input. If this input is high, a goto sends the CPU to the relocated start vector at 0x600. If the input is low, Bootloader() is run. Bootloader() initializes the UART that is driven by the USB bridge (U3). It then waits for characters of an Intel hex file sent to the USB port. These are buffered in LineBuf[]. LineBuf[8] holds the number of bytes in the record (usually 16). This is used to compute the location in LineBuf of the record checksum. If the checksum is zero, the the record type (00=data, 01=end, 04=ExtendedLinearAddress). If the record type is ELA, the ELA value is stored. If the record type is data, the start address specified in the record is determined, and the ELA added to yield the destination address in the PIC flash. Also, the hex data in LineBuf is converted to binaryIf in BinaryBuf. This is the binary bytes that will be put in flash. If the destination address is in the application area of flash, StreamProgramPicFlash() is called to program flash with the data contained in this record. The destination address check ensures that the bootloader is not corrupted by a bootloaded hex file. In addition, LATAbits.LATA6 (the AmpPTT output) is toggled on each record giving an indication of bootload activity. StreamProgramPicFlash() is passed the flash address to be programmed, the number of bytes to be programmed, and a pointer to the binary data array. This particular chip erases blocks of 64 bytes and programs blocks of 8 bytes. When landing on a 64 byte boundary (either by being passed that address or by incrementing to it), the new block is erased. After 8 bytes have been sent to the program latches, the program sequence is called. The programming of 8 bytes at a time requires the Intel Hex file to have an even multiple of 8 data bytes. The Format Hex For Download option in the linker configuration ensures that each record contains 16 bytes. The erase on 64 byte boundaries raises another issue. If the start of the stream of code is not on a 64 byte boundary, that page of the chip will not be erased prior to programming resulting in corruption. To ensure that we do not miss a 64 byte boundary, a different technique is used to generate the Intel hex file. A chip is programmed with the debugger (in program mode, not debug), then the contents of the chip are read back to a hex file using the green up arrow in MPLABX and Read Device Memory to File. This results in a hex file containing all the flash data for the chip, including that not used. Use of this hex file ensures we will cross the 64 byte erase boundary before programming any memory in that section. The bootload process is longer, but this is a simple way to avoid the issue. The file TxSeqFullMemory.hex is the hex file containing the full flash image. Memory MapBelow are a few points in the memory map
InstallationInputs
Outputs
ConfigurationFor many installations, the default configuration is fine (transmit delay of 100 ms). If the transmit delay needs to be changed for the CW sidetone enabled or disabled, do the following.
Bootload New Firmware
OperationThe system should properly sequence the transmitter and amplifier for CW, voice, and RTTY. The only routine adjustment is the KOS Delay Seconds. Adjust this to a value high enough to avoid having the amplifier drop out between characters on CW or RTTY. ConstructionThe parts list is available as a Digikey List here. I'm using a YIHUA 959D hot air rework station with Essmetuim ZB628 solder paste. The air temperature was set to 380 C. A small amount of solder paste is put on each pad for the 0603 parts. The part is then placed and soldered with the rework station. The air speed is set to minimum to reduce the chance of blowing the part off the pads. If there is excess solder paste, the part may float away on the melted flux. The high temperature tends to melt the solder and flux at close to the same time so the part does not have an opportunity to float away. When soldering down the chips, I am applying solder paste to a few pins at a corner of the chip. Then carefully aligning the chip such that all the pins are on all the pads (this is best done under a microscope). The solder paste is heated to solder the part in place. The chip alignment is again checked under a microscope. If there is slight misalignment, the chip can be pushed into the correct position. If it cannot, only the few pins soldered need to be heated to remove the chip and try again. Once the chip is properly aligned, a thin stream of solder paste is applied where the pins meet the pads on the remainder of the pins. Heat the solder paste to solder the chip in place, starting with pins that are far away from those that are already soldered so the chip does not have an opportunity to move. Examine the soldering job with magnifiers or a microscope. Short circuits between pins can often be removed by dragging a hot soldering iron from the chip down the pins away from the chip. If this does not work, and there is excess solder, solder wick can be used to remove the excess solder. Initial ProgrammingPlug the programmer (such as a Microchip PicKit3 or the Microchip SNAP. The PicKit3 is plugged onto the first 5 pins of J1. The SNAP is plugged onto all 8 pins of J1. The jumper between pins 7 and 8 of J1 should be removed during programming. Either load and compile the complete project in MPLABX or use MPLABX IPE to program the chip with TxSeqFullMemory.hex. |
The video above shows the transmitter sequencer installed and running. The sequencer is delaying the bug keying signal to the transceiver until 100 ms after the PTT has been sent to the amplifier. The amplifier PTT is dropped about 2 seconds after the last key closure (this is the KOS (Keyboard Operated Send) delay that is set on the front panel. Front panel LEDs indicate the state of each output SSR. Although not audible in the video, the sequencer includes a piezoelectric transducer on the PCB. This provides 500 Hz CW sidetone. ![]() The image above shows the PCB mounted in the case. Note that in this revision (rev B), the PCB mounting holes did not get drilled. The PCB is held in place by a drop of RTV adhesive on the center PCB mounting post in the enclosure. The front of the PCB is held in place by the bushing for the front panel pot and the LED light pipes. The round black object is a piezoelectric transducer that supplies CW sidetone at 500 Hz. It can be enabled and disabled through a jumper on J1 and also through a command on the terminal. ![]() The above image shows the front panel. The pot at the right sets the KOS dropout delay and includes the power switch. The five indicators are LEDs in series with the output SSRs. The LEDs are 0603 SMT LEDs with light pipes above them to make the LED light appear on the front panel. ![]() The image above shows the rear panel. The USB port is used for power. A terminal program (such as Tera Term, can be used to configure the system. The configuration commands are shown in a screen shot further down this page. The USB port is also used to load new firmware as shown later on this page. The left terminal block is inputs the sequencer. Everything except the KSR Sense is looking for a contact closure to ground. Each input has a 10k pullup to +5V. The KSR sense is opto isolated and is to be wired across a KSR printer (keyboard and selector magents in series). It a 1/4 inch TRS connector is used to plug equipment into the 60 mA loop, a 1/4 inch TRS Y connector such as this. When the keyboard opens, high voltage appears across the KSR sense input for 22 ms or more. This trips the Keyboard Operated Send sequence that switches the amplifier to transmit, delays, then turns on the transmitter and enables the terminal unit transmit. When the printer is receiving data, there is also high voltage across the machine. On a mark to space transition, the selector magnets generate a "flyback" voltage. On a space to mark transition, a high voltage pulse is also generated as the selector magnet current ramps up. These two voltage spikes are considerably shorter than the 22 ms bittime (60 wpm). They are about 2 ms. The software requires a pulse of at least 11 ms to trip the KOS, so KOS is activated on keyboard activity, not on received data. The video above is a quick demo of the preliminary transmitter sequencer. The video says that the transmitter and amplifier drop at the same time when the microphone PTT is released. The current firmware drops the amplifier after the transmitter (default 100 ms). The video is showing a rev A board. It DOES have the three mounting holes, but the footprint for the USB interface chip is wrong. Rev B fixed the footprint but lost the mounting holes. ![]() The image above shows the user interface through the USB interface with Tera Term. The serial port is set to 19.6 kbps, 8N1, XON/XOFF handshake, and a 1 ms character delay. In the setup terminal menu, local echo is enabled (half duplex operation(). Commands are a single letter. If followed immediately by a number (no space or tab) and terminated with a carriage return, the setting is changed to the specified value. If the letter is followed immediately by a carriage return, the current setting is shown. Any changed setting is written to EEPROM and restored on the next power cycle. The image above shows the signal at U2-5 during RTTY reception. The selector magnet flyback voltage on a mark to space transition causes a high voltage across the Teletype turning on the LED in U2, causing the phototransistor to conduct and pull its output low. Note that the line is low for about 2 ms, much shorter than a 22 ms bit time, and much shorter than the 11 ms threshold the Transmitter Sequencer uses to sense Keyboard Operated Send. The image above U2-5 on the transmission of a character by the keyboard. Note that U2-5 is low for about 24 ms (a bit longer than the 22 ms bit time) as the keyboard is open for the start bit. This is longer than the 11 ms threshold for Keyboard Operated Send, so the Transmitter Seqiemcer goes into transmit (brings up the amplifier, waits 100 ms, then brings up the transceiver and puts the terminal unit in transmit). The space to mark transition causes a sudden current change in the selector magnet again causing a flyback voltage. This is the seconds 1 ms low pulse. Each time a space bit is generated by the keyboard (keyboard open circuit), U2-5 again goes low for the bit time, resetting the Keyboard Operated Send dropout timer (front panel adjustable from 0 to 10 seconds). ![]() The Dentron Clipperton-L was in standby and driven with low power RF. The amplifier was then taken out of standby. In the image above, the yellow trace going low is the signal telling the Dentron to go out of standby (RF bypass). The blue trace is the output of an RF detector on the output of the Dentron amplifier. At the beginning of the left end of the blue trace shows the output with the amplifier bypassed. About 10 ms after the amplifier is told to go out of bypass, the bypass relay in the amplifier starts switching leaving no RF output. About 12 ms after the amplifier was told to go out of bypass, the amplifier comes online with some contact bounce for the next millisecond. The amplifier is fully online about 13 ms after the amplifier was told to go online. ![]() The image above shows the amplifier returning to standby (bypass). Once again, the yellow trace is the signal driving the bypass relay in the amplifier. About 10 ms after the bypass signal is sent, the relay opens, and no RF is passed. Another 4 ms later, the amplifier is in bypass with some contact bounce for the next millisecond. The amplifier is fully in bypass about 15 ms after the control line is released. The image above shows the key or PTT line driving the SEA245 transceiver (yellow trace), and the RF output level (blue trace). RF ramps up about about 30 ms after PTT goes low. The amplifier has switched well before this time (about 13 ms after PTT goes true). This is an initial receive to transmit transition in CW mode. This 30 ms includes the transceiver receive to mode switch including the switching of its T/R relay. ![]() The above image shows RF appearing about 4 ms after the PTT line goes low. The SEA245 was already in transmit mode (CW with a previous dit before the CW timeout). ![]() The image above shows the SEA245 with the PTT line going false. Once again, the yellow trace is the PTT line, and the blue trace is the detected RF level. Some RF gets into both traces. RF is gone by about 11 ms after PTT is released. Note that the Dentron bypass relay goes open circuit about 10 ms after PTT is released. |