Dear all,
According to the tests, we need to verify low power mode of LAN 8720 on RT1060/RT1061 MCU.
Is there any source code that could share to us to run the low power mode of LAN on RT1060/RT1061 MCU?
Thanks.
Solved! Go to Solution.
Hello @JarvisC,
Could you please try with the following changes?
phyConfig.phyAddr = EXAMPLE_PHY_ADDRESS;
phyConfig.autoNeg = false;
phyConfig.ops = EXAMPLE_PHY_OPS;
phyConfig.resource = EXAMPLE_PHY_RESOURCE;
/* Initialize PHY and wait auto-negotiation over. */
PRINTF("Wait for PHY init...\r\n");
do
{
status = PHY_Init(&phyHandle, &phyConfig);
#define PHY_BCTL_PowerDown_MASK 0x0800U
PHY_Read(&phyHandle, PHY_BCTL_PowerDown_MASK, ®Value);
PHY_Write(&phyHandle, PHY_BCTL_PowerDown_MASK, 0x1);
To:
#define PHY_BSTATUS (0x00U)
#define PHY_BTCL_PowerDown_MASK ((uint16_t)0x0800U)
PHY_Read(&phyHandle, PHY_BSTATUS, ®Value);
PHY_Write(&phyHandle, PHY_BSTATUS, regValue | PHY_BCTL_PowerDown_MASK);
Hope these modifications helps you.
Best regards, Raul.
Hello @JarvisC,
If you are referring to Low Power Mode of Ethernet PHY LAN8720, unfortunately, there is not a source code for verifying LAN8720 power modes. Nonetheless, if you are referring to verify the Ethernet PHY LAN8720 in the RT1060 in Low Power Mode, we share you some related application notes that could be useful:
Best regards, Raul.
Hi Raul,
I had add enet_txrx_transfer source to power-mode-switch example, but how to set the bit 11 of LAN 8720 for the Power Down setting?
I still cannot get the bit 11 value and cannot set it.
Thanks.
==========================
bit 11:
Power Down
0 = normal operation
1 = General power down mode
The Auto-Negotiation Enable must be cleared before setting the Power Down.
==========================
Hi NXP,
I added below code to read/write Power down bit of LAN, but it seems not working.
I'm not sure what's wrong was that.
Could NXP share some information to read/write the power down bit of LAN ?
=================================================
#define PHY_BCTL_PowerDown_MASK 0x0800U
PHY_Read(&phyHandle, PHY_BCTL_PowerDown_MASK, ®Value);
PHY_Write(&phyHandle, PHY_BCTL_PowerDown_MASK, 0x1);
=================================================
Thanks.
Hello @JarvisC,
Just for double check, could you please check if you initialize the PHY before the PHY_Read and PHY_Write? Look how the example initializes PHY.
[evkmimrxrt1060_enet_txrx_transfer -> source -> enet_txrx_transfer.c -> main()]
Also, please verify if the Auto-Negotiation is disable before setting the Power Down bit, and the proper MODE[2:0]: Mode Configuration. For more information regarding the LAN8720 Basic Control Register please look at the datasheet.
[LAN8720A/LAN8720Ai Datasheet. Section 4.2.1 Basic Control Register]
Best regards, Raul.
Dear Raul,
I had set "phyConfig.autoNeg = false" to try to read/write PowerDown bit, but it is still not working.
PHY_BCTL_AUTONEG_MASK-R : 3100
PHY_BCTL_PowerDown_MASK-R : 3100
PHY_BCTL_PowerDown_MASK-W: 1
PHY_BCTL_PowerDown_MASK-R: 0
======================================================
#ifdef EXAMPLE_PHY_INTERFACE_RGMII
config.miiMode = kENET_RgmiiMode;
#else
config.miiMode = kENET_RmiiMode;
#endif
phyConfig.phyAddr = EXAMPLE_PHY_ADDRESS;
phyConfig.autoNeg = false; //true
mdioHandle.resource.base = EXAMPLE_ENET;
mdioHandle.resource.csrClock_Hz = EXAMPLE_CLOCK_FREQ;
/* Initialize PHY and wait auto-negotiation over. */
PRINTF("Wait for PHY init...\r\n");
do
{
status = PHY_Init(&phyHandle, &phyConfig);
if (status == kStatus_Success)
{
PRINTF("Wait for PHY link up...\r\n");
/* Wait for auto-negotiation success and link up */
count = PHY_AUTONEGO_TIMEOUT_COUNT;
do
{
PHY_GetAutoNegotiationStatus(&phyHandle, &autonego);
PHY_GetLinkStatus(&phyHandle, &link);
if (autonego && link)
{
break;
}
} while (--count);
if (!autonego)
{
PRINTF("PHY Auto-negotiation failed. Please check the cable connection and link partner setting.\r\n");
}
}
} while (!(link && autonego));
PHY_Read(&phyHandle, PHY_BCTL_AUTONEG_MASK, &data);
PRINTF("PHY_BCTL_AUTONEG_MASK-R : %x\r\n" ,data);
result = PHY_Read(&phyHandle, PHY_BCTL_PowerDown_MASK, &data);
PRINTF("PHY_BCTL_PowerDown_MASK-R : %x\r\n" ,data);
PHY_Write(&phyHandle, PHY_BCTL_PowerDown_MASK, data1);
PRINTF("PHY_BCTL_PowerDown_MASK-W: %x\r\n" ,data1);
PHY_Read(&phyHandle, PHY_BCTL_PowerDown_MASK, &data);
PRINTF("PHY_BCTL_PowerDown_MASK-R: %x\r\n" ,data);
#if PHY_STABILITY_DELAY_US
/* Wait a moment for PHY status to be stable. */
SDK_DelayAtLeastUs(PHY_STABILITY_DELAY_US, SDK_DEVICE_MAXIMUM_CPU_CLOCK_FREQUENCY);
#endif
==========================================================
Thanks.
Hello @JarvisC,
Could you please try with the following changes?
phyConfig.phyAddr = EXAMPLE_PHY_ADDRESS;
phyConfig.autoNeg = false;
phyConfig.ops = EXAMPLE_PHY_OPS;
phyConfig.resource = EXAMPLE_PHY_RESOURCE;
/* Initialize PHY and wait auto-negotiation over. */
PRINTF("Wait for PHY init...\r\n");
do
{
status = PHY_Init(&phyHandle, &phyConfig);
#define PHY_BCTL_PowerDown_MASK 0x0800U
PHY_Read(&phyHandle, PHY_BCTL_PowerDown_MASK, ®Value);
PHY_Write(&phyHandle, PHY_BCTL_PowerDown_MASK, 0x1);
To:
#define PHY_BSTATUS (0x00U)
#define PHY_BTCL_PowerDown_MASK ((uint16_t)0x0800U)
PHY_Read(&phyHandle, PHY_BSTATUS, ®Value);
PHY_Write(&phyHandle, PHY_BSTATUS, regValue | PHY_BCTL_PowerDown_MASK);
Hope these modifications helps you.
Best regards, Raul.
Dear Raul,
After modify the source code , the register value will change from 0x3100 to 0x3900 that bit 11 had been set to 1.
Thanks.