XBee Project Cannot Send from Teensy, but Can Receive

Status
Not open for further replies.

Trajectory989

New member
Hi guys,

I am having some difficulty getting an XBee project to work. I am trying to get my 2 XBee PRO 900HP 10K XBees to offer 2 way communication using the XBee library (API mode stuff).

I have several settings changed (including the Baud (changed to 57600), Parity (changed to Even), Encryption (enabled, and both XBees given matching key values), Network ID (explicitly set to match each other), and Node Identifiers (because names are cool and make for easy NI valued AT requests)). Both XBees were configured using XCTU and when I use XCTU with both of them I can communicate in both directions without fail. And as I know someone is bound to ask this: Yes, I am using AP=2 (API mode with escapes).

When I connect up one of them to my Teensy 3.6 using the Serial3 pins (pin 7 connected to DOUT on XBee, pin 8 to DIN on XBee, power pins as needed) and use the following program:

Code:
#define DebugSerial Serial
#define XBeeSerial Serial3

#include <XBee.h>
#include <Printers.h>

XBeeWithCallbacks xbee;

//addresses for XBees in use
XBeeAddress64 GroundStation(0x0013A20041A59F7B);
XBeeAddress64 Avionics(0x0013A20041895B16);

unsigned long last_tx_time = 0;

void setup() {
  DebugSerial.begin(115200);
  delay(500);
  DebugSerial.println("Starting...");
  // Setup XBee serial communication
  XBeeSerial.begin(57600);
  xbee.begin(XBeeSerial);
  delay(500);
  xbee.onResponse(printResponseCb, (uintptr_t)(Print*)&DebugSerial);
  AtCommandRequest req((uint8_t*)"VR");
  xbee.send(req);
}

void loop() {
  // put your main code here, to run repeatedly:
  xbee.loop();
  
}

This program attempts to read the AT value VR from the XBee, but nothing happens. Similar can be said for Transmit requests and just about anything else where the Teensy sends commands to the XBee. However, if I send data to the Teensy XBee from the XCTU connected one, I properly pick it up on the Teensy and display it to the Serial monitor. I get all information in the form of a ZBRxResponse and all information in it is correct.

So how is it that I might be able to receive but not transmit? I have already verified that the Teensy is making the correct frame with escapes and all. The right message is going to the XBee serial (I have spent the last day and a half delving deep into the XBee.h and XBee.cpp files in the XBee library to verify this). What could I be missing? I need to be able to send out Transmit and Remote AT Requests from the Teensy, as well as properly receive Transmit Status information for my project.
 
When I do that, I no longer receive messages on the Teensy. I think being able to receive messages implies that I have the Rx hooked up correctly....therefore I believe my pins are correct.
 
Status
Not open for further replies.
Back
Top