HC08 Full Chip Simulation
Configuration Procedure
321
Microcontrollers Debugger Manual
In the FLASH, the descriptor tables are created, which describe the type of USB device,
the configuration, the interface, HID specific information, the endpoints, and reporting
information. All information needed in these descriptors, can be found in the Freescale
documentation describing USB module specifications for the microprocessor that you are
using.
After the descriptors comes the actual code, where numerous procedures are described,
meant to handle different tasks. The first is the initialization procedure, which sets up the
registers for the USB peripheral for the intended operation. The USB peripheral is also
enabled at the end of the routine. The next several procedures are specifically for USB
operation, such as: forcing a device stall, sending the device descriptors to the host,
handling SETUP packets, handling IN packets, and processing OUT packets. After this
comes the start of the application in the MAIN_INIT procedure, where we call the
initialization routines and wait for an interrupt to occur. There are two interrupt service
routines for the USB peripheral in this code: one for endpoint events that occur, and the
other for USB system events such as setups, stalls, and resets. Note that this application is
totally interrupt driven, where the code is driven by any events that take place in the USB
peripheral.
The end of the code shows the interrupt vectors for the microcontroller, where the USB
interrupts and the RESET vector are included. All other vectors are pointed to a dummy
interrupt service routine that simply just returns from the interrupt.
Once the mentioned above assembly code is compiled as a part of the Freescale project,
one can step through in the Full Chip Simulation mode. The execution starts automatically
at the reset location within the code. We are now ready to start debugging the code.
First, we need to step through the beginning of the code in the simulator in order to allow
the code to initialize the microcontroller and the USB peripheral and get ready to start
receiving USB packets from the host. So, the user needs to step through the beginning of
the code until they get to the main loop with the
’t’
command.
At this point we are ready for USB packets to come into the device. There are four specific
commands in the FCS for simulating external input/output as well as reset and clear
functionality of the USB peripheral:
USBRESET
,
USBIN
,
USBOUT
, and
USBCLR
(for
more detailed information, refer to the USB commands section). The
USBRESET
command causes a USB reset, which is identical to a host trying to reset a slave USB
device once it connects to the bus. The
USBIN
command allows a user to specify packets
coming into the USB peripheral. The
USBOUT
command allows a user to see the packets
that were sent out from the USB peripheral. The
USBCLR
command allows the user to
clear all input and output buffers of USB packets. The first command to use for testing the
USB peripheral is the
USBRESET
command, which places the USB peripheral in the
RESET state. After the
USBRESET
command, step through the code with a
t
command to
enter the system interrupt service routine. Enter the
t
command a few more times to exit
the ISR and return to the main loop.
Summary of Contents for Microcontrollers
Page 1: ...Microcontrollers Debugger Manual Revised 22 October 2007 ...
Page 20: ...Table of Contents 20 Microcontrollers Debugger Manual ...
Page 24: ...Book I Contents 24 Microcontrollers Debugger Manual ...
Page 60: ...Debugger Interface Highlights of the User Interface 60 Microcontrollers Debugger Manual ...
Page 156: ...Debugger Components Visualization Utilities 156 Microcontrollers Debugger Manual ...
Page 198: ...Real Time Kernel Awareness OSEK Kernel Awareness 198 Microcontrollers Debugger Manual ...
Page 236: ...Synchronized Debugging Through DA C IDE Troubleshooting 236 Microcontrollers Debugger Manual ...
Page 238: ...Book II Contents 238 Microcontrollers Debugger Manual ...
Page 332: ...HC08 Full Chip Simulation Configuration Procedure 332 Microcontrollers Debugger Manual ...
Page 348: ...MON08 Interface Connection Device Class Description 348 Microcontrollers Debugger Manual ...
Page 364: ...ICS MON08 Interface Connection Device Class Description 364 Microcontrollers Debugger Manual ...
Page 428: ...HC08 FSICEBASE Emulator Bus State Analyzer BSA 428 Microcontrollers Debugger Manual ...
Page 430: ...Book III Contents 430 Microcontrollers Debugger Manual ...
Page 466: ...HCS08 Full Chip Simulation Peripheral Modules Commands 466 Microcontrollers Debugger Manual ...
Page 544: ...HCS08 On Chip DBG Module HCS08 DBG V3 New Features 544 Microcontrollers Debugger Manual ...
Page 546: ...Book IV Contents 546 Microcontrollers Debugger Manual ...
Page 576: ...Book V Contents 576 Microcontrollers Debugger Manual ...
Page 698: ...Book VI Contents 698 Microcontrollers Debugger Manual ...
Page 714: ...Flash Programming NVMC Commands 714 Microcontrollers Debugger Manual ...
Page 730: ...Book VII Contents 730 Microcontrollers Debugger Manual ...
Page 840: ...Book VIII Contents 840 Microcontrollers Debugger Manual ...
Page 864: ...Book IX Contents 864 Microcontrollers Debugger Manual ...
Page 868: ...Legacy Target Interfaces Removed 868 Microcontrollers Debugger Manual ...