Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
OPTA: keep ethernet phy under reset at boot
  • Loading branch information
maidnl committed Jun 20, 2024
commit 308d1faf8ba372136894ec182aeb23b94b5d0b81
2 changes: 2 additions & 0 deletions variants/OPTA/pins_arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,8 @@ void _ontouch1200bps_();

#define USB_MAX_POWER (500)

#define ETHERNET_PHY_RESET (185)

static GPIO_TypeDef * const GPIO_PORT[] = {
GPIOA,
GPIOB,
Expand Down
8 changes: 7 additions & 1 deletion variants/OPTA/variant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ PinDescription g_APinDescription[] = {
{ PJ_12, NULL, NULL, NULL },
{ PJ_13, NULL, NULL, NULL },
{ PJ_14, NULL, NULL, NULL },
{ PJ_15, NULL, NULL, NULL },
{ PJ_15, NULL, NULL, NULL }, // 185 - RESET ETHERNET PHY ON OPTA
{ PK_0, NULL, NULL, NULL },
{ PK_1, NULL, NULL, NULL },
{ PK_2, NULL, NULL, NULL },
Expand Down Expand Up @@ -355,6 +355,11 @@ void initVariant() {
// Disable the FMC bank1 (enabled after reset)
// See https://github.com/STMicroelectronics/STM32CubeH7/blob/beced99ac090fece04d1e0eb6648b8075e156c6c/Projects/STM32H747I-DISCO/Applications/OpenAMP/OpenAMP_RTOS_PingPong/Common/Src/system_stm32h7xx.c#L215
FMC_Bank1_R->BTCR[0] = 0x000030D2;


pinMode(ETHERNET_PHY_RESET,OUTPUT);
// keep ethernet phy reset...
digitalWrite(ETHERNET_PHY_RESET, LOW);
}

#ifdef SERIAL_CDC
Expand All @@ -377,6 +382,7 @@ uint8_t getUniqueSerialNumber(uint8_t* name) {
}

void _ontouch1200bps_() {
digitalWrite(ETHERNET_PHY_RESET, LOW);
HAL_RTCEx_BKUPWrite(&RTCHandle, RTC_BKP_DR0, 0xDF59);
NVIC_SystemReset();
}
Expand Down