WIZnet-PICO-C Trouble shooting guide
This is a troubleshooting guide based on issues from the WIZnet-Pico-C repository.
https://github.com/WIZnet-ioNIC/WIZnet-PICO-C

Problem Phenomenon (The issue):
- The user is using a W55RP20-EVB-PICO board and exploring C/C++ example codes in Visual Studio Code. While building the
w5x00_udp_server.c
example with the_LOOPBACK_DEBUG_
macro defined, they only receive network configuration prints on the serial terminal and no debug prints as expected. The user is able to send and receive UDP packets using the Hercules terminal but cannot see debug messages for received UDP packets.
Cause (The cause of the issue):
- The
_LOOPBACK_DEBUG_
macro being enabled does not automatically mirror print received UDP packets to the UART port, as the user initially expected. The debug messages in the UDP server are only displayed when there is a send or receive error.
Solution (Concrete code changes, configuration changes, step-by-step actions, etc., that actually solved the problem):
- To change the UART or USB message output settings, modify the options in the
CMakeLists.txt
file located atWIZnet-PICO-C\examples\udp\udp_server\CMakeLists.txt
. Specifically, set the desired option to 1 at lines 17-18:
pico_enable_stdio_usb(${TARGET_NAME} 1)
pico_enable_stdio_uart(${TARGET_NAME} 0)
- This configuration enables USB output and disables UART output, allowing the user to receive the desired debug messages through the correct output channel.
Problem Phenomenon (The issue):
- When running the
make
command, the following error appears:
[ 70%] Linking CXX executable w5x00_tftp_client.elf
/usr/lib/gcc/arm-none-eabi/10.3.1/../../../arm-none-eabi/bin/ld: CMakeFiles/w5x00_tftp_client.dir/__/__/libraries/ioLibrary_Driver/Internet/TFTP/tftp.c.obj: in function `recv_tftp_data':
/home/pico/turoswiz/WIZnet-PICO-C/libraries/ioLibrary_Driver/Internet/TFTP/tftp.c:440: undefined reference to `save_data'
/usr/lib/gcc/arm-none-eabi/10.3.1/../../../arm-none-eabi/bin/ld: /home/pico/turoswiz/WIZnet-PICO-C/libraries/ioLibrary_Driver/Internet/TFTP/tftp.c:423: undefined reference to `save_data'
collect2: error: ld returned 1 exit status
make[2]: *** [examples/tftp/CMakeFiles/w5x00_tftp_client.dir/build.make:1520: examples/tftp/w5x00_tftp_client.elf] Error 1
make[1]: *** [CMakeFiles/Makefile2:2745: examples/tftp/CMakeFiles/w5x00_tftp_client.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
Cause (The cause of the issue):
- The error is due to undefined references to the
save_data
function in thetftp.c
file during the linking process, which indicates that the functionsave_data
is declared but not defined or not linked correctly.
Solution (Concrete code changes, configuration changes, step-by-step actions, etc., that actually solved the problem):
- Apply a patch to resolve the undefined reference issue. Follow these steps:
- Navigate to the
ioLibrary_Driver
directory within the example project folder:
- Navigate to the
cd libraries/ioLibrary_Driver
- Apply the patch using the
git apply
command:
git apply ../../patches/0002_iolibrary_driver_tftp.patch
Problem Phenomenon (The issue):
- When attempting to add the mbedtls library as a submodule using the command
git submodule add https://github.com/ARMmbed/mbedtls.git libraries/mbedtls
, CMake encounters missing files during configuration. Attempts to update the submodule within the mbedtls folders did not resolve the issue.
Cause (The cause of the issue):
- The mbedtls library is not being added correctly as a submodule, resulting in missing files during the CMake configuration process. Additionally, the inclusion path for mbedtls might not be correctly set in the CMakeLists.txt file, and there may be unnecessary manual inclusions in the code.
Solution (Concrete code changes, configuration changes, step-by-step actions, etc., that actually solved the problem):
- Update the
CMakeLists.txt
file in WIZnet-PICO-C to set the correct path for the mbedtls library. Change line 80 to:set(MBEDTLS_DIR ${CMAKE_SOURCE_DIR}/libraries/mbedtls)
. - Clone the desired version of mbedtls directly instead of adding it as a submodule:
- Clone the specific version needed (e.g., replace
3.6.2
with the desired version):
- Clone the specific version needed (e.g., replace
git clone --branch mbedtls-3.6.2 --depth 1 https://github.com/Mbed-TLS/mbedtls.git libraries/mbedtls
- Navigate to the directory:
cd libraries/mbedtls
- Initialize and update the submodules to ensure all referenced submodules within the mbedtls repository are downloaded:
git submodule update --init --recursive
- If encountering the warning
#warning "Do not include mbedtls/check_config.h manually!"
, comment out the following line in the WIZnet-PICO-C/port/mbedtls/inc/ssl_config.h file (at line 32):
//#include "mbedtls/check_config.h"
- This inclusion is unnecessary for the version tested (3.6.2) as the file is automatically referenced.
Problem Phenomenon (The issue):
- After building and flashing the firmware for the W55RP20-EVB-PICO board using the specified repository, the board fails to boot up despite the successful generation of the
firmware.uf2
file.
Cause (The cause of the issue):
- The issue arises because the repository is using Pico-SDK version 1.5.0, which lacks the necessary files and does not support the clock initialization changes required by the patch (
0001_pico_sdk_clocks.patch
) available in the WIZnet-PICO-C repository. This patch requires Pico-SDK version 2.0.0 for proper functionality.
Solution (Concrete code changes, configuration changes, step-by-step actions, etc., that actually solved the problem):
- Update the repository to use Pico-SDK 2.0.0 to ensure compatibility with the existing patches.
- Alternatively, provide a new patch that addresses the clock initialization issue while being compatible with Pico-SDK 1.5.0.
- There is an ongoing pull request for MicroPython W55RP20-EVB-PICO that supports Pico-SDK 2.0.0, which can be referred to for guidance: MicroPython Pull Request #16476. However, note that this PR is still in progress and should be used for reference only, as further modifications may occur.