Go Down

Topic: How to send the Debug prints over USB in Leonardo Using USART. (Read 1 time) previous topic - next topic

pradeepsalloju

hi guys...
i am trying to send the serial prints to serial console (Serial Terminal in My computer) using the serial.print(); function in Arduino Leonardo board.

I observed that , Leonardo initializing the USART registers internally when Serial.begin() ; function was called (as defined in HardwareSerial.cpp and HardwareSerial.h) , and when Serial.print("Hello world"); called Data is sending over to the UDR register in USART. but hardware connection was to D+ and D- USB pins on board and which were connected to the CPU USB port. finally i am not understanding how that USART data is printing on Serial Console over USB communication can anyone can help in understanding this data transmission.

Robin2


i am trying to send the serial prints to serial console


finally i am not understanding how that USART data is printing on Serial Console over USB communication can anyone can help in understanding this data transmission.


I'm not sure whether Serial.print() works properly for you and you are just interested in how that is done, OR whether Serial.print() does not work.

If Serial.print() does not work please post your code.

I have never had problems with Serial.print() on my Leoonardo, but I have not studied the underlying code.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

Grumpy_Mike

Serial.print on the Leonardo does not use the hardware UART, that is used by Serial1.print and goes only to the hardware pins 0 & 1.

sepp2gl

Hi guys,
looking  over this thread it seems to be unsolved since 2014.
As I am facing the same issue right now, I am still interested in a solution.
Was there any solution worked out in the background?
thx4 response,
sepp2gl

Robin2

looking  over this thread it seems to be unsolved since 2014.
As I am facing the same issue right now, I am still interested in a solution.
This Thread has been 5 years dead.

Have you read, understood and taken into account the info in Replies #1 and #2 ?

If that does not solve your problem then post your program and describe exactly what it does and what you want it to do that is different.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

Riva

Also remember/realize that after uploading a sketch and the Leonardo resets it will take a while for the computer to notice the new serial port created by the Leonardo.
You either need to put a delay() after your Serial.begin() or use
Code: [Select]
 while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB
  }

to pause the sketch until the Serial port is connected.
Don't PM me for help as I will ignore it.

sterretje

Hi guys,
looking  over this thread it seems to be unsolved since 2014.
As I am facing the same issue right now, I am still interested in a solution.
Was there any solution worked out in the background?
thx4 response,
sepp2gl
You will have to give a decent description of the problem. The initial problem refers to the USART hardware and the HardwareSerial core functions which, as Grumpy_Mike indicated, has nothing to do with the Serial on a Leonardo.

If you understand an example, use it.
If you don't understand an example, don't use it.

Electronics engineer by trade, software engineer by profession. Trying to get back into electronics after 15 years absence.

Go Up