handiko/Arduino-APRS

AFSK tone reversal

W4KRL opened this issue · 1 comments

W4KRL commented

If you listen to the audio output of pin 2 using the Hello World example, you will notice that the preamble has a high pitch on every other transmission. Printing the first bit of each message looks like this:

MYCALL-1>APRS,WIDE2-1:>Hello World !!
1
MYCALL-1>APRS,WIDE2-1:>Hello World !!
0
MYCALL-1>APRS,WIDE2-1:>Hello World !!
1
MYCALL-1>APRS,WIDE2-1:>Hello World !!
0
MYCALL-1>APRS,WIDE2-1:>Hello World !!
1

The AFSK tones must be reversed on each transmission. Is this the expected operation?

Also, the comment says that the crc is calculated with 0x1024 but the code uses 0x8408:

/*

  • This function will calculate CRC-16 CCITT for the FCS (Frame Check Sequence)
  • as required for the HDLC frame validity check.
  • Using 0x1021 as polynomial generator. The CRC registers are initialized with
  • 0xFFFF
    */
    void calc_crc(bool in_bit)
    {
    unsigned short xor_in;

xor_in = crc ^ in_bit; // bitwise XOR
crc >>= 1;

if(xor_in & 0x01)
crc ^= 0x8408;
.
.
.

I'm not sure if this the problem with the 'high pitch' thing you noticed

But the global variable called nada is only initialised when the sketch first loads, and the state of this variable (which is a single binary bit) is changed as each packet is sent.

I think this should be set to its default value before each packet is sent.