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

Thread: Teensy 3.2 Serial Communication with RF module Issue

  1. #1

    Teensy 3.2 Serial Communication with RF module Issue

    Hi all,
    I just testing my new Radio freq. modules (915Mhz) to my arduino uno and its work fine, send the data to the RF receiver in my pc using teraterm correctly .
    but when i switch using my teensy 3.2, the data i received is nonsense (error).
    this is source code that i used to

    //SoftwareSerial print_serial(0,1); using arduino uno
    #define print_serial Serial3 // using teensy 3.2, i also have tried with serial1 and output still uncorrect.

    void setup() {
    print_serial.begin(57600);
    Serial.begin(57600);
    delay(1000);
    }

    void loop() {
    Serial.println('b');
    print_serial.println('b');
    delay(1000);
    }

    Note :
    -COM4 is the teensy serial, and COM3 is the RF receiver in my PC.
    -Baudrate already set to 57600 in teraterm and teensy.

    any suggestion or my simple SC is still wrong? thanks all.
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	Capture.PNG 
Views:	70 
Size:	33.0 KB 
ID:	13237  

  2. #2
    Senior Member+ Theremingenieur's Avatar
    Join Date
    Feb 2014
    Location
    Colmar, France
    Posts
    2,600
    4 things:
    1.) Voltage: The Arduino UNO is an old-fashioned 5V device, the Teensy 3.2 a modern 3.3V device. Please make sure that your RF modules can work with 3.3V logic levels (should normally if these are modern, too). If not, take a 74HCT245 or a 74LV1T125 out of the drawer and put it between Teensy TX and rf mod RX as a level converter.
    2.) Serial port: Depends on where you connect your modules. When using pins 0 and 1, #define print_serial Serial1. When using pins 9 and 10, #define print_serial Serial2. When using pins 7 and 8, #define print_serial Serial3.
    3.) Common sense: Don't forget to cross RX and TX lines - Teensy TX goes to rf mod RX and vice versa.
    4.) Common ground: Besides the RX and TX lines, the ground pins of the Teensy and the RF module must be connected together, too.

  3. #3
    All that points already done,but still uncorrect data received..

  4. #4
    Senior Member+ Theremingenieur's Avatar
    Join Date
    Feb 2014
    Location
    Colmar, France
    Posts
    2,600
    What does the oscilloscope (or the logic analyzer) on the Teensy's TX pin1 tell when you send the 'b' character? Please post a picture or screenshot.

    You wrote that you set the 57600 baud rate in Teraterm, but did you also change the baud rate inside the rf modules? Perhaps these are not aware of your speed change. Try with print_serial.begin(9600) to come closer to that ugly softwareSerial and revert Teraterm also (temporarily) to 9600.

  5. #5
    Quote Originally Posted by Theremingenieur View Post
    What does the oscilloscope (or the logic analyzer) on the Teensy's TX pin1 tell when you send the 'b' character? Please post a picture or screenshot.

    You wrote that you set the 57600 baud rate in Teraterm, but did you also change the baud rate inside the rf modules? Perhaps these are not aware of your speed change. Try with print_serial.begin(9600) to come closer to that ugly softwareSerial and revert Teraterm also (temporarily) to 9600.
    ok i'll try it with osci. soon,
    where can i change or know the baudrate of my RF?

    i have try almost all of the baudrate size that exist in serial. but still uncorrect data received.
    this with baudrate 9600.
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	Capture1.PNG 
Views:	63 
Size:	18.0 KB 
ID:	13243  

  6. #6
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    13,932
    Most devices specify a default or initial baud rate - device specific documents would indicate that and if it can be changed. Some devices emit a startup string the osc might catch that - or have a Teensy running at standard baud rates in turn reading any available characters from Serial3 and echoing them to USB Serial to observe as you power up the device when connected - then repeat as needed altering the Teensy program baud rate and restarting the device.

    Not seeing any indication of what the 915 MHz RF device is :: part # or model# or link to the supplier or even a photo might help get to the needed info.

  7. #7
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    24,100
    You can get much better help when you show us (not tell, but actually show) what you're really doing. Specific part numbers or product name/model for the modules & whatever non-Teensy USB-serial hardware you really using would be a good start. Photos showing (again, show, don't just tell) how you've actually connected the wires are also a good idea.

    Often these sorts of problems are simple misunderstandings. If you look over the many threads on this forums, we're surprisingly good at guessing what's wrong when we can see. But without details, we still try blind guessing, but it's not nearly as effective at actually helping. You can really help us to help you by posting better info to actually show us what you're really doing.

  8. #8
    https://www.banggood.com/3DR-Radio-T...r_warehouse=CN ,this link is the RF that i use

    ive made pcb wiring for my teensy and sensor Click image for larger version. 

Name:	274845.jpg 
Views:	114 
Size:	114.1 KB 
ID:	13244
    and this is the receiver driver Click image for larger version. 

Name:	Captur2e.PNG 
Views:	48 
Size:	10.0 KB 
ID:	13245
    Last edited by farhantandia; 03-10-2018 at 09:38 AM.

  9. #9
    yes with osc we'll know exactly what happened, ill try it soon.

  10. #10
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    24,100
    Quote Originally Posted by farhantandia View Post
    i have try almost all of the baudrate size that exist in serial. but still uncorrect data received.
    this with baudrate 9600.
    The setting that matters most is this line:

    Code:
    print_serial.begin(57600);
    If you're changing settings on your PC but not editing that line and uploading the new code to Teensy, then everything is still the same on the Teensy side.

    For the COM port to Teensy, your PC's baud setting is ignored, so you can avoid wasting time with changes to COM4. Teensy's speed will only depend on that line in your code.

  11. #11
    Senior Member+ Theremingenieur's Avatar
    Join Date
    Feb 2014
    Location
    Colmar, France
    Posts
    2,600
    Had just a quick look onto these devices and their description. Their default baudrate seems effectively to be 9600. This can be changed by AT commands for the transmitter and RT commands for the receiver.

    I think what’s troubling here, are the manifold places where the baudrate would have to be changed: The Teensy UART, the transmitter’s UART, the receiver’s UART, Window’s virtual USB com port, and the Terminal program. All have to be set to the same baud rate to make things work.

  12. #12
    Quote Originally Posted by Theremingenieur View Post
    Had just a quick look onto these devices and their description. Their default baudrate seems effectively to be 9600. This can be changed by AT commands for the transmitter and RT commands for the receiver.

    I think what’s troubling here, are the manifold places where the baudrate would have to be changed: The Teensy UART, the transmitter’s UART, the receiver’s UART, Window’s virtual USB com port, and the Terminal program. All have to be set to the same baud rate to make things work.
    teensy baudrate set in SC, receiver & transmitter rf module baudrate is 57600 bcs i test on arduino it work in that baudrate not in other baudrate.all have set in 57600 following the rf baudrate, but still it sends unidentify char. or val.

  13. #13
    Quote Originally Posted by PaulStoffregen View Post
    The setting that matters most is this line:

    Code:
    print_serial.begin(57600);
    If you're changing settings on your PC but not editing that line and uploading the new code to Teensy, then everything is still the same on the Teensy side.

    For the COM port to Teensy, your PC's baud setting is ignored, so you can avoid wasting time with changes to COM4. Teensy's speed will only depend on that line in your code.
    ive editing that too bcs 57600 is the rf baudrate. but still.

  14. #14
    Click image for larger version. 

Name:	Cap1ture.PNG 
Views:	66 
Size:	3.3 KB 
ID:	13259
    after i try many times, the tx led in transmitter and rx led in receiver are blinked, maybe it is the sign of data communication. but the data is not displayed in monitor, just the white char. cursor in teraterm is blinking.
    the difference, in uno tx led is 1 blinking /second, but in teensy is faster like 2x or 3x speed of led blink in uno. are you know what is happened? thanks for your help guys .
    Last edited by farhantandia; 03-11-2018 at 09:59 AM.

Posting Permissions

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