
Getting Started with EZ-BT WICED Modules
Document Number: 002-23400 Rev. **
48
7.7
UART Debug Trace
Debug traces in the application project can be transmitted over HCI UART or PUART. The following configuration
details help to enable or disable and route the trace data to the UART port of your choice.
▪
Every sample application has a local
makefile.mk
file. The following declaration enables traces for the sample
application.
Code 37.
makefile.mk
: Enable Trace
C
= -DWICED_BT_TRACE_ENABLE
▪
Next step is to populate the
wiced_transport_cfg_t
data structure, whose definition can be found in the
wiced_transport.h
file, which is part of the WICED SDK installation.
Code 38.
wiced_transport.h
:
wiced_transport_cfg_t
Structure
typedef
PACKED
struct
{
wiced_transport_type_t
type
;
/**< Wiced transport type. */
wiced_transport_interface_cfg_t
cfg
;
/**< Wiced transport interface config. */
wiced_transport_rx_buff_pool_cfg_t
rx_buff_pool_cfg
;
/**< Wiced rx buffer pool config. */
wiced_transport_status_handler_t
p_status_handler
; /
**< Wiced transport status
handler.*/
wiced_tranport_data_handler_t
p_data_handler
;
/**< Wiced transport receive data
handler. */
wiced_transport_tx_complete_t
p_tx_complete_cback
;
/**< Wiced transport tx complete
callback. */
}
wiced_transport_cfg_t
;
An example of the transport configuration is shown below; here, UART is chosen as the transport type with a baud rate
of 115200.
Code 39.
spp.c
:
wiced_transport_cfg_t
Structure Initialization
const
wiced_transport_cfg_t
transport_cfg =
{
WICED_TRANSPORT_UART
,
{
WICED_TRANSPORT_UART_HCI_MODE
, 115200 },
{ TRANS_UART_BUFFER_SIZE, 1},
NULL,
NULL,
NULL
};
▪
Initialize the transport and select the UART communication pins to be used as shown in the following code. In this
example, debug traces are configured to be sent over PUART at a baud rate of 115200 bps.
Code 40.
spp.c
: Configuring UART and Baud Rate
wiced_transport_init(&transport_cfg);
// Set to PUART to see traces on peripheral PUART
wiced_set_debug_uart(
WICED_ROUTE_DEBUG_TO_PUART
);
wiced_hal_puart_select_uart_pads(
WICED_P33, WICED_P31,
0, 0);
// Set to HCI to see traces on HCI uart - default if no call to wiced_set_debug_uart()
// wiced_set_debug_uart( WICED_ROUTE_DEBUG_TO_HCI_UART );
7.8
Design Source
The functional WICED Studio SDK project for the BLE example design described in this application note is distributed
on this application note
’s web page.