Skip to content

Commit ea877a8

Browse files
pennamfacchinm
authored andcommitted
Portenta: enable ETH power supply
1 parent 67a7c96 commit ea877a8

File tree

3 files changed

+90
-0
lines changed

3 files changed

+90
-0
lines changed

connectivity/drivers/emac/TARGET_STM/TARGET_STM32H7/TARGET_PORTENTA_H7/stm32h7_eth_init.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#ifndef USE_USER_DEFINED_HAL_ETH_MSPINIT
3232

3333
#include "stm32h7xx_hal.h"
34+
#include "portenta_power.h"
3435

3536
#define ETH_TX_EN_Pin GPIO_PIN_11
3637
#define ETH_TX_EN_GPIO_Port GPIOG
@@ -59,6 +60,8 @@ void HAL_ETH_MspInit(ETH_HandleTypeDef *heth)
5960
GPIO_InitTypeDef GPIO_InitStruct;
6061
if(heth->Instance == ETH)
6162
{
63+
enableEthPowerSupply();
64+
6265
#if !(defined(DUAL_CORE) && defined(CORE_CM4))
6366
/* Disable DCache for STM32H7 family */
6467
SCB_DisableDCache();
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/*
2+
Copyright (c) 2019 Arduino. All right reserved.
3+
4+
This library is free software; you can redistribute it and/or
5+
modify it under the terms of the GNU Lesser General Public
6+
License as published by the Free Software Foundation; either
7+
version 2.1 of the License, or (at your option) any later version.
8+
9+
This library is distributed in the hope that it will be useful,
10+
but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12+
See the GNU Lesser General Public License for more details.
13+
14+
You should have received a copy of the GNU Lesser General Public
15+
License along with this library; if not, write to the Free Software
16+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17+
*/
18+
19+
/******************************************************************************
20+
INCLUDE
21+
******************************************************************************/
22+
23+
#include "mbed.h"
24+
#include "portenta_power.h"
25+
26+
/******************************************************************************
27+
PUBLIC MEMBER FUNCTIONS
28+
******************************************************************************/
29+
void enableEthPowerSupply(void)
30+
{
31+
/* Ensure ETH power supply */
32+
mbed::I2C i2c(PB_7, PB_6);
33+
34+
char data[2];
35+
36+
// LDO3 to 1.2V
37+
data[0]=0x52;
38+
data[1]=0x9;
39+
i2c.write(8 << 1, data, sizeof(data));
40+
data[0]=0x53;
41+
data[1]=0xF;
42+
i2c.write(8 << 1, data, sizeof(data));
43+
44+
// SW2 to 3.3V (SW2_VOLT)
45+
data[0]=0x3B;
46+
data[1]=0xF;
47+
i2c.write(8 << 1, data, sizeof(data));
48+
49+
// SW1 to 3.0V (SW1_VOLT)
50+
data[0]=0x35;
51+
data[1]=0xF;
52+
i2c.write(8 << 1, data, sizeof(data));
53+
54+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
Copyright (c) 2019 Arduino. All right reserved.
3+
4+
This library is free software; you can redistribute it and/or
5+
modify it under the terms of the GNU Lesser General Public
6+
License as published by the Free Software Foundation; either
7+
version 2.1 of the License, or (at your option) any later version.
8+
9+
This library is distributed in the hope that it will be useful,
10+
but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12+
See the GNU Lesser General Public License for more details.
13+
14+
You should have received a copy of the GNU Lesser General Public
15+
License along with this library; if not, write to the Free Software
16+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17+
*/
18+
19+
#ifndef PORTENTA_POWER
20+
#define PORTENTA_POWER
21+
22+
23+
#if defined(__cplusplus)
24+
extern "C" {
25+
#endif /* __cplusplus */
26+
27+
extern void enableEthPowerSupply(void);
28+
29+
#if defined(__cplusplus)
30+
}
31+
#endif
32+
33+
#endif

0 commit comments

Comments
 (0)