I am trying to communicate using XBee chips to a NodeMCU and for the NodeMCU to read that data and perform a function but I am having trouble with the NodeMCU not reading data from Serial.
I have the XBee router tx connected to the NodeMCU tx and rx to rx. The XBee coordinator is connected via a debug board to my pc.
I observe following:
When NodeMCU USB is connected and tx and rx pins are connected to XBee router serial console input is successfully transmitted and received by the XBee coordinator Serial data sent via the XBee coordinator is successfully received by the NodeMCU and output to the serial console. Note, it is not read via the Serial.Read() commands on the NodeMCU. That is:
NodeMCU Console -> NodeMCU TX -> XBee Router TX -> XBee Coordinator RX XBee Coordinator TX -> XBee Router RX -> NodeMCU RX -> NodeMCU Console
When NodeMCU USB is connected and tx and rx pins are not connected Serial console input is read by NodeMCU serial.read commands and Serial.Write commands are output to the NodeMCU serial console. That is:
NodeMCU Console -> Serial.Read() Serial.Write() -> NodeMCU Console
This all confirms that data is successfully be received and transmitted, However, when usb is not connected and I power the NodeMCU 5v on VIN (USB power only) and the tx and rx connected to the XBee router then Serial.Write commands on the NodeMCU are not received via the XBee coordinator and XBee coordinator transmitted data is not received (I have code that will set a pin high on receiving data).
I have verified that the XBee router is powered on and visible to the XBee coordinator and do not now why the Serial.Read will not read the data coming in on the RX pin, and the Serial.Write will not write data to the TX pin.