By default the LwIP standard debug prints are disabled to save memory and re-use the same for other parts of application threads. But in-case, you nee...
By default the LwIP standard debug prints are disabled to save memory and re-use the same for other parts of application threads. But in-case, you need to enable the standard debug prints in LwIP stack, which is done by LWIP_DEBUGF, you need to follow the steps mentioned below.
lwipopts for WICED SDK can be found in 43xxx_Wi-Fi/WICED/network/LwIP/WWD/FreeRTOS/lwipopts.h. If you are on a DEBUG build (specified by -debug in the make target), WICED_LWIP_DEBUG macro will be enabled, but the prints are still disabled by default.
A standard snip example is considered to demonstrate the how-to operation for a DEBUG build.
Make Target: snip.tcp_client-<platform_name>-FreeRTOS-LwIP-debug download
2. Switch the LWIP_DBG_TYPES_ON to LWIP_DBG_ON
3. To enable specific debug messages in LWIP, just set the specific define value for the *_DEBUG value to " LWIP_DBG_ON". A comprehensive list of debug defines that can be enabled usually found in the 43xxx_Wi-Fi/WICED/network/LwIP/ver2.0.3/src/include/lwip/opt.h file. You need to copy the defines for the debug messages you want to enable into the lwipopts.h file and enable them there. As an example, I have switched the following on in my lwipopts.h file
#define TCP_DEBUG LWIP_DBG_ON
#define ETHARP_DEBUG LWIP_DBG_ON
#define PBUF_DEBUG LWIP_DBG_ON
#define IP_DEBUG LWIP_DBG_ON
#define TCPIP_DEBUG LWIP_DBG_ON
#define DHCP_DEBUG LWIP_DBG_ON
#define UDP_DEBUG LWIP_DBG_ON
Attached is the modified lwipopts.h file and and the uart terminal print. Please note that enabling debug prints can add extra size (approximately 20 kB for the mentioned settings) to the code. It will also slow down performance of the LwIP code due to required run-time checks and output. It's is recommended to enable debug support only if there is no chance of attaching an external debugger to the target platform and step through the code.
The attached files update the UART peripheral of STM32F4xx and STM32F2xx host MCUs to return number of bytes within a given duration.The below functio...
The attached files update the UART peripheral of STM32F4xx and STM32F2xx host MCUs to return number of bytes within a given duration.
The below function definition is used for returning the received bytes and number of bytes over the UART within the given time duration. When the patch is applied correctly, the following code should be updated in /include/wiced_platform.h.
/** Receive data on a UART interface
* @param uart : the UART interface
* @param data : pointer to the buffer which will store incoming data
* @param size : number of bytes to receive
* @param rcvd_size: number of bytes received
* @param timeout : timeout in milisecond
* @return WICED_SUCCESS : on success.
* @return WICED_ERROR : if an error occurred with any step
One of the UART (USART6) on the BCM943341 evaluation board (BCM943341WCD1) is routed to USB bridge chip and the serial port brought out over the USB p...
One of the UART (USART6) on the BCM943341 evaluation board (BCM943341WCD1) is routed to USB bridge chip and the serial port brought out over the USB port. A second UART (USART2) is routed out of the module and brought out to the breakout header of the evaluation board.
UART2 pin outs on module:
Base board breakout header:
Base board UART2 pins are on the breakout header as listed below:
J7 Pin-9 : UART2_RXD
J7 Pin-10 : UART2_TXD
J7 Pin-11 : UART2_CTS
J7 Pin-12 : UART2_RTS
For this example only the UART2 Rx and Tx pins are used because the RS232 adapter board on hand does not have CTS and RTS connections. It is possible to utilize CTS and RTS by updating the WICED_UART_2 section of the platform_uart_peripherals[...] definitions in .../platforms/BCM943341WCD1/platform.c file as following:
.cts_pin = &platform_gpio_pins[WICED_GPIO_15],
.rts_pin = &platform_gpio_pins[WICED_GPIO_16],
(found at lines 165/166)
Set up UART2 as the stdio terminal for the WICED board. Update the STDIO_UART definition in .../platforms/BCM943341WCD1/platform.h with WICED_UART_2 to map the UART2 as stdio UART.
/* UART port used for standard I/O */
#define STDIO_UART ( WICED_UART_2 )
(found at lines 203/204)
Serial port characteristics, such as baudrate, parity, stop bit, etc could be changed in stdio_config definitions of the module's platform.c file.
Connect your RS232 serial terminal connection to BCM943341 evaluation board as following:
The updated platform files for BCM943341WCD1 evaluation board are attached. Copy the attached files to .../platforms/BCM943341WCD1 directory. Build the application and download the image to the target WICED board. Setup your serial terminal to 115200, 8, N, 1 or as defined in the stdio_config to display messages from WICED board.
Sample application of scan could be run as following:
Use BCM9WCD1EVAL1 base evaluation board with BCM943362WCD4 module to interface with UART to send and receive messages. WICED evaluation board UART1 or...
Use BCM9WCD1EVAL1 base evaluation board with BCM943362WCD4 module to interface with UART to send and receive messages. WICED evaluation board UART1 or UART2 is configured to receive data into the ring buffer. Data received from the ring buffer (Rx) is forwarded to the webpage served by the WICED evaluation board. Outgoing messages (Tx) are initiated by the webpage and sent on the UART selected.
The "#define USE_UART2_AS_SERIAL_PORT" definition controls the UART selection at compilation.
If USE_UART2_AS_SERIAL_PORT is defined then the UART2 is utilized to send and receive serial port data. If it is not defined then the UART1 is used for serial port send and receive.
In either case, the UART1 is used for displaying log messages.
1. To connect the UART2 to PC the below setup is used. Note that it is not a complete schematic.
For UART1 connection, WICED evaluation board implements the UART1 connection to PC via USB connection and drivers already located at Wiced SDK .../Drivers/BCM9WCD1EVAL1_Drivers location.
2. You need to create directory structure as shown below:
Then paste the files from the attached zip file to the corresponding directories.
3. Update .../Apps/snip/uart_rxtx/wifi_config_dct.h to be able to connect to your WiFi AP.