...
The Waveshare LAN8720 ETH board connected to the P2 header with a special cable. The pin-out is as follows:
STM32H7 | Function | BSB | ETH | Name | LAN8720 | Comment |
3V3 | P2.1 | P2.1 | VCC | |||
3V3 | P2.2 | P2.2 | VCC | |||
GND | P2.3 | P2.3 | GND | |||
GND | P2.4 | P2.4 | GND | |||
PC1 | ETH_MDC | P2.5 | P2.5 | MDC | MDC | |
PA2 | ETH_MDIO | P2.6 | P2.6 | MDIO | MDIO | |
PA7 | RMII_CRS_DV | P2.7 | P2.7 | CRS_DV | CRS_DV/MODE2 | |
PA1 | RMII_REF_CLK | P2.8 | P2.8 | R_RXCLK | 50MHz from LAN8720 | |
PC5 | RMII_RXD1 | P2.9 | P2.9 | RXD1 | RXD1/MODE1 | |
PC4 | RMII_RXD0 | P2.10 | P2.10 | RXD0 | RXD0/MODE0 | |
PG13 | RMII_TXD0 | P2.11 | P2.11 | TXD0 | TXD0 | |
PG11 | RMII_TXEN | P2.12 | P2.12 | TX_EN | TXEN | |
PG10 | - | P2.13 | - | - | - | |
PG12 | RMII_TXD1 | P2.14 | P2.14 | TXD1 | TXD1 |
The following picture illustrates the above hardware set-up:
...
On the development host, make sure that your serial terminal utility (such as
picocom
) is not connected to the board serial console (/dev/ttyUSB1
in this example). Exit the utility or just kill it, for example:Code Block [sasha_d@workbench ~]$ killall picocom [sasha_d@workbench ~]$
Run the following command on the Linux development host:
Code Block [sasha_d@workbench stm32h7]$ ./u-boot-upstream/board/emcraft/stm32h7-som/stm32h7-som-prog.kermit /dev/ttyUSB1 u-boot-upstream/u-boot.img
Reset the board to start programming
u-boot-upstream/u-boot.img
via/dev/ttyUSB1
.Reset the SOM by pressing the S3 button on the carrier board.
Wait for the
kermit
utility to load the U-Boot image (observe the progress indicators).The script will exit successfully at the end of the installation procedure:
Code Block ... STM32H7-SOM U-Boot > Successfully programmed u-boot-upstream/u-boot.img to SPI NAND at 0x00000000 ubi part system ... STM32H7-SOM U-Boot > ubi create env1 0x8000 Creating dynamic volume env1 of size 32768 STM32H7-SOM U-Boot > ubi create env2 0x8000 Creating dynamic volume env2 of size 32768 STM32H7-SOM U-Boot > [sasha_d@workbench stm32h7]$
Connect to the SOM console using a serial terminal utility, for example:
Code Block [sasha_d@workbench ~]$ picocom -b 115200 /dev/ttyUSB1
Verify that the U-Boot "proper" has been successfully installed. Reset the SOM by pressing the S3 button on the carrier board and confirm that the following output appears on the serial UART console:
Code Block U-Boot SPL 2019.04--00057-g53e40e44f4-dirty (May 01 2023 - 21:11:52 +0300) Hit 's' key to enter spl shell: Trying to boot from SPI U-Boot 2019.04--00057-g53e40e44f4-dirty (May 01 2023 - 21:11:52 +0300) Model: STMicroelectronics STM32H7 SOM DRAM: 32 MiB SF: Detected n25q512ax3 with page size 256 Bytes, erase size 4 KiB, total 64 MiB Flash: 128 KiB MMC: STM32 SDMMC2: 0 Loading Environment from UBI... ubi0: default fastmap pool size: 190 ubi0: default fastmap WL pool size: 95 ubi0: attaching mtd2 ubi0: scanning is finished ubi0: attached mtd2 (name "system", size 15 MiB) ubi0: PEB size: 4096 bytes (4 KiB), LEB size: 3968 bytes ubi0: min./max. I/O unit sizes: 1/256, sub-page size 1 ubi0: VID header offset: 64 (aligned 64), data offset: 128 ubi0: good PEBs: 3840, bad PEBs: 0, corrupted PEBs: 0 ubi0: user volume: 2, internal volumes: 1, max. volumes count: 23 ubi0: max/mean erase counter: 2/1, WL threshold: 4096, image sequence number: 0 ubi0: available PEBs: 3790, total reserved PEBs: 50, PEBs reserved for bad PEB handling: 0 Read 16384 bytes from volume env1 to d1e70620 Read 16384 bytes from volume env2 to d1e74640 *** Warning - bad CRC, using default environment In: serial Out: serial Err: serial Volume splash not found! splash_screen_display: ubi_volume_read error=19 Net: Error: ethernet@40028000 address not set. eth-1: ethernet@40028000 Hit any key to stop autoboot: 0 ERROR: Active image set is invalid STM32H7-SOM U-Boot >
...
Set the MAC address of the Ethernet interface (you can choose an arbitrary address for development purposes but make sure that it is unique within your LAN):
Code Block STM32H7-SOM U-Boot > setenv -f ethaddr STM32H7-SOM U-Boot > setenv ethaddr 12:34:56:78:9a:bc STM32H7-SOM U-Boot >
Set the IP address of the board to a value that makes sense for your LAN, for example:
Code Block STM32H7-SOM U-Boot > setenv ipaddr 172.17.0.66 STM32H7-SOM U-Boot >
Set the TFTP server IP address, for example:
Code Block STM32H7-SOM U-Boot > setenv serverip 172.17.0.1 STM32H7-SOM U-Boot >
Save the network parameters in the QSPI Flash:
Code Block STM32H7-SOM U-Boot > saveenv Saving Environment to UBI... ubi0: detaching mtd2 ... Writing to redundant UBI... done OK STM32H7-SOM U-Boot >
Try to download a non-existent file from the TFTP server and confirm that the
File not found
error is reported:Code Block STM32H7-SOM U-Boot > tftp dummy Using ethernet@40028000 device TFTP from server 172.17.0.1; our IP address is 172.17.0.66 Filename 'dummy'. Load address: 0xd0400000 Loading: * TFTP error: 'File not found' (1) ... Copy the FreeRTOS image to the TFTP server and try to download it: STM32H7-SOM U-Boot > tftp freertos_stm32h750.img ethernet@40028000 Waiting for PHY auto negotiation to complete. done Using ethernet@40028000 device TFTP from server 172.17.0.1; our IP address is 172.17.0.66 Filename 'freertos_stm32h750.img'. Load address: 0xd0400000 Loading: ###### 14.6 KiB/s done Bytes transferred = 79070 (134de hex) STM32H7-SOM U-Boot >
...
If your starter kit includes the LCD, it can be enabled in software by installing the U-Boot splash screen image to the QSPI Flash. Step through the following procedure to install the stm32h7-splash-24bpp.bmp
picture as the splash screen:
...
As trivial as it sounds make sure that the board is connected to the LAN with an Ethernet cable.
Suppose you are still not getting your file from the TFTP server. It is possible that the problem is on the host side - you must set up a TFTP server correctly. Just google for "how to set up a tftp server" and follow the advice from some top articles.
Make sure you have copied a file you are trying to download to the TFTP server directory on the host.
Disable the firewall on the host since get enabled, it will block TFTP requests from the target.
On the target, make sure that you have set
ipaddr
andserverip
correctly. Checkethaddr
and make sure that you don't have another embedded board (eg. another STM32H7 SOM) configured for the same MAC address.