This project is a minimum working example to establish an Ethernet connection via LwIP (w/o RTOS) between the STM32H743 and a Python client for ADC sample data transmission.
- µC uses static IP address 192.168.0.10 (server)
- PC ethernet interface uses static IP address 192.168.0.11 (client)
- Ubuntu - CubeMX & gcc-arm-none-eabi & st-link
- Windows - CubeMX & IAR Embedded Workbench
- set IP / network mask:
- type
ifconfig
and locate Ethernet device name (e.g.ens3
) - edit
$ nano /etc/netplan/01-netcfg.yaml
network: version: 2 renderer: networkd ethernets: ens3: dhcp4: no addresses: - 192.168.0.11/24 gateway4: 192.168.0.11 nameservers: addresses: [8.8.8.8, 1.1.1.1]
- activate new IP settings via
$ sudo netplan apply
and validate with$ ifconfig
- type
- download and install CubeMX from ST development tools site
- install gcc-arm-none-eabi
$ add-apt-repository ppa:team-gcc-arm-embedded/ppa
$ apt-get update
$ apt-get install gcc-arm-none-eabi
- download and install st-link from GitHub repository for STLINK/V3 support
$ git clone
$ make clean && release && make install && make debug && make package
(see compile manual)$ dpkg -i ./build/Release/dist/stlink_1.7.0-186-gc4762e6-1_amd64.deb
$ apt install ./build/Release/dist/stlink_1.7.0-186-gc4762e6-1_amd64.deb
$ st-info --probe
prints detected stlink devices if installed successfully
- generate code, compile binary and flash µC
- open project file H743ZI_LwIP_ADC+ETH.ioc in CubeMX and click GENERATE CODE
cd
into project directory (./stm32h7_adc_eth
) and compile via$ make all
$ st-flash --reset write ./build/H743ZI_LwIP_ADC+ETH.bin 0x8000000
to flash the µC
- print ADC data (noise) from µC sent via Ethernet
$ python py_udp_receiver/udp_receiver.py
- set IP / network mask for the PC as 192.168.0.11 / 255.255.255.0 (client)
- connect Nucleo-H743ZI board to your PC using Ethernet cable
- power up the Nucleo-H743ZI board (connect to USB port or use external 5V/3.3V)
- open the project (./EWARM/Project.eww)
- flash the binary file to the µC
- open console,
cd
to the project directorystm32h7_adc_eth
and type:python py_udp_receiver/udp_receiver.py
Once the build and flash succeeded and UDP connection is established, the ADC sample words are displayed in the console.
- validate RAM address range wich is supposed to be from 0x24000000 to 0x2401FFFF (see below)