3.3 Configure LAN8651 Support on STM32F413ZH Nucleo-144 Target
- Make sure that the virtual environment is activated.
source ~/zephyrproject/.venv/bin/activate
- Enter the directory.
$ cd zephyrproject/zephyr/
- Open the nucleo_f413zh.dts file.
$ vim boards/st/nucleo_f413zh/nucleo_f413zh.dts
- In the file make the adaptations as listed below (marked bold in the code section):
- Add &dma2 node between &i2c1 node and &spi1 node.
- In &spi1 node change sck, miso, mosi and chip select pin numbers.
- Configure the dma channels and slots.
- Add MAC and PHY node contents inside the &spi1 node.
/* * Copyright (c) 2017 Florian Vaussard, HEIG-VD * * SPDX-License-Identifier: Apache-2.0 */ /dts-v1/; #include <st/f4/stm32f413Xh.dtsi> #include <st/f4/stm32f413z(g-h)tx-pinctrl.dtsi> #include "arduino_r3_connector.dtsi" #include <zephyr/dt-bindings/input/input-event-codes.h> / { model = "STMicroelectronics STM32F413ZH-NUCLEO board"; compatible = "st,stm32f413zh-nucleo"; chosen { zephyr,console = &usart3; zephyr,shell-uart = &usart3; zephyr,sram = &sram0; zephyr,flash = &flash0; zephyr,code-partition = &slot0_partition; }; leds: leds { compatible = "gpio-leds"; green_led_1: led_1 { gpios = <&gpiob 0 GPIO_ACTIVE_HIGH>; label = "User LD1"; }; blue_led_1: led_2 { gpios = <&gpiob 7 GPIO_ACTIVE_HIGH>; label = "User LD2"; }; red_led_1: led_3 { gpios = <&gpiob 14 GPIO_ACTIVE_HIGH>; label = "User LD3"; }; }; gpio_keys { compatible = "gpio-keys"; user_button: button { label = "User"; gpios = <&gpioc 13 GPIO_ACTIVE_HIGH>; zephyr,code = <INPUT_KEY_0>; }; }; aliases { led0 = &green_led_1; led1 = &blue_led_1; led2 = &red_led_1; sw0 = &user_button; }; }; &clk_lsi { status = "okay"; }; &clk_hse { hse-bypass; clock-frequency = <DT_FREQ_M(8)>; /* STLink 8MHz clock */ status = "okay"; }; &pll { div-m = <8>; mul-n = <384>; div-p = <4>; div-q = <8>; clocks = <&clk_hse>; status = "okay"; }; &rcc { clocks = <&pll>; clock-frequency = <DT_FREQ_M(96)>; ahb-prescaler = <1>; apb1-prescaler = <2>; apb2-prescaler = <1>; }; &usart3 { pinctrl-0 = <&usart3_tx_pd8 &usart3_rx_pd9>; pinctrl-names = "default"; current-speed = <115200>; status = "okay"; }; &usart6 { pinctrl-0 = <&usart6_tx_pg14 &usart6_rx_pg9>; pinctrl-names = "default"; current-speed = <115200>; status = "okay"; }; &i2c1 { pinctrl-0 = <&i2c1_scl_pb8 &i2c1_sda_pb9>; pinctrl-names = "default"; status = "okay"; clock-frequency = <I2C_BITRATE_FAST>; };
&dma2 { status = "okay"; };
&spi1 {pinctrl-0 = <&spi1_sck_pb3 &spi1_miso_pb4 &spi1_mosi_pb5>;
pinctrl-names = "default";cs-gpios = <&gpioa 4 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
status = "okay";dmas = <&dma2 5 3 0x28440 0x03 &dma2 2 3 0x28480 0x03>; dma-names = "tx", "rx";
lan8651: lan8651@0 { compatible = "microchip,lan865x"; reg = <0>; int-gpios = <&gpiof 13 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; rst-gpios = <&gpioa 13 (GPIO_ACTIVE_LOW)>; local-mac-address = [14 15 16 11 12 13]; spi-max-frequency = <24000000>; status = "okay"; lan865x_mdio: lan865x_mdio { compatible = "microchip,lan865x-mdio"; status = "okay"; #address-cells = <1>; #size-cells = <0>; ethernet-phy@0 { compatible = "microchip,t1s-phy"; reg = <0x0>; plca-enable; plca-node-id = <0>; plca-node-count = <8>; plca-burst-count = <0>; plca-burst-timer = <0x80>; plca-to-timer = <0x20>; status = "okay"; }; }; };
}; zephyr_udc0: &usbotg_fs { pinctrl-0 = <&usb_otg_fs_dm_pa11 &usb_otg_fs_dp_pa12>; pinctrl-names = "default"; status = "okay"; }; &flash0 { partitions { compatible = "fixed-partitions"; #address-cells = <1>; #size-cells = <1>; boot_partition: partition@0 { label = "mcuboot"; reg = <0x00000000 DT_SIZE_K(64)>; read-only; }; /* * The flash starting at offset 0x10000 and ending at * offset 0x1ffff is reserved for use by the application. */ slot0_partition: partition@20000 { label = "image-0"; reg = <0x00020000 DT_SIZE_K(256)>; }; slot1_partition: partition@60000 { label = "image-1"; reg = <0x00060000 DT_SIZE_K(256)>; }; scratch_partition: partition@a0000 { label = "image-scratch"; reg = <0x000a0000 DT_SIZE_K(128)>; }; }; }; &timers2 { status = "okay"; pwm2: pwm { status = "okay"; pinctrl-0 = <&tim2_ch1_pa0>; pinctrl-names = "default"; }; }; &rtc { clocks = <&rcc STM32_CLOCK_BUS_APB1 0x10000000>, <&rcc STM32_SRC_LSI RTC_SEL(2)>; status = "okay"; }; -
Save the changes.