JTAG UART port in NIOS.

Slides:



Advertisements
Similar presentations
Nios Multi Processor Ethernet Embedded Platform Final Presentation
Advertisements

Device Drivers. Linux Device Drivers Linux supports three types of hardware device: character, block and network –character devices: R/W without buffering.
INPUT-OUTPUT ORGANIZATION
Nirmalya Roy School of Electrical Engineering and Computer Science Washington State University Cpt S 122 – Data Structures Characters and Strings.
Avalon Switch Fabric. 2 Proprietary interconnect specification used with Nios II Principal design goals – Low resource utilization for bus logic – Simplicity.
HW/SW Interface Operating Systems Design and Implementation.
My First Nios II for Altera DE2-115 Board 數位電路實驗 TA: 吳柏辰 Author: Trumen.
NIOS II Ethernet Communication Final Presentation
I/O Hardware n Incredible variety of I/O devices n Common concepts: – Port – connection point to the computer – Bus (daisy chain or shared direct access)
Hardware/software Interfacing. Page 2 Interrupt handling and using internal timer Two way for processor to accept external input: Waiting for input: Processor.
CSS 372 Oct 2 nd - Lecture 2 Review of CSS 371: Simple Computer Architecture Chapter 3 – Connecting Computer Components with Buses Typical Bus Structure.
Programming I/O for Embedded System. Page 2 Overview Basis: A DE2 Computer Architecture Parallel I/O 7-Segment Display Basic Manipulating 7-Segment Display.
ECE Department: University of Massachusetts, Amherst Lab 1: Introduction to NIOS II Hardware Development.
Dr. Kimberly E. Newman Hybrid Embedded wk3 Fall 2009.
Practical Session No. 10 Input &Output (I/O). I/O Devices Input/output (I/O) devices provide the means to interact with the “outside world”. An I/O device.
Optrex LCD in NIOS. Page 2 Optrex LCD introduction The Optrex LCD controller core with Avalon® Interface (LCD controller core) provides the hardware.
Lecture 7 Lecture 7: Hardware/Software Systems on the XUP Board ECE 412: Microcomputer Laboratory.
USB 2.0 to SD-Card File Transfer
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
Chapter 3: Introduction to C Programming Language C development environment A simple program example Characters and tokens Structure of a C program –comment.
OS Implementation On SOPC Final Presentation
Eye-RIS. Vision System sense – process - control autonomous mode Program stora.
INPUT-OUTPUT ORGANIZATION
By: Nadav Haklai & Noam Rabinovici Supervisors: Mike Sumszyk & Roni Lavi Semester:Spring 2010.
USB host for web camera connection
USB host for web camera connection
LSU 10/22/2004Serial I/O1 Programming Unit, Lecture 5.
COMPUTER SYSTEM LABORATORY Lab10 - Sensor II. Lab 10 Experimental Goal Learn how to write programs on the PTK development board (STM32F207). 2013/11/19/
OS Implementation On SOPC Midterm Presentation Performed by: Ariel Morali Nadav Malki Supervised by: Ina Rivkin.
UART and UART Driver B. Ramamurthy.
Project Goals 1.Get to know Quartus SoPC builder environment 2.Stream 2.Stream Video 3.Build 3.Build foundation for part B - Tracking system.
ECE Department: University of Massachusetts, Amherst Using Altera CAD tools for NIOS Development.
Binary Search Tree For a node: The left subtree contains nodes with keys less than the node's key. The right subtree contains nodes with keys greater than.
chap13 Chapter 13 Programming in the Large.
Input/Output. I/O Initiation & Control  Transfer of data between circuitry external to the microprocessor and the microprocessor itself.  Transfer of.
Basic I/O Interface A Course in Microprocessor
1. Introduction 2. Methods for I/O Operations 3. Buses 4. Liquid Crystal Displays 5. Other Types of Displays 6. Graphics Adapters 7. Optical Discs 10/01/20151Input/Output.
1 Nios II Processor Architecture and Programming CEG 4131 Computer Architecture III Miodrag Bolic.
CP104 Introduction to Programming File I/O Lecture 33 __ 1 File Input/Output Text file and binary files File Input/output File input / output functions.
I/O Example: Disk Drives To access data: — seek: position head over the proper track (8 to 20 ms. avg.) — rotational latency: wait for desired sector (.5.
Computer Architecture Lecture10: Input/output devices Piotr Bilski.
NIOS II Ethernet Communication Final Presentation
1 Presented By: Eyal Enav and Tal Rath Eyal Enav and Tal Rath Supervisor: Mike Sumszyk Mike Sumszyk.
Chapter 13 – I/O Systems (Pgs ). Devices  Two conflicting properties A. Growing uniformity in interfaces (both h/w and s/w): e.g., USB, TWAIN.
Proposal for an Open Source Flash Failure Analysis Platform (FLAP) By Michael Tomer, Cory Shirts, SzeHsiang Harper, Jake Johns
I/O Interface. INTRO TO I/O INTERFACE I/O instructions (IN, INS, OUT, and OUTS) are explained. Also isolated (direct or I/O mapped I/O) and memory-mapped.
LonWorks Introduction Hwayoung Chae.
Networked Embedded Systems Pengyu Zhang EE107 Spring 2016 Lecture 8 Serial Buses.
Real Numbers Device driver process within the operating system that interacts with I/O controller logical record 1 logical record 2 logical record 3.
Lab 4 HW/SW Compression and Decompression of Captured Image
Serial mode of data transfer
Module 12: I/O Systems I/O hardware Application I/O Interface
HIBI_PE_DMA Example.
1 Input-Output Organization Computer Organization Computer Architectures Lab Peripheral Devices Input-Output Interface Asynchronous Data Transfer Modes.
UART and UART Driver B. Ramamurthy.
My First Nios II for Altera DE2-115 Board
Avalon Switch Fabric.
System Interconnect Fabric
CSCI 315 Operating Systems Design
Bare Metal System Software Development
UART and UART Driver B. Ramamurthy.
I/O in C Lecture 6 Winter Quarter Engineering H192 Winter 2005
I/O Systems I/O Hardware Application I/O Interface
CS703 - Advanced Operating Systems
Weeks 9-10 IO System Calls Standard IO (stdin, stdout) and Pipes
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
Bare Metal System Software Development
Chapter 13: I/O Systems.
Presentation transcript:

JTAG UART port in NIOS

JTAG UART introduction The JTAG UART core with Avalon interface implements a method to communicate serial character streams between a host PC and an SOPC Builder system on an Altera JTAG UART core eliminates the need for a separate RS-232 serial connection to a host PC for character I/O The core provides an Avalon interface that hides the complexities of the JTAG interface from embedded software programmers.

JTAG UART fundamental

Avalon Slave Interface and Registers The JTAG UART core provides an Avalon slave interface to the JTAG circuitry on an Altera FPGA. The user-visible interface to the JTAG UART core consists of two 32-bit registers data and control accessed through an Avalon slave port. Avalon master accesses the registers to control the core and transfer data over the JTAG connection. 8-bit units of data at a time; eight bits of the data register serve as a one-character payload. The JTAG UART core provides an active-high interrupt output that can request an interrupt when read data is available, or when the write FIFO is ready for data

Read and Write FIFOs The JTAG UART core provides bidirectional FIFOs to improve bandwidth over the JTAG connection Read/write to JTAg UART data register will pop/push data into FIFO Length: 64 Byte, width: 8-bit

Host-Target Connection

Instantiating the Core in SOPC Builder Write FIFO Settings Depth: Depth: The write FIFO depth can be set from 8 to 32,768 bytes. IRQ Threshold: The write IRQ threshold governs how the core asserts its IRQ in response to the FIFO emptying Construct using registers instead of memory blocks: Turning on this option causes the FIFO to be constructed out of on-chip logic resources

Instantiating the Core in SOPC Builder Read FIFO Settings Depth: Depth: The read FIFO depth can be set from 8 to 32,768 bytes. IRQ Threshold: The read IRQ threshold governs how the core asserts its IRQ in response to the FIFO emptying Construct using registers instead of memory blocks: Turning on this option causes the FIFO to be constructed out of on-chip logic resources

Software Programming Model HAL library support Communicate through HAL device driver Programming in register-level

HAL System Library Support Nios II programs treat the JTAG UART core as a character mode device, and send and receive data using the ANSI C standard library functions, such as getchar() and printf() Example 5–1 demonstrates the simplest possible usage, printing a message to stdout using printf()

Header files needed altera_avalon_jtag_uart.h This file have the declaration of HAL system library device driver

Setup I/O device in Nios IDE 3 default system I/O file devices in HAL, use BSP editor to assign character I/O ports to them

Example of using printf() for jtag uart output

Example of using printf() for jtag uart output #include “stdio.h” int main() { char c; scanf(“%c”,c); return 1; }

Connect JTAG UART with file I/O JTAG UARG driver provided by HAL allows device I/O through file operation Device name “/dev/jtag_uart_name” Functions: Open, Close, Write, Read

Example of jtag uart I/O

I/O through register access Low level I/O operation Need fewer HAL support Difficult to implement Needed when writing device driver or programming without HAL support

Header files needed altera_avalon_jtag_uart_regs.h This file defines the core's register map, providing symbolic constants to access the low-level hardware. The symbols in this file are used only by device driver functions

JTAG UART Register File

JTAG UART Register File

JTAG UART interrupts The JTAG UART core has two kinds of interrupts: write interrupts and read interrupts. The WE and RE bits in the control registe enable/disable the interrupts

JTAG UART interrupts The read interrupt condition is set whenever the read FIFO has read_threshold or fewer spaces remaining The write interrupt condition is set whenever the write FIFO has read_threshold or fewer spaces remaining

Read character from JTAG UART Step 1: Read data register c=IORD_ALTERA_AVALON_JTAG_UART_DATA(JTAG_UART_BAS E) // read character from JTAG UART port Step 2: test valid bit c & ALTERA_AVALON_JTAG_UART_DATA_RVALID_MSK // ALTERA_AVALON_JTAG_UART_DATA_RVALID_MSK= 0x00008000 Step 3: if valid, copy lower 8 bits (data) out c & ALTERA_AVALON_JTAG_UART_DATA_DATA_MSK;

Read character from JTAG UART While(1) { c=IORD_ALTERA_AVALON_JTAG_UART_DATA(JTAG_UART_BA SE); if(c & ALTERA_AVALON_JTAG_UART_DATA_RVALID_MSK) data=c & ALTERA_AVALON_JTAG_UART_DATA_DATA_MSK); break; }

Send character to JTAG UART port IOWR_ALTERA_AVALON_JTAG_UART_DATA(JTAG_ UART_BASE, data) Data will be sent to JTAG_UARG and received by Host PC terminal.

Variable Argument List Function declaration usually looks like: Function (arg1,arg2,…arg n) but some function has a special format, the argument list is not fixed until called printf(“%d,%d,%s”,a,b,str)

Variable Argument List How to implement function with variable argument list? C convention: argument order in stack High address… … Arg 2 Arg 1 Low address…

Macro definition in stdarg.h typedef char* va_list; #define _va_start(ap,v) ( ap = (va_list)_ADDRESSOF(v) + _INTSIZEOF(v) ) #define va_arg(ap,t) ( *(t *)((ap += _INTSIZEOF(t)) - _INTSIZEOF(t)) ) #define va_end(ap) ( ap = (va_list)0 )

How to get var arg address ap points to nex var arg after call va_arg(ap,t) High address… …. Var arg 1 Fixed arg n (v) … Fixed arg 2 Fixed arg 1 Low address… ap points to first var arg after va_start(ap,v)

Code sample #include “stdarg.h” void my_printf(char * arg, ...) { int i=0; int param_num=0; va_list ap; printf("number of param is %s\n",arg); param_num=atoi(arg); va_start(ap, arg); for(i=0;i<param_num;i++) printf("The %dth param is %d\n",i+1,va_arg(ap,int)); } va_end(ap);

Summary JTAR UART on DE2 board Introduction HAL supports Register file and register access Interrupts Data transmission through JTAG UART port Variable argument lists