Debugging Debug environments Debug via serial

Slides:



Advertisements
Similar presentations
Chapter 10 Input/Output Organization. Connections between a CPU and an I/O device Types of bus (Figure 10.1) –Address bus –Data bus –Control bus.
Advertisements

Serial I/O - Programmable Communication Interface
Lecture 8: Serial Interfaces
Hierarchy of I/O Control Devices
Better Debugging of Embedded via a Debug Port ECE152.
Spring EE 316 Computer Engineering Junior Lab Serial Ports.
7-1 Digital Serial Input/Output Two basic approaches  Synchronous shared common clock signal all devices synchronised with the shared clock signal data.
16.317: Microprocessor System Design I Instructor: Dr. Michael Geiger Spring 2012 Lecture 29: Microcontroller intro.
Input/Output and Communication
ECE 371- Unit 11 Introduction to Serial I/O. TWO MAJOR CLASSES OF SERIAL DATA INTERFACES ASYNCHRONOUS SERIAL I/O - USES “FRAMING BITS” (START BIT AND.
BLDC MOTOR SPEED CONTROL USING EMBEDDED PROCESSOR
INPUT-OUTPUT ORGANIZATION
Cortex-M3 Debugging System
DPNM Lab., POSTECH 1/25 CS490K - Internet of Things (IoT) Jonghwan Hyun DPNM Lab. Department of Computer Science and Engineering, POSTECH
Intro to the Arduino Topics: The Arduino Digital IO
LSU 10/22/2004Serial I/O1 Programming Unit, Lecture 5.
CHAPTER 5 I/O PRINCIPLE Understand the principles of System Bus
Slides created by: Professor Ian G. Harris Test and Debugging  Controllability and observability are required Controllability Ability to control sources.
UART and UART Driver B. Ramamurthy.
Teachers Name : Suman Sarker Telecommunication Technology Subject Name : Microcontroller & Embedded System Subject Code : 6871 Semester : 7th Department.
Lecture 20: Communications Lecturers: Professor John Devlin Mr Robert Ross.
Universal Asynchronous Receiver/Transmitter (UART)
Embedded System Design Laboratory October 4, 2002Stanford University - EE281 Lecture #3#1 Lecture #3 Outline Announcements AVR Processor Resources –UART.
DEVICES AND COMMUNICATION BUSES FOR DEVICES NETWORK
EE 316 Computer Engineering Junior Lab Serial Ports, LCD Displays & PROMs.
Universal Asynchronous Receiver/Transmitter (UART)
Slides created by: Professor Ian G. Harris Typical Embedded C Program #include main() { // initialization code while (1) { // main code }  #include is.
25 April 2000 SEESCOASEESCOA STWW - Programma Evaluation of on-chip debugging techniques Deliverable D5.1 Michiel Ronsse.
PPI-8255.
CSCI1600: Embedded and Real Time Software Lecture 16: Advanced Programming with I/O Steven Reiss, Fall 2015.
Lecture Overview Shift Register Buffering Direct Memory Access.
CE-2810 Dr. Mark L. Hornick 1 Serial Communications Sending and receiving data between devices.
Serial Communication RS-232. In order to make two devices communicate, whether they are desktop computers, microcontrollers, or any other form of integrated.
Microcontroller basics Embedded systems for mortals.
Microcontroller basics Embedded systems for mortals.
Timothy Kritzler and Joseph Mintun Sponsor: Martin Engineering, Illinois Advisors: Dr. Malinowski and Dr. Ahn Bradley University Electrical and Computer.
Digital Logic Design Alex Bronstein
Computer System Structures
DIRECT MEMORY ACCESS and Computer Buses
Serial Communications
Michael Rahaim, PhD Candidate Multimedia Communications Lab
Assist. Prof. Rassim Suliyev - SDU 2017
Lecture 2 Interrupts.
EE 107 Fall 2017 Lecture 5 Serial Buses – UART & SPI
Microcontroller basics
Input/Output and Communication
Serial I/O and Data Communication.
Arduino Part 1 Topics: Microcontrollers Programming Basics
SERIAL PORT PROGRAMMING
1 Input-Output Organization Computer Organization Computer Architectures Lab Peripheral Devices Input-Output Interface Asynchronous Data Transfer Modes.
UART and UART Driver B. Ramamurthy.
E3165 DIGITAL ELECTRONIC SYSTEM
CS703 - Advanced Operating Systems
Atmega32 Serial Programming Basics
Chapter 8 Input/Output I/O basics Keyboard input Monitor output
Structures Collection of several variables under a single name
Computer Organization and Design
CSCI 315 Operating Systems Design
Intro to the Arduino Topics: The Arduino Digital IO
Asynchronous Serial Communications
UART and UART Driver B. Ramamurthy.
Serial Communication Interface: Using 8251
UART Protocol Chapter 11 Sepehr Naimi
Преглед Начин функционисања Имплементације
COMPUTER PERIPHERALS AND INTERFACES
CHAPTER SERIAL PORT PROGRAMMING. Basics of Serial Communication Computers transfer data in two ways: ◦ Parallel  Often 8 or more lines (wire.
JTAG, Multi-ICE and Angel
Serial Communications
Presented By,  Mamata Yadav (BE Elex & Comm.) Vice R&D Coordinator(HW), PCRT  Payal Shah (BE Elex & Comm.)  Ananta Das (BE Elex & Comm.) R&D Team,PCRT.
Chapter 13: I/O Systems “The two main jobs of a computer are I/O and [CPU] processing. In many cases, the main job is I/O, and the [CPU] processing is.
Presentation transcript:

Debugging Debug environments Debug via serial

Debugging

Debug and trace Controllability and observability are required Ability to control sources of data used by the system Input pins, input interfaces (serial, Ethernet, etc.) Registers and internal memory Observability Ability to observe intermediate and final results Output pins, output interfaces

I/O access is insufficient Observation of I/O is not enough to debug If Pin2 is incorrect, how do we locate the bug? main(){ x=f1(pin1,pin2) foo(x); } foo(x){ y=f2(x); bar(y); } bar(y){ pin3=f3(y); } Pin1 Pin3 Pin2

Properties of a debugging environment Run control of the target Start and stop the program execution Observe data at stop points Real-time monitoring of target execution Non-intrusive in terms of performance Timing and functional accuracy Debugged system should ac like the real system

Debug environments

Remote debugger Frontend running on the host Debug monitor hidden on target Typically triggered when debug events occur Hitting a breakpoint, receiving request from host, etc. Debug monitor maintains communication link Communication link Host Target

Remote debug tradeoffs Advantages Good run control using breakpoints to stop execution Debug monitor can alter memory and registers Perfect functional accuracy Disadvantages Debug interrupts alter timing so real-time monitoring is not possible Need a spare communication channel Need program in RAM to add breakpoints

Embedded debug interfaces Many modern processors include embedded debug logic Embedded trace macrocell (ARM) Background debug mode (Freescale) Debug logic permanently build into the processor A few dedicated debug pins are added

Debug and trace features Breakpoints, stopping points in the code Watchpoints, memory locations which trigger stop On-the-fly memory access Examine/change internal processor values Single-step through the code Export softeware-generated data (printf) Timestamp information for each event Instruction trace (special purpose HW needed)

Debug via serial

Serial protocols Data is transmitted serially Only 1 bit needed (plus common ground) Parallel data transmitted serially Original bytes/words regrouped by the receiver Many protocols are serial to reduce pin usage Pins are precious

UART Universal asynchronous receiver/transmitter Used for serial communication between devices UART is asynchronous; no shared clock Asynchronous allows longer distance communication Clock skew is not a problem

UART applications Used by modems to communicate with network Computers used to have an RS232 port, standard Not well used anymore, outside of embedded systems Replaced by USB, Ethernet, etc. Simple, low HW overhead Build into most microcontrollers

Serial on Arduino

Arduino serial communication UART protocol used over the USB cable Initialize by using Serial.begin() Serial.begin(speed) or Serial.begin(speed,config) speed is the baud rate config sets the data bits, parity, and stop bits Serial.begin(9600) Serial.begin(9600, SERIAL_8N1) 8 data bits, no parity bit, and 1 stop bit Usually call Serial.begin() in the setup function

Sending text over serial Use Serial.print() or Serial.println() to print text in the serial monitor Strings are converted to ASCII and sent using UART Serial.println(“Hello World!”);

Reading data over serial Data can be sent to the Arduino via the serial monitor When data is sent, it goes into a buffer in the Arduino until it is read Serial.available() is used to see how many bytes are waiting in the buffer int byteNum = Serial.available();

Serial.read() Returns 1 byte from the serial buffer int bval = Serial.read(); Returns -1 if no data is available Serial.readBytes() writes several bytes into a buffer char buff[10]; Serial.readBytes(buff,10);