130 likes | 271 Views
Better Debugging of Embedded via a Debug Port. ECE152. Overview. What is a Debug Port?. JTAG Digital Satellite, Later ECE courses I2C Proprietary AVR serial ISP Serial (UART). Understanding Asynchronous Serial ( UART). Agreed on message format Start and Stop Bits Parity
E N D
What is a Debug Port? • JTAG • Digital Satellite, Later ECE courses • I2C • Proprietary • AVR serial ISP • Serial (UART)
Understanding Asynchronous Serial (UART) • Agreed on message format • Start and Stop Bits • Parity • Agreed on speed
Handlinga UART in software • Important Registers • USART I/O Data Register n– UDRn • USART Control and Status Register n A – UCSRnA • USART Control and Status Register n B – UCSRnB • USART Control and Status Register n C – UCSRnC • USART Baud Rate Registers – UBRRnL and UBRRnH
Baud Rate • Speed of transmission • Units of bits per second (bps or baud)
Start and Stop Bits • 1 start bit, 1 or 2 stop bitsUSBSn bit in UCSRnC
FTDI UART to USB chip • Modern computers do not have RS232 • USB to UART converters maintain a simple interface • FTDI Chip works on Windows, Mac and Linux • Often driverless installation • Can be disabled to allow for Wunderboard to Wunderboard serial communication
Voltages • Wunderboard • 3.3V • FTDI • 3.3 to 5V • Old School RS232 • ±12V
Enabling and disabling Debug ports • Why Enable and Disable Debug? • Code Size • Code Speed • Security
#IFDEF and Preprocessor Statements • Preprocessor statements happen BEFORE compilation #DEFINE DEBUG#IFDEF DEBUG Serial code goes here...#ENDIF
Things to Remember • Watch your flags to avoid buffer over run • Use #DEFINE to remove code before compilation