Several people have asked: "Can I have debug trace?" "Can I use anything for debug?" For instance: "Can I use UART LOG and my messages for debug?" on WICED Sense - YES, you can !
Two lines of code and it works !
void wiced_sense_connection_up(void)
{
//initialize the UART: here just when connection is established
puart_init();
puart_print("WICED: Connected\r\n");
I have attached here my "wiced_sense.c" file which uses this feature. UART is enabled on "connection_up". I use a static variable to make sure the UART is not used if not initialized.
And: you and me, we want to print also variables, values, like a regular printf. Here it is - define a macro which you will use in your code:
static int sUARTInitialized = 0; //UART will be initialized on BLE connection established
//define a macro for a debug print similar function
static char sUARTBuf[80]; //a buffer for the UART output, used by Tprintf
#define Tprintf(fmt, ...) do { \
if (sUARTInitialized) { \
sprintf(sUARTBuf, fmt, __VA_ARGS__): \
puart_print(sUARTBuf); \
} \
} while (0);
Please, do no forget to set sUARTInitiazed when init was done.
So, later in your code you can use:
puart_print("WICED: Connected\r\n"); //use directly, as simple string
or:
Tprintf("WICED: Disconnected\r\n", 0); //OK, a bit strange, see below why do we need a parameter
You can print simple strings, you can print strings with variable content etc., like a regular printf.
Solved! Go to Solution.
Here's a good thread which discusses why the traces were encoded in ROM: Re: How do I interpret the extra tracing data ?
This thread addresses the ability to disable traces: Disabling BLE trace in patches
The modification of the state on the HCI UART Rx was required to enable traces (as pointed out in the Quick Start Guide).
Trace is a different issue: yes, I assume the debug trace there will be based on an encoded protocol.
But I use just as a simple terminal, ASCII mode here.
Works for me. Just to use external TeraTerm, not the Eclipse integrated trace tool.
Here's a good thread which discusses why the traces were encoded in ROM: Re: How do I interpret the extra tracing data ?
This thread addresses the ability to disable traces: Disabling BLE trace in patches