Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Altera_Forum
Honored Contributor I
1,155 Views

Configuring DP83848C using TSE MAC

Hi, 

 

I newbie in Ethernet protocol. We are using DP83848C interface with Cyclone-IV (Custom board).  

 

We wish to use TSE in opencore plus in Standalone 10/100/1000 Mbps Ethernet MAC. As i am a newbie, i first went throught the documents TSE Megacore function and Datasheet of DP83848C. but i am not able to find a way to configure dp83848c using tse interface.  

 

I am looking for headstart in c program (Nios-II) to do the same. Any code snippet will be of great help.  

 

Thanks in advance 

Nandish Jasani.
0 Kudos
3 Replies
Altera_Forum
Honored Contributor I
34 Views

DP83848C is the phy which makes the interface between the MAC and the Ethernet wire. 

The phy configuration can be done with pin strapping (i.e. the level of a few pins at reset time defines how the devices will operate) or through the 2-wire mdio interface. 

Since the TSE MAC (like most MACs) does have a mdio port available for these purpose, this is the usual choice.  

In the HAL driver you also find the functions to directly access PHY configuration registers, without bothering with the mdio protocol. 

If you don't have a reference design and sample code for the DP83848, you must refer to the device datasheet in order to know which registers you need to program to enable ethernet communication.
Altera_Forum
Honored Contributor I
34 Views

Thanks, I will try with HAL and try to access PHY configuration registers. 

 

Nandish Jasani.
Altera_Forum
Honored Contributor I
34 Views

https://www.alteraforum.com/forum/attachment.php?attachmentid=8034 Hi, 

 

I tried below code but when i seen in MDC pin in CRO i got the square wave of 2.5MHz as i configure in TSE MAC, but in MDIO pin i seen only DC 3.3V in CRO instead of MDIO Frame. So please suggest if i am wrong in coding. I try to access 0x18 register in PHY DP83848C through MDIO as shown in coding. I try to change the LED Status by forced method. 

 

Is there any setting require in Qsys, Nios-II? 

 

# include <unistd.h> 

# include "system.h" 

# include <stdio.h> 

# include "altera_avalon_pio_regs.h" 

# include "altera_avalon_timer_regs.h" 

# include "altera_avalon_tse.h" 

# include "altera_avalon_tse_system_info.h" 

# include "altera_avalon_sgdma.h" 

# include "altera_avalon_sgdma_descriptor.h" 

# include "altera_avalon_sgdma_regs.h" 

# include "alt_types.h" 

# include "altera_eth_tse_regs.h" 

 

 

int main(void) 

alt_u32 phyadd; 

 

lcd_initialization(); 

clear_lcd_display(); 

display_message_01(); 

usleep(1000000); 

clear_lcd_display(); 

display_message_02(); 

usleep(1000000); 

 

IOWR_ALTERA_TSEMAC_MDIO_ADDR0(ETHERNET_MACHINE_BASE, 0X01); 

phyadd = IORD_ALTERA_TSEMAC_MDIO_ADDR0(ETHERNET_MACHINE_BASE); 

printf ("%ld", phyadd); 

IOWR_ALTERA_TSEMAC_MDIO(ETHERNET_MACHINE_BASE,0,0x18,0x003f); 

 

 

while (1) 

led1_off(); 

usleep(1000000); 

led2_off(); 

usleep(1000000); 

led3_off(); 

usleep(1000000); 

led3_on(); 

usleep(1000000); 

led2_on(); 

usleep(1000000); 

led1_on(); 

usleep(1000000); 

}
Reply