Help! Need to assert DTR on SerialUSB in order to write on h/w Serial1

Hi,

I rolled my own version of a ProMicro board (32u4) with Caterina booatloader. In my sketch I use the Serial (USB) and Serial1 (h/w) ports for communicating with the outside world. I have terminals connected to both Serial and Serial1 to interact with the board.

What I cannot understand is I can only write out of Serial1 whenever the DTR line on Serial is asserted.

The following code illustrates and isolates my issue:

uint8_t n = 0; 

void setup() {
  Serial.begin(57600);
  Serial1.begin(57600); 
}

void loop() {
  while (Serial1.available())
  {
    Serial1.read();
    Serial.write(n);
    Serial1.write(n++);
  }
}

Issue:

<Send 3 chars to Serial1>
Return from both Serial and Serial1: 01 02 03

Nothing out of Serial or Serial1 Return from both Serial and Serial1: 07 08 09

Please help?

Why are you Double Posting the same issue

Double posting wastes everyone's time

Please click Report to Moderator and ask to have your 2 Threads merged.

...R

Hi Robin,

As you can see in the other thread it turns out the mentioned library was not related to the issue. I have therefore already asked the moderator to delete that thread.

My apology if you feel I have wasted your time.

The other Thread seems to be locked now.

This is a very strange program

while (Serial1.available())
  {
    Serial1.read();
    Serial.write(n);
    Serial1.write(n++);
  }

What happens with something straightforward like

void loop() {
   Serial1.println("hello world");
   delay(1000);
}

...R

The same. Only data out on Serial1 if DTR is asserted on Serial...

adhy:
The same. Only data out on Serial1 if DTR is asserted on Serial...

Please post the complete program that gave rise to that comment - the devil is in the detail

I wonder is there something unusual in your hardware or bootloader. What exactly do you mean by "I rolled my own version of a ProMicro board (32u4)"

How is Serial1 on your "ProMicro" connected to whatever is displaying its output - and what is it connected to?

Have you tried your test program on a regular ProMicro or Leonardo?

...R

I solved it, thanks to your suggestions!

Serial1 is connected to an RS485 transceiver. Turns out the PCB trace driving the data direction pin was cut, and the pin therefore floating. For some reason toggling DTR on Serial pulled the floating pin up/ down...

Thanks!

Good to hear you have a solution.

That sort of problem can be difficult to track down.

...R