Use of CyU3PDebugPreamble() API – KBA227492

Author: SrinathS_16           Version: **

Question:
What is the use of the CyU3PDebugPreamble() API in FX3 SDK?

Answer:
The CyU3PDebugInit() API initializes a debug socket that can be used for printing and logging debug messages and creates a DMA channel between FX3 CPU producer and the debug socket consumer. The CyU3PDebugPrint() and CyU3PDebugLog() APIs are used to print and log debug information from FX3 CPU onto the debug socket. In addition to the data that is sent through the CyU3PDebugPrint() and CyU3PDebugLog() APIs, FX3 CPU can also send an additional 8 bytes of preamble information which can be used to identify the source of the data. The 8 bytes of data are as follows.

Byte 0            -           Priority

Byte 1            -           Calling Thread ID

Byte [2:3]       -           Message

Byte [4:7]       -           Parameter

When using the CyU3PDebugPrint() API, the message field is loaded with a default value of 0xFFFF and the parameter field is loaded with the length of the data to be printed.

When using the CyU3PDebugLog() API, the message and parameter fields can be specified through the API arguments. The valid values for message field when using the CyU3PDebugLog() API range from 0x0000 - 0xFFFE.

If no additional information needs to be printed, the preamble data needs to be disabled using the CyU3PDebugPreamble() API with the sendPreamble parameter set to CyFalse. If the CyU3PDebugPreamble() API is not called, the preamble data is enabled by default.