Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 10 of 10

Thread: Teeny3.5 FreqCount Lib HWSerial1 tx noise?

  1. #1
    Junior Member
    Join Date
    Jul 2019
    Posts
    7

    Teeny3.5 FreqCount Lib HWSerial1 tx noise?

    Teeny3.5 FreqCount Lib HWSerial1 tx noise?

    I have a rf transmitter wired directly to pin 13 and teensy is grounded to the rf transmitter, usb, and power supply. The rf device is 24v. I found it odd that the teensy can read the freq correctly at such a high voltage directly connected, but I am not a EE.

    Main loop on the Teensy reads freq and push the values to usb serial and hwserial1. With the transmitter on, usb serial works, hwserial1 does not.

    testing - The teensy now is programmed only to send out a number every second to the hwserial1 (lib removed) rx-tx attached to a ftdi friend (usb-serial). With the rf transmitter on, the teensy sends out junk over serial to the ftdi-friend, with the transmitter off, numbers count out perfectly over the serial monitor.

    testing - With rf transmitter on and a simple echo script on the teensy. I can see that the teensy does receive commands correctly. I can not read the responses (because tx isn't working), but the teensy does attempt to echo back something. This makes me think that the teensy can receive serial, but not send.

    ***I originally had the teensy attached to another teensy reading serial. This is day 8 of debugging this issue.

    Could this be noise from the rf transmitter affecting the hwserial1 tx pin?


    Today I plan to remove pin13 and ground and test with the transmitter on, and try HWserial2 or 3.

    Any help would be appreciated.

    --Shawn McCombs

  2. #2
    Junior Member
    Join Date
    Jul 2019
    Posts
    7
    When rf is on and pin 13 disconnected system prints correctly.

    ---example of rx from teensy--
    13:26:03.178 -> a
    13:26:04.158 -> a
    13:26:05.170 -> a
    13:26:06.151 -> a
    13:26:07.167 -> a
    13:26:08.151 -> ZZ⸮⸮k⸮Xj⸮쭻⸮⸮aK⸮⸮⸮⸮⸮X⸮⸮⸮⸮⸮⸮)⸮⸮⸮⸮⸮a
    13:26:23.172 -> a
    13:26:24.183 -> a
    13:26:25.196 -> a
    13:26:26.178 -> a

    teensy even loses returns, I also forced it to repeat aaa three times. bold section is 5-sec duration. All others are one sec responses of "a" which is correct for this test.

    Trying HWserial2 and 3 now.

  3. #3
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    8,805
    >> "The rf device is 24v. I found it odd that the teensy can read the freq correctly at such a high voltage directly connected"
    Nothing over 5V should be applied to digital I/O pins like #13. When Odd things seem to work - Odd things can happen.

    No code is posted showing the actual printing to understand why stuff goes missing. Assuming FTDI baud speed is enough to handle the transferred data - and has GND+Rx+Tx wired and powered properly for 3.3V use?

    Can the USB Serial be used for debugging output? Not clear why Serial to FTDI is used to go to USB, when T_3.5 could do that directly at higher rates.

  4. #4
    Junior Member
    Join Date
    Jul 2019
    Posts
    7
    String SerialInString;

    int xtimeInterval = 3000;
    unsigned long xtimeLast = millis();

    int ytimeInterval = 1000;
    unsigned long ytimeLast = millis();

    void setup() {
    Serial.begin(9600);
    Serial1.begin(9600);
    Serial2.begin(9600);
    Serial3.begin(9600);
    }

    void loop() {
    if(Serial1.available() > 0) {
    SerialInString = Serial1.readStringUntil('\n');
    Serial.println(SerialInString);
    Serial1.println(SerialInString);
    Serial2.println(SerialInString);
    Serial3.println(SerialInString);
    }

    if (millis() - ytimeLast > ytimeInterval) {
    Serial.println("a");
    Serial1.println("a");
    Serial2.println("a");
    Serial3.println("a");
    ytimeLast = millis();
    }
    }


    How do I reduce the 24v rf/ac to 5v for the Teensy? Wouldn't that cause the frequency to change?

    "Can the USB Serial be used for debugging output? Not clear why Serial to FTDI is used to go to USB, when T_3.5 could do that directly at higher rates."

    USB Serial works fine with rf on or off, but another Teensy(T2) attached to hwserial does not. I need hwserial to work, not usb. I used FTDI to check hwserial.

    All software settings are correct or it wouldn't work normal at all. My problem is only when rf is on.

  5. #5
    Senior Member+ Theremingenieur's Avatar
    Join Date
    Feb 2014
    Location
    Colmar, France
    Posts
    2,442
    USB serial is native in the Teensy, there is no FTDI as on some old asthmatic Arduinos. So this is normally the more efficient way to go, at least when exchanging data with a PC.

    Reducing the 24V RF wich is most probably causing your problems to a healthy 3.3V Vpp for the Teensy input depends on the frequency and on the impedance which has to be seen by the transmitter. As an EE, you should then, once these values determined, theoretically be able to calculate a matching pi-attenuator with 2 protection diodes added. If you aren‘t an EE, post these two specifications (f and Z) here and the exact RF amplitude (are these 24V Veff, Vp or Vpp?) and someone will help you with the design and mathematics.

    Afterwards, when it comes to having an embedded MCU besides a RF device, special rules for grounding and shielding might apply. But this depends strongly from the frequency and the ERP. You don‘t tell much about the RF side of your project, so I can‘t give practical hints for the moment.

  6. #6
    Junior Member
    Join Date
    Jul 2019
    Posts
    7
    I'm not a EE but I have used Arduino like devices for 8 years or more (FTDI was useful then).

    Freq is 40mhz
    +10dBm on Spectrum Analyzer with the antenna within 1 foot of the transmitter's antenna (not directly connected)
    impedance is 50ohm

    *** just checked hwserial 2 and 3 all do the same thing.

  7. #7
    Junior Member
    Join Date
    Jul 2019
    Posts
    7
    The spectrum analyzer antenna was specifically built for this transmitter's frequency.

  8. #8
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    8,805
    Seems the out of spec input signal is thrashing the Teensy ...

    Based on post #5 I found this :: chemandy.com/calculators/matching-pi-attenuator-calculator.htm

  9. #9
    Junior Member
    Join Date
    Jul 2019
    Posts
    7
    I looked at that link myself but did not understand how it reduced the voltage.

  10. #10
    Junior Member
    Join Date
    Jul 2019
    Posts
    7
    I talked to a local ham op. he pointed me to the same calculator calling it a "t-attenuator".
    https://chemandy.com/calculators/mat...calculator.htm

    He said to do 50ohm in, 50ohm out, and 10db attenuation.
    The 10db attenuation comes from an old estimate trick of every 3db of attenuation is halving the voltage.
    24v/2 is 12.
    12/2 is 6.
    6/2 is 3.

    So we did that 3 times (3*3=9), so 10db is pretty close to 9.

    The calculator produced 26ohms in, 26phms out, and 35ohms to ground.

    I wired it up with 1/2w resistors 24ohm in, 24ohm out, 24ohm+11ohm to ground.

    Works perfectly now. Not sure how it's going to affect the transmitter signal but I'll throw it on the spectrum analyzer later today and see if it matches baseline before the mod.

    Thank you guys for at least keeping my hopes up, I was about to give up.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •