[minima] Re: PTT and CW Key Code

  • From: Mark G0MGX <mark.g0mgx@xxxxxxxxx>
  • To: minima@xxxxxxxxxxxxx
  • Date: Thu, 30 Jan 2014 04:17:26 +0000

An excellent explanation - thanks!

Mark

On 30/01/2014 02:37, Ashhar Farhan wrote:
mark,

i guess the problem is with the difference in the value of built-in pull-up resistors used in different arduino boards.

IMP: the T/R line on port 3 (pin 5 in the circuit diagram) is normally configured as an input to detect the PTT. But when the ANALOG_KEYER line (pin 24 in the circuit diagram) detects a key down, the T/R line is immediately reconfigured as an output to force the transceiver into transmit mode.

here is how the code works...

cw transmission works with three lines :

1. the key connected to A1 (pin 24) takes the input from the key. this line is called ANALOG_KEYER in the code. It has a 1K pull up resistor. This is always in the input mode. and the software loop keeps looking for a keydown to put the transceiver in CW mode.

2. the T/R line is connected to Port 3 (pin 5 on the arduino uno). this is initially configured as an input with the pull up resistor enabled (line 335, 340 of radiono.ino). the software loop keeps looking for it to go down when the PTT is pressed.

3. the sidetone line is always an output. its purpose is to key the sidetone to generate the on/off carrier.

In ssb transmission:

1. the ptt is pressed, this brings down the T/R line. the t/r line trips the t/r relay, the audio amp is disconnected from the audio preamp, the R line is powered down and the T line is powered up. 2. the arduino senses the t/r pressed and changes the display to 'tx' and shifts the RIT. 3. when the ptt is released, the T/R line is pulled up by the internal resistor of the arduino, de-powering the relay and putting the transceiver's analog circuitry back to receive mode. 4. the arduino senses the t/r released and reverts back to receive function.

When the CW key is pushed down while in receive mode:

1. the ANALOG_KEYER line goes to the ground. this detected by the arduino's checkCW routine. 2. TRICKY STUFF >>>> the mode of the T/R pin is changed to output and it is forced to go low (lines 470 to 473.) 3. the low on the T/R line is now coming from the arduino instead of the PTT key. this puts the transceiver's circuitry in transmit mode.
4. the relay connects the audio power amp's input to the sidetone.
5. after allowing the relay to settle for a few milliseconds, the sidetone is switched on. 6. A timer (in the variable cwTimer) is started and continuously updated while the CW key is down (lines 482-483)

When the CW key is released,
1. The transmit mode is continued until cwTimer is timed out. Within this period if another morse character is started, then we just reset the cwTimer and keep going (lines 487-490). 2. if the cw key has been up for longer than CW_TIMEOUT milliseconds, we assume that the transmission is over. and put the TX_RX port back as an input port with the internal pull up (lines 494-503).


To switch to CW mode:
5. a timer is started to keep the transceiver in CW transmit mode by continuously incrementing the cwTimeout. 6. during further key up and key downs that take place within the cwTimeout, the transceiver continues being in CW transmit mode and only the sidetone is accordingly keyed up or keyed down.
7. when the key has been up  for more

I hope I have explained it. My C is better at explaining this than my English.

- f




On Thu, Jan 30, 2014 at 1:03 AM, Mark G0MGX <mark.g0mgx@xxxxxxxxx <mailto:mark.g0mgx@xxxxxxxxx>> wrote:

    Hi Frank

    I do have the CW key line pulled high externally so that's not it
    - but I just sent the solution; I have changed the resistor in the
    base of Q23 from 4K7 to 47K and it is now working as expected.

    Mark
    G0MGX



    On 29/01/2014 19:31, Frank wrote:
    Mark,

    The CW key line is shown being pulled high with a 1k resistor to
    5 volts.  I loaded the code into an Arduino Uno and found the
    same problem, but I didn't have the key line pulled high.  If I
    touched the key line with 5 Volts it whet to receive.  By the
    way, I don't have anything started yet, I am waiting for a PC board.

    Good luck and thanks for keeping us informed as you go along.


    Frank - W4NHJ

    -
    On 1/29/14, 11:47 AM, Mark G0MGX wrote:
    Hi Team

    I am seeing some problems in my tests today where I am not able
    to switch between TX and RX all the time - sometimes I am
    "stuck" in TX.

    I seem to be able to fix this problem by tying the CW_Key line
    "HIGH" i.e. connecting it to 5V. I don't yet fully understand
    the code and what is happening with CW as there is a key
    attached in the schematic but the pin is defined as OUTPUT in
    the code? Also when I there is nothing connected to the
    processor pin 5 it is OK, but when the components around Q23 are
    connected the software immediately reports it is in TX.

    As is so often the case - it is sometimes difficult to
    understand other peoples software.

    Is anyone else seeing this problem?

    Thoughts?

    Mark
    G0MGX (back from Stockholm)








Other related posts: