Looking at the hal_mii.h, on line 67, i see there is a definition for power down control:
67: #define BMCR_PDOWN 0x0800 /**< Powerdown.
Is there support then, to put this interface in a powered down mode?
I am playing with Discovery 769 Board, and would like to test this, so any pointers are appreciated.
Thanks.
Powering Down Ethernet LAN8742 on Discovery 769
- Giovanni
- Site Admin
- Posts: 14457
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: Powering Down Ethernet LAN8742 on Discovery 769
Hi,
That is a generic header, you need to refer to the datasheet and see if/how the function is implemented. The driver itself does not support this mode, it is up to you to write into the register.
Giovanni
That is a generic header, you need to refer to the datasheet and see if/how the function is implemented. The driver itself does not support this mode, it is up to you to write into the register.
Giovanni
Re: Powering Down Ethernet LAN8742 on Discovery 769
The function to shut down is compatible with the declaration is why I asked the question. It basically says setting bit 11 (0x0800) to 1, will shut the ethernet interface down, and setting it to 0, enables it.
Any suggestions on where would be a good place to try to add this function in the driver?
Thanks.
Any suggestions on where would be a good place to try to add this function in the driver?
Thanks.
- Giovanni
- Site Admin
- Posts: 14457
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: Powering Down Ethernet LAN8742 on Discovery 769
Hi,
The proper place would be doing this kind of things in start/stop, it is pointless to keep the PHY active is the driver is stopped.
Giovanni
The proper place would be doing this kind of things in start/stop, it is pointless to keep the PHY active is the driver is stopped.
Giovanni
Re: Powering Down Ethernet LAN8742 on Discovery 769
So I think I have an implementation, but am not able to test it. Got the latest ChibiOS studio, working with Disco 769I board, and can build the solution but debug is not working, and I am not able to deploy, but anyway, here is what I did:
1. Added a #define BOARD_PHY_POWER to the board.h file
In the chibios182\os\hal\ports\STM32\LLD\MACv1\hal_mac_lld.c file, the 2 methods mac_lld_start and mac_lld_stop got 1 line each:
void mac_lld_stop(MACDriver *macp) {
...
#if defined(BOARD_PHY_POWER) /* Power Down Ethernet IC */
mii_write(macp, MII_BMCR, BMCR_PDOWN);
#endif
void mac_lld_start(MACDriver *macp) {
...
#if defined(BOARD_PHY_POWER) /* Power Up Ethernet IC */
mii_write(macp, MII_BMCR, ~BMCR_PDOWN);
#endif
So, is this on the right track at least?
Thanks.
1. Added a #define BOARD_PHY_POWER to the board.h file
In the chibios182\os\hal\ports\STM32\LLD\MACv1\hal_mac_lld.c file, the 2 methods mac_lld_start and mac_lld_stop got 1 line each:
void mac_lld_stop(MACDriver *macp) {
...
#if defined(BOARD_PHY_POWER) /* Power Down Ethernet IC */
mii_write(macp, MII_BMCR, BMCR_PDOWN);
#endif
void mac_lld_start(MACDriver *macp) {
...
#if defined(BOARD_PHY_POWER) /* Power Up Ethernet IC */
mii_write(macp, MII_BMCR, ~BMCR_PDOWN);
#endif
So, is this on the right track at least?
Thanks.
Re: Powering Down Ethernet LAN8742 on Discovery 769
On a detailed review, these methods are already implemented in the trunk, so seems is already in place.
void mac_lld_stop(MACDriver macp) {
#if STM32_MAC_ETH1_CHANGE_PHY_STATE
/ PHY in power down mode until the driver will be restarted.*/
mii_write(macp, MII_BMCR, mii_read(macp, MII_BMCR) | BMCR_PDOWN);
#endif
Also the opposite on start:
void mac_lld_start(MACDriver macp) {
...
#if STM32_MAC_ETH1_CHANGE_PHY_STATE
/ PHY in power up mode.*/
mii_write(macp, MII_BMCR, mii_read(macp, MII_BMCR) & ~BMCR_PDOWN);
#endif
Zan
void mac_lld_stop(MACDriver macp) {
#if STM32_MAC_ETH1_CHANGE_PHY_STATE
/ PHY in power down mode until the driver will be restarted.*/
mii_write(macp, MII_BMCR, mii_read(macp, MII_BMCR) | BMCR_PDOWN);
#endif
Also the opposite on start:
void mac_lld_start(MACDriver macp) {
...
#if STM32_MAC_ETH1_CHANGE_PHY_STATE
/ PHY in power up mode.*/
mii_write(macp, MII_BMCR, mii_read(macp, MII_BMCR) & ~BMCR_PDOWN);
#endif
Zan
Who is online
Users browsing this forum: No registered users and 20 guests