• 0
aeon20

How to determine UART port in Linux?

Question

In the following guide:

https://reference.digilentinc.com/vivado/getting-started-with-ipi/start?_ga=2.157204989.738863100.1553677249-924004044.1549634437

At the bottom, it states:

"The appropriate port to connect to can be determined by reviewing the Device Manager in Windows."

I'm using Linux, how can I determine the port to connect to so I can view UART messages? What should I use to connect to it?

Share this post


Link to post
Share on other sites

15 answers to this question

Recommended Posts

  • 0
Posted (edited)

@aeon20

I posted this answer a while ago:

Here is an edited example session telling me to use Putty with ttyUSB0:

In a Linux Terminal window type: lsusb
Bus 005 Device 003: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port

In a Linux Terminal window type: dmesg | grep tty
console [tty0] enabled
serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
00:0b: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
usb 5-2.1: pl2303 converter now attached to ttyUSB0

If you do a search for 'lsusb' in the site search tool above you can find the full post

It would be nice if someone at Digilent created a "HowTo" section to make it easier for new users to find tips and hints.... just a suggestion.

 

Edited by zygot

Share this post


Link to post
Share on other sites
  • 0

Hi @zygot,

Thanks for the suggestion for the aforementioned HowTo section; we have a number of resources on our Wiki (reference.digilentinc.com for those who don't know the url) but we can create another section on the forum that helps direct users to those materials.

Thanks,
JColvin

Share this post


Link to post
Share on other sites
  • 0

@JColvin

I think that this would be great. Over the years I keep seeing a repeat of the same questions and clearly most users are unable to find a direct line to past responses. Once a few months have past even I (  yeah, I see the irony in those last two words ) have a hard time finding posts that I want to refer to. Some easy way to get to those mostly timeless hints and tips would be helpful to many of us including newbies.

Share this post


Link to post
Share on other sites
  • 0
Posted (edited)

Thanks for the help.

I can't get this to work.

I have:
 

# dmesg |grep tty
[    0.000000] console [tty0] enabled
[    0.471821] 00:01: ttyS0 at I/O 0x3f8 (irq = 4, base_baud = 115200) is a 16550A
[   24.745885] cdc_acm 1-1:1.1: ttyACM0: USB ACM device
[   24.828365] usb 1-2: FTDI USB Serial Device converter now attached to ttyUSB0
[   24.828539] usb 1-2: FTDI USB Serial Device converter now attached to ttyUSB1
[ 1077.049689] cdc_acm 1-1:1.1: ttyACM0: USB ACM device
[ 2845.837523] ftdi_sio ttyUSB0: FTDI USB Serial Device converter now disconnected from ttyUSB0

I have programmed the FPGA. Then I do step 8.3 in the tutorial https://reference.digilentinc.com/vivado/getting-started-with-ipi/start?_ga=2.1642103.738863100.1553677249-924004044.1549634437
 

8.3

Right click on the application project in the Project Explorer, then select Run As → Launch on Hardware (System Debugger).

I try using minicom, as you can see I'm using port /dev/ttyS0.

Welcome to minicom 2.7

OPTIONS: I18n                                                                
Compiled on Apr 22 2017, 09:14:19.                                           
Port /dev/ttyS0, 12:53:04                                                    
                                                                             
Press CTRL-A Z for help on special keys                                      

I expect to see "button state: 000000" something. But instead I see nothing.

I've tried to relaunch, restart minicom, I've tried to reprogram the FPGA.

I have also tried with Putty.

Edited by aeon20

Share this post


Link to post
Share on other sites
  • 0

@aeon20

There are a lot of possibilities. It is also possible to use a terminal in the SDK to capture USB UART data. I haven't done this on Linux. It's difficult trying to follow a tutorial when most of the instructions don't work with your set up. The same thing happens when newer versions of the tool don't work the same as the version that the tutorial was written for.

I suggest trying to separate your Linux COM port issues from your Vivado/SDK issues. Try to make sure that you can work a serial interface terminal program with *something* so that it isn't part of your debugging. When you have the possibility of a lot of parts not working you need to start establishing that each of the parts work separately one by one.

Perhaps you can find a known good configuration file for your FPGA board that continually sends out text to the UART when  button is pressed.. or similar action happens.

Share this post


Link to post
Share on other sites
  • 0
1 minute ago, zygot said:

@aeon20

There are a lot of possibilities. It is also possible to use a terminal in the SDK to capture USB UART data. I haven't done this on Linux. It's difficult trying to follow a tutorial when most of the instructions don't work with your set up. The same thing happens when newer versions of the tool don't work the same as the version that the tutorial was written for.

I suggest trying to separate your Linux COM port issues from your Vivado/SDK issues. Try to make sure that you can work a serial interface terminal program with *something* so that it isn't part of your debugging. When you have the possibility of a lot of parts not working you need to start establishing that each of the parts work separately one by one.

Perhaps you can find a known good configuration file for your FPGA board that continually sends out text to the UART when  button is pressed.. or similar action happens.

My only problem right now is probably the UART/serial data issue.

I can see that the code runs on the FPGA board -- all the LEDs light up when I press a button, just as the code intends.

Hence, my only problem now is actually being able to see the data.

Share this post


Link to post
Share on other sites
  • 0
5 minutes ago, aeon20 said:

I can see that the code runs on the FPGA board -- all the LEDs light up when I press a button, just as the code intends.

They don't drive your uart do they? What is your uart connected to? Is the problem hardware or software or SDK related? A known good design that uses a uart will help confirm your assumptions or make you reassess your situation.

Share this post


Link to post
Share on other sites
  • 0
6 minutes ago, zygot said:

They don't drive your uart do they? What is your uart connected to? Is the problem hardware or software or SDK related? A known good design that uses a uart will help confirm your assumptions or make you reassess your situation. 

This is my block diagram. I've used the following design https://reference.digilentinc.com/vivado/getting-started-with-ipi/start?_ga=2.256868941.738863100.1553677249-924004044.1549634437

This should be a good and well-known design that should work?

block_diagram2.thumb.jpg.9ec0e1340e8023374767eb93eaca6da6.jpg

Share this post


Link to post
Share on other sites
  • 0

Hi @aeon20,

As zygot surmised, the design is not driving UART; I looked through the tutorial you were going through and evidently we forgot to explicitly add the step in the Microblaze subsection to add in the AXI Uartlite IP block; it is referenced a few other times later in the tutorial (and clearly expects you to have it). I'll make sure this gets added in to the tutorial today.

What you would need to do to correct this is to add the USB UART block to your design from the board tab of your block design (same location as where you got the system clock in section 4.3). To ensure everything gets connected correctly, I would recommend starting fresh since Vivado doesn't necessarily "fix" connections between blocks. You can add the UART block before or after you add the Microblaze IP (though before running "Block automation")

Let me know if you have any questions about this.

Thanks,
JColvin

Share this post


Link to post
Share on other sites
  • 0
Posted (edited)
On 3/29/2019 at 5:16 PM, JColvin said:

Hi @aeon20,

As zygot surmised, the design is not driving UART; I looked through the tutorial you were going through and evidently we forgot to explicitly add the step in the Microblaze subsection to add in the AXI Uartlite IP block; it is referenced a few other times later in the tutorial (and clearly expects you to have it). I'll make sure this gets added in to the tutorial today.

What you would need to do to correct this is to add the USB UART block to your design from the board tab of your block design (same location as where you got the system clock in section 4.3). To ensure everything gets connected correctly, I would recommend starting fresh since Vivado doesn't necessarily "fix" connections between blocks. You can add the UART block before or after you add the Microblaze IP (though before running "Block automation")

Let me know if you have any questions about this.

Thanks,
JColvin

Thanks.

(Edit: Sorry, I made a mistake that I corrected, I wrote at first that now it doesn't look like it runs code at all, but this is working now).

I've followed the new version of the tutorial. I started a new project from scratch. However, I don't get anything over serial.

tried with Putty (running as root), using /dev/ttyS0 and 9600 baud, 8 data bits, no parity bits, 1 stop bit (also tried 115200 baud), confirmed by dmesg:

# dmesg |grep tty
[    0.000000] console [tty0] enabled
[    0.479388] 00:01: ttyS0 at I/O 0x3f8 (irq = 4, base_baud = 115200) is a 16550A
[   10.253071] cdc_acm 1-1:1.1: ttyACM0: USB ACM device
[   10.272354] usb 1-2: FTDI USB Serial Device converter now attached to ttyUSB0
[   10.272542] usb 1-2: FTDI USB Serial Device converter now attached to ttyUSB1
[ 1626.079324] cdc_acm 1-1:1.1: ttyACM0: USB ACM device
[ 1986.688788] ftdi_sio ttyUSB0: FTDI USB Serial Device converter now disconnected from ttyUSB0
[ 3263.978305] cdc_acm 1-1:1.1: ttyACM0: USB ACM device
[ 4315.373016] cdc_acm 1-1:1.1: ttyACM0: USB ACM device

Tried to program the device again, tried to hit CPU reset, tried some more. Nothing. The device does get programmed, as I can see it stops with the display demo it comes shipped with. I can also see it running code as the LEDs light up. There are also no errors or warnings when I program it.

The block diagram now:

block_design_state.thumb.jpg.84df9ab7d06b87f473c23f0b75f301a7.jpg

The SDK program:

sdk_state.thumb.jpg.b747618b6c7881c612a84140a6bb1485.jpg

 

Edited by aeon20

Share this post


Link to post
Share on other sites
  • 0

Hi @aeon20,

1) Make sure that you have added yourself to the dialout group. Here is a forum thread that shows how to add yourself to the dialout group.

2) Please download Adept 2 here.

                    a) Use Adept 2 from the command line with the command "djtgcfg enum" . What is the terminal text response?

 

best regards,

Jon

 

 

 

Share this post


Link to post
Share on other sites
  • 0
Posted (edited)
20 hours ago, jpeyron said:

Hi @aeon20,

1) Make sure that you have added yourself to the dialout group. Here is a forum thread that shows how to add yourself to the dialout group.

2) Please download Adept 2 here.

                    a) Use Adept 2 from the command line with the command "djtgcfg enum" . What is the terminal text response?

 

best regards,

Jon

 

 

 

Thanks for the help Jon.

I am root when I try to do this, so adding myself to the dialout group shouldn't matter.

However, just  to be sure, I just tried this, and it doesn't change anything, my regular user has the same problem as root, despite being in the dialout group. I also remembered to fully log out and back in, and check that I am indeed in the dialout group.

 

djtgcfg output:
 

# djtgcfg enum
Found 1 device(s)

Device: NexysA7
    Product Name:   Digilent Nexys A7 -100T
    User Name:      NexysA7
    Serial Number:  210292AA7671

 

Edited by aeon20

Share this post


Link to post
Share on other sites
  • 0

Hi @aeon20,

 Have you tried using  /dev/ttyUSB0 and ttyUSB1 set at 9600 baud, 8 data bits, no parity bits, 1 stop bit?

What is your PC's setup? 

     a) Is linux the only OS or are you duel booting or using Linux in a Virtual Machine?

 Also in the SDK screen shot above I see and error in the debug folder and that you had not saved the main.c?  

Have you tried using the hello world sdk template?

best regards,

Jon

Share this post


Link to post
Share on other sites
  • 0
13 hours ago, jpeyron said:

Hi @aeon20,

 Have you tried using  /dev/ttyUSB0 and ttyUSB1 set at 9600 baud, 8 data bits, no parity bits, 1 stop bit?

What is your PC's setup? 

     a) Is linux the only OS or are you duel booting or using Linux in a Virtual Machine?

 Also in the SDK screen shot above I see and error in the debug folder and that you had not saved the main.c?  

Have you tried using the hello world sdk template?

best regards,

Jon

 

Wow. It works on /dev/ttyUSB1 !!

Thanks a lot for all your support!

 

Share this post


Link to post
Share on other sites
  • 0

Hi @aeon20,

Glad to hear that using  /dev/ttyUSB1 worked. Thank you for sharing what you did to get serial communications working.

cheers,

Jon

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now