Tool/software:
Dear TI Support Team,
I am working on a project involving the interfacing of the DP83869 Ethernet PHY with the MSP432P401R LaunchPad. I am encountering issues when attempting to read the PHY address, consistently receiving "FFFF" as the output. Below are the details of my setup and the steps I have taken so far:
Hardware Configuration:
- Ethernet PHY: DP83869
- Microcontroller: MSP432P401R
- Development Board: MSP432P401R LaunchPad
Connections:
- The DP83869 is connected to the MSP432P401R via the MII/MDIO interface.
- MDIO is connected to the P2.7 on the MSP432P401R.
- MDC is connected to the P2.6 on the MSP432P401R.
- Power and ground connections are properly established.
Software Configuration:
- Using TI’s driver libraries for MSP432P401R.
- MDIO and MDC pins are configured as per the datasheet requirements.
- Attempting to read the PHY identifier registers to determine the PHY address.
Issue Description:
- When reading the PHY identifier registers, I consistently receive "FFFF" as the output.
- I have verified the connections and ensured that the MDIO and MDC signals are correctly set up.
Steps Taken:
- Initialized the MII/MDIO interface using the TI driver library functions.
- Configured the PHY address as 0x01 based on initial assumptions.
- Attempted to read the PHY identifier registers (specifically registers 0x02 and 0x03).
- Consistently receiving "FFFF" as the response from the PHY identifier registers.
Specific Questions:
- Could you confirm the correct procedure to read the PHY identifier registers for the DP83869?
- Are there any specific initialization steps or configurations required for the DP83869 to respond correctly to MDIO read requests?
- Could you provide any example code or application notes that specifically address interfacing the DP83869 with the MSP432P401R?
- Are there any known issues or additional configurations needed for the DP83869 when used with the MSP432P401R?
Additional Information:
- I have referred to the DP83869 datasheet and application notes, but have not been able to resolve the issue.
- If needed, I can provide scope traces of the MDIO and MDC signals for further analysis.
Here I have given my code for Your reference.
#include "ti/devices/msp432p4xx/inc/msp.h"
#include "ti/devices/msp432p4xx/inc/msp432p401r.h"
#include "ti/devices/msp432p4xx/inc/msp.h"
#include "ti/devices/msp432p4xx/driverlib/driverlib.h"
#include <stdio.h>
#include <stdint.h>
#include <stddef.h>
#include <NoRTOS.h>
#include <ti/drivers/Board.h>
#include <ti/drivers/GPIO.h>
#include <ti/drivers/UART.h>
#include "ti_drivers_config.h"
#include "ti/devices/msp432p4xx/driverlib/gpio.h"
#define MDC_PIN BIT6 // P2.6
#define MDIO_PIN BIT7 // P2.7
#define GPIO_PORT GPIO_PORT_P2
int PhyReadData = 0;
/*
* ======== main ========
*/
void SysTick_delay(uint32_t delay_ms) {
uint32_t delay_cycles = (3000000 / 1000) * delay_ms;
SysTick->LOAD = delay_cycles - 1;
SysTick->VAL = 0;
SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | SysTick_CTRL_ENABLE_Msk;
while ((SysTick->CTRL & SysTick_CTRL_COUNTFLAG_Msk) == 0);
SysTick->CTRL = 0;
}
void mdcPulse() {
GPIO_setOutputHighOnPin(GPIO_PORT, MDC_PIN);
SysTick_delay(100);
GPIO_setOutputLowOnPin(GPIO_PORT, MDC_PIN);
SysTick_delay(100);
}
void writeMDIOBit(int bit) {
if (bit) {
GPIO_setAsOutputPin(GPIO_PORT, MDIO_PIN);
GPIO_setOutputHighOnPin(GPIO_PORT, MDIO_PIN);
} else {
GPIO_setAsOutputPin(GPIO_PORT, MDIO_PIN);
GPIO_setOutputLowOnPin(GPIO_PORT, MDIO_PIN);
}
mdcPulse();
}
int readMDIOBit() {
int bit;
GPIO_setAsInputPin(GPIO_PORT, MDIO_PIN);
mdcPulse();
bit = GPIO_getInputPinValue(GPIO_PORT, MDIO_PIN);
return bit;
}
void writePHYRegister(int phyAddr, int regAddr, int data) {
int i;
for (i = 0; i < 32; i++) writeMDIOBit(1); // Preamble
writeMDIOBit(0);
writeMDIOBit(1);
writeMDIOBit(0);
writeMDIOBit(1);
for (i = 4; i >= 0; i--) writeMDIOBit((phyAddr >> i) & 0x01);
for (i = 4; i >= 0; i--) writeMDIOBit((regAddr >> i) & 0x01);
writeMDIOBit(1);
writeMDIOBit(0);
for (i = 15; i >= 0; i--) writeMDIOBit((data >> i) & 0x01);
}
int readPHYRegister(int phyAddr, int regAddr) {
int i;
for (i = 0; i < 32; i++) writeMDIOBit(1); // Preamble
writeMDIOBit(0);
writeMDIOBit(1);
writeMDIOBit(1);
writeMDIOBit(0);
for (i = 4; i >= 0; i--) writeMDIOBit((phyAddr >> i) & 0x01);
for (i = 4; i >= 0; i--) writeMDIOBit((regAddr >> i) & 0x01);
writeMDIOBit(1);
writeMDIOBit(0);
for (i = 15; i >= 0; i--) {
PhyReadData <<= 1;
PhyReadData |= readMDIOBit();
}
return PhyReadData;
}
int main(void)
{
char input;
const char echoPrompt[] = "WELCOME TO PODS TCIM DE TEST:\r\n";
UART_Handle uart;
UART_Params uartParams;
Board_init();
NoRTOS_start();
GPIO_init();
UART_init();
GPIO_setConfig(CONFIG_GPIO_LED_0, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
GPIO_write(CONFIG_GPIO_LED_0, CONFIG_GPIO_LED_ON);
UART_Params_init(&uartParams);
uartParams.writeDataMode = UART_DATA_BINARY;
uartParams.readDataMode = UART_DATA_BINARY;
uartParams.readReturnMode = UART_RETURN_FULL;
uartParams.readEcho = UART_ECHO_OFF;
uartParams.baudRate = 115200;
uart = UART_open(CONFIG_UART_0, &uartParams);
if (uart == NULL) {
while (1);
}
UART_write(uart, echoPrompt, sizeof(echoPrompt));
WDT_A->CTL = WDT_A_CTL_PW | WDT_A_CTL_HOLD;
GPIO_setAsOutputPin(GPIO_PORT, MDC_PIN);
GPIO_setAsInputPin(GPIO_PORT, MDIO_PIN);
GPIO_setOutputHighOnPin(GPIO_PORT, MDC_PIN);
// writePHYRegister(0, 0x00, 0x8000); // Reset the PHY (assuming PHY address 0)
int phyID1 = readPHYRegister(0, 0x31); // Read PHYIDR1
int phyID2 = readPHYRegister(0, 0x31); // Read PHYIDR2
char phyID1_str[10];
char phyID2_str[10];
snprintf(phyID1_str, 10, "%x\n", phyID1);
snprintf(phyID2_str, 10, "%x\n", phyID2);
UART_write(uart, (const uint8_t*)phyID1_str, sizeof(phyID1_str));
UART_write(uart, (const uint8_t*)phyID2_str, sizeof(phyID2_str));
printf("\nPhyID1:%x\nPhyID2:%x\n", phyID1, phyID2);
return 0;
}
Thank you for your assistance. I look forward to your guidance on resolving this issue.