OK, this has me stumped.
In order to debug a TTN Uno sketch involving a number of sensors and (of course) Lora I’m trying to use the serial TX/RX pins (pin0 and 1) on the board. I can’t get it to work.
So, I’ve stripped the sketch and sensors (zero) down the bare minimum.
Basically, I program via USB and then power via a USB power brick and monitor on pins 0 and 1 with a USB to serial TTL converter and putty.
If I try this with a Uno R3, it works fine (I see the serial comms in putty).
If I try this with the TTN Uno, I get nothing.
Is there something special I need to be doing to get serial out of these pins on a TTN Uno?
Code
void setup()
{
Serial.begin(9600);
}
void loop()
{
int i = 0;
while (true)
{
Serial.print("Message #");
Serial.println(i);
i++;
delay(5000);
}
}
@cslorabox is onto something though. Arduino - ArduinoBoardLeonardo says Serial1 is for the pin0/1 TTL O/P
However, I’m also sure that is the lora serial interface.
TheThingsNetwork examples in the IDE all have #define loraSerial Serial1 #define debugSerial Serial
Taking a squint at the schematic, it occurs to me that pins 0 & 1 are not, as Obi Wan would say, the serial port you are looking for.
The debug serial port that is “Serial” is actually running over USB as a CDC comms device. Pins 0 & 1 are Serial1 which are used to the connection to the RN2483.
So you’ll need to setup a SoftwareSerial on the pins of your choice.
After my last post I was starting to wonder if those pins were connected to the lora serial rather than the ‘console’ serial. When I originally tried to monitor the serial with my original (sensors + lora) I did see some corrupted chars. So that will be the lora comms.
Bother. I’m trying to debug a program when it’s powered from the power socket via an auto-power switch triggered by an RTC, hence serial via USB isn’t suitable (with its integral power).
Can you link me to the schematic. The TTN Uno ‘documentation’ seems light on serial detail (at least in the docs I’ve found. Even a pinout of the TTN Uno appears to be impossible to find.
SoftwareSerial is ‘built-in’ to the Arduino core libraries so it’s in the official docs. Tell it which two pins, don’t run it too fast and it’s all the same as a real serial port.
Most definitely NOT. The USB “serial” interface does not exist anywhere as an actual asynchronous serial “UART” stream, it is emulated ONLY.
On the TTN Uno, Serial1 is I believe, the serial interface to the Lora module.
Plausible. If the documentation confirms that is the case it would mean that there would be no UART available for other purposes.
In that case your options would be to use the USB tunneled scheme by claiming the data at the USB host only, using “software serial”, or not trying to do whatever you were hoping to do with a serial stream at all.