How to debug USBX-based examples

This page highlights the main debug entry points for USBX examples and the configuration switches that make early bring-up easier.

Useful debug-oriented configuration switches

The current USBX configuration flow exposes several options that are useful during bring-up.

Setting

Typical bring-up usage

Debug value

ux_enable_error_checking

Enable while validating the integration

Catches common middleware misuse

ux_enable_param_checking

Enable during early development

Helps detect invalid API arguments

ux_enable_assert

Keep enabled in debug builds

Surfaces internal assumptions earlier

ux_debug_log_size

Increase if more trace history is needed

Preserves more diagnostic context

usbx_device_register_connection_callback

Enable for device-connection event tracing

Helps confirm connect, disconnect, suspend, and resume events

Role-specific checks

Device-mode checks

Focus on:

  • Device descriptor content

  • Endpoint addresses and packet sizes

  • VBUS sensing and cable behavior

  • Reset, suspend, resume, and enumeration events

Host-mode checks

Focus on:

  • HCD startup and port-power sequencing

  • Device insertion and removal events

  • Class activation results

  • ED, TD, and ISO TD pool sizing for the active topology

FreeRTOS example checks

If the example uses FreeRTOS, also verify:

  • USBX thread priorities are not starved by unrelated tasks.

  • The required FreeRTOS advanced APIs are enabled.

  • The generated application thread sizes are adequate for the class logic.