...
Core level debug traces are outputted from the debug task handler via an application defined trace function USBD_Trace()
. This function is located in app_usbd.c
and it is up to you to define how messages are outputted whether through console terminal printf()
statements or serial printf()
statements for example. Listing - USBD_Trace Example shows an example of an implementation for USBD_Trace()
with a serial printf()
function.
Anchor |
---|
| Listing - USBD_Trace Example |
---|
| Listing - USBD_Trace Example |
---|
|
Code Block |
---|
language | cpp |
---|
title | Listing - USBD_Trace Example |
---|
linenumbers | true |
---|
|
void USBD_Trace (const CPU_CHAR *p_str)
{
App_SerPrintf("%s", (CPU_CHAR *)p_str);
} |
Debug Trace Configuration
There are several configuration constants necessary to customize the core level debugging traces. These constants are found in usbd_cfg.h
and are summarized in Table - General Configuration Constants.
Anchor |
---|
| Table - General Configuration Constants |
---|
| Table - General Configuration Constants |
---|
|
Panel |
---|
borderWidth | 0 |
---|
title | Table - General Configuration Constants |
---|
|
Constant | Description |
---|
USBD_CFG_DBG_TRACE_EN | This constant enables core level debugging traces in the program so that transactional activity can be outputted. | USBD_CFG_DBG_TRACE_NBR_EVENTS | This constant configures the size of the debug event pool to store debug events. |
|
Debug Trace Format
The debug task handler follows a simple format when outputting debug events. The format is as follows:
...
In the event that timestamp, endpoint address, interface number or error messages are not provided, they are left void in the output. An example output is shown in Listing - Sample Debug Output. This example corresponds to traces placed in the USB device core and device driver functions. This trace shows the enumeration process where bus events are received and related endpoints are opened in the device driver. Next, a setup event is sent to the core task followed by receiving the first Get Device Descriptor standard request.
Anchor |
---|
| Listing - Sample Debug Output |
---|
| Listing - Sample Debug Output |
---|
|
Code Block |
---|
language | cpp |
---|
title | Listing - Sample Debug Output |
---|
linenumbers | true |
---|
|
USB 0 Bus Reset
USB 0 80 Drv EP DMA Open
USB 0 0 Drv EP DMA Open
USB 0 Bus Suspend
USB 0 Bus Reset
USB 0 80 Drv EP DMA Close
USB 0 0 Drv EP DMA Close
USB 0 80 Drv EP DMA Open
USB 0 0 Drv EP DMA Open
USB 0 Drv ISR Rx (Fast)
USB 0 0 Setup pkt
USB 0 0 Drv ISR Rx Cmpl (Fast)
USB 0 Drv ISR Rx (Fast)
USB 0 0 Get descriptor(Device)
USB 0 80 Drv EP FIFO Tx Len: 18
USB 0 80 Drv EP FIFO Tx Start Len: 18
USB 0 Drv ISR Rx (Fast)
USB 0 80 Drv ISR Tx Cmpl (Fast)
USB 0 0 Drv ISR Rx Cmpl (Fast)
USB 0 Drv ISR Rx (Fast)
USB 0 0 Drv EP FIFO RxZLP
USB 0 Drv ISR Rx (Fast)
... |