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);
}
}