Intel® FPGA University Program
University Program Material, Education Boards, and Laboratory Exercises
1174 Discussions

UART with NIOS II on DE0 Nano

Altera_Forum
Honored Contributor II
2,927 Views

Hi, I'm having trouble establishing communication between my DE0 Nano and my computer. I'm trying to do this using an FTDI usb to TTL chip (FT232R) and using the Platform Designer to create a UART IP which talks to a NIOS2 processor. 

I've attached a screen shot of my Platform Designer configuration. I basically followed the steps in the tutorial Introduction to the QSys Tool, but instead of using a JTAG UART, I'm using a RS 232 UART. I have also attached my C code for running on the NIOS processor (this is slightly adapted from another Altera tutorial). 

I have verified that I'm connected to the correct GPIO pins for RX and TX and I have the same baud settings, stop bits, parity, flow control. The code compiles and runs fine but nothing is ever transmitted or received over the UART. When I step through the code, I see that the control register of the UART is always zeros. So my code thinks there is zero space remaining in the write buffer and therefore never sends any characters. This makes me think that it somehow is using the wrong base address in memory, but I changed the base address to match that in the Platform designer. I'm really not sure what the best way to debug this is. Any help would be greatly appreciated. 

 

Thanks, 

Carson
0 Kudos
6 Replies
Altera_Forum
Honored Contributor II
822 Views

I never was able to figure this out. Any help would still be appreciated.

0 Kudos
Altera_Forum
Honored Contributor II
822 Views

Your pictures are too small to see anything. 

 

Did you use the .sopcinfo file from Qsys (Platform Designer) to generate a BSP project? This generates a header file that has macros you should use for accessing the correct addresses of components in the system.
0 Kudos
Altera_Forum
Honored Contributor II
822 Views

Thanks for the response. I attached my C code and the sopcinfo file to the original post. I didn't find a way to make the pictures larger.  

I looked through the sopcinfo file and it confirms the same base address for the uart (0x2000), which is what I've defined in my code. I'm also using the switches and LEDs on my board through memory mapped PIOs and these seem to work (I can set the LEDs and read from the switches using code running on the NIOS). I did not do any sort of auto generation of a BSP project. Not sure how to do that or whether I would need to for such a simple test.
0 Kudos
Altera_Forum
Honored Contributor II
822 Views

There always has to be a BSP project associated with your application project in Eclipse, no matter the design.

0 Kudos
Altera_Forum
Honored Contributor II
822 Views

I am not using Eclipse. Just the Altera Monitor program. Everything worked perfectly when I had a JTAG UART but when I swap in an RS232 UART, it doesn't work

0 Kudos
Altera_Forum
Honored Contributor II
822 Views

I finally got it to work. In QSys, I was using the component: Interface Protocols > Serial > UART (RS-232 Serial Port). There is another UART IP in: University Program > Communications > RS232 UART. That one works.

0 Kudos
Reply