Skip to content

Commit aa43125

Browse files
committed
fix(F2): Ethernet peripheral configuration for LAN8742A
Nucleo F207ZG has a LAN8742A. Fix stm32duino/STM32Ethernet#56 Signed-off-by: Frederic Pillon <[email protected]>
1 parent 069842e commit aa43125

File tree

1 file changed

+23
-27
lines changed

1 file changed

+23
-27
lines changed

system/STM32F2xx/stm32f2xx_hal_conf_default.h

Lines changed: 23 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,8 @@ in voltage and temperature.*/
206206

207207
/* Section 2: PHY configuration section */
208208

209-
/* DP83848 PHY Address*/
210-
#define DP83848_PHY_ADDRESS 0x01U
209+
/* LAN8742A PHY Address*/
210+
#define LAN8742A_PHY_ADDRESS 0x00U
211211
/* PHY Reset delay these values are based on a 1 ms Systick interrupt*/
212212
#define PHY_RESET_DELAY 0x000000FFU
213213
/* PHY Configuration delay */
@@ -218,39 +218,35 @@ in voltage and temperature.*/
218218

219219
/* Section 3: Common PHY Registers */
220220

221-
#define PHY_BCR ((uint16_t)0x0000) /*!< Transceiver Basic Control Register */
222-
#define PHY_BSR ((uint16_t)0x0001) /*!< Transceiver Basic Status Register */
221+
#define PHY_BCR ((uint16_t)0x00U) /*!< Transceiver Basic Control Register */
222+
#define PHY_BSR ((uint16_t)0x01U) /*!< Transceiver Basic Status Register */
223223

224-
#define PHY_RESET ((uint16_t)0x8000) /*!< PHY Reset */
225-
#define PHY_LOOPBACK ((uint16_t)0x4000) /*!< Select loop-back mode */
226-
#define PHY_FULLDUPLEX_100M ((uint16_t)0x2100) /*!< Set the full-duplex mode at 100 Mb/s */
227-
#define PHY_HALFDUPLEX_100M ((uint16_t)0x2000) /*!< Set the half-duplex mode at 100 Mb/s */
228-
#define PHY_FULLDUPLEX_10M ((uint16_t)0x0100) /*!< Set the full-duplex mode at 10 Mb/s */
229-
#define PHY_HALFDUPLEX_10M ((uint16_t)0x0000) /*!< Set the half-duplex mode at 10 Mb/s */
230-
#define PHY_AUTONEGOTIATION ((uint16_t)0x1000) /*!< Enable auto-negotiation function */
231-
#define PHY_RESTART_AUTONEGOTIATION ((uint16_t)0x0200) /*!< Restart auto-negotiation function */
232-
#define PHY_POWERDOWN ((uint16_t)0x0800) /*!< Select the power down mode */
233-
#define PHY_ISOLATE ((uint16_t)0x0400) /*!< Isolate PHY from MII */
224+
#define PHY_RESET ((uint16_t)0x8000U) /*!< PHY Reset */
225+
#define PHY_LOOPBACK ((uint16_t)0x4000U) /*!< Select loop-back mode */
226+
#define PHY_FULLDUPLEX_100M ((uint16_t)0x2100U) /*!< Set the full-duplex mode at 100 Mb/s */
227+
#define PHY_HALFDUPLEX_100M ((uint16_t)0x2000U) /*!< Set the half-duplex mode at 100 Mb/s */
228+
#define PHY_FULLDUPLEX_10M ((uint16_t)0x0100U) /*!< Set the full-duplex mode at 10 Mb/s */
229+
#define PHY_HALFDUPLEX_10M ((uint16_t)0x0000U) /*!< Set the half-duplex mode at 10 Mb/s */
230+
#define PHY_AUTONEGOTIATION ((uint16_t)0x1000U) /*!< Enable auto-negotiation function */
231+
#define PHY_RESTART_AUTONEGOTIATION ((uint16_t)0x0200U) /*!< Restart auto-negotiation function */
232+
#define PHY_POWERDOWN ((uint16_t)0x0800U) /*!< Select the power down mode */
233+
#define PHY_ISOLATE ((uint16_t)0x0400U) /*!< Isolate PHY from MII */
234234

235-
#define PHY_AUTONEGO_COMPLETE ((uint16_t)0x0020) /*!< Auto-Negotiation process completed */
236-
#define PHY_LINKED_STATUS ((uint16_t)0x0004) /*!< Valid link established */
237-
#define PHY_JABBER_DETECTION ((uint16_t)0x0002) /*!< Jabber condition detected */
235+
#define PHY_AUTONEGO_COMPLETE ((uint16_t)0x0020U) /*!< Auto-Negotiation process completed */
236+
#define PHY_LINKED_STATUS ((uint16_t)0x0004U) /*!< Valid link established */
237+
#define PHY_JABBER_DETECTION ((uint16_t)0x0002U) /*!< Jabber condition detected */
238238

239239
/* Section 4: Extended PHY Registers */
240240

241-
#define PHY_SR ((uint16_t)0x0010) /*!< PHY status register Offset */
242-
#define PHY_MICR ((uint16_t)0x0011) /*!< MII Interrupt Control Register */
243-
#define PHY_MISR ((uint16_t)0x0012) /*!< MII Interrupt Status and Misc. Control Register */
241+
#define PHY_SR ((uint16_t)0x1FU) /*!< PHY special control/ status register Offset */
244242

245-
#define PHY_LINK_STATUS ((uint16_t)0x0001) /*!< PHY Link mask */
246-
#define PHY_SPEED_STATUS ((uint16_t)0x0002) /*!< PHY Speed mask */
247-
#define PHY_DUPLEX_STATUS ((uint16_t)0x0004) /*!< PHY Duplex mask */
243+
#define PHY_SPEED_STATUS ((uint16_t)0x0004U) /*!< PHY Speed mask */
244+
#define PHY_DUPLEX_STATUS ((uint16_t)0x0010U) /*!< PHY Duplex mask */
248245

249-
#define PHY_MICR_INT_EN ((uint16_t)0x0002) /*!< PHY Enable interrupts */
250-
#define PHY_MICR_INT_OE ((uint16_t)0x0001) /*!< PHY Enable output interrupt events */
251246

252-
#define PHY_MISR_LINK_INT_EN ((uint16_t)0x0020) /*!< Enable Interrupt on change of link status */
253-
#define PHY_LINK_INTERRUPT ((uint16_t)0x2000) /*!< PHY link status interrupt mask */
247+
#define PHY_ISFR ((uint16_t)0x01DU) /*!< PHY Interrupt Source Flag register Offset */
248+
#define PHY_IMR ((uint16_t)0x001E) /*!< PHY Interrupt Mask register Offset */
249+
#define PHY_ISFR_INT4 ((uint16_t)0x0010U) /*!< PHY Link down inturrupt */
254250

255251
/* ################## SPI peripheral configuration ########################## */
256252

0 commit comments

Comments
 (0)