Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
17 years ago

DE2 Send/Receive data via Ethernet Port

Hi,

I am currently working on a project which requires using DE2 to send/receive data to/from a web server. I have searched on google and found the DE2 example which uses DM9000A to send and receive packets through Ethernet. But the example come with Quartus software uses lan91c111 and uC/OS.

If I use lan91c111, how do I assign the pins like

address_to_the_lan91c111[15..0]

byteenable_to_the_lan91c111[3..0]

ior_n_to_the_lan91c111

iow_n_to_the_lan91c111

reset_to_the_lan91c111

tristate_bridge_data[31..0]

I dont really understand what is the main difference between these two methods. And I have never touched computer network before and really dont know where to start.

I have been stuck on this for a long time, any help would be really appreciated.

Thanks a lot

7 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi.

    If you've never touched a computer network, maybe is a good idea to read a lot about ethernet hard specifications, plus ethernet protocols and their diferences.

    Also if you've a DE2 board could be quiet easy to use the onboard DM9000.

    Did you read my UDP example ? is totally open.

    It is not directly usefull for you, but would be for understsnd better, how the ethernet works.

    The thread is at http://www.alteraforum.com/forum/showthread.php?t=3947

    Regards.

    Alberto.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    Hi.

    If you've never touched a computer network, maybe is a good idea to read a lot about ethernet hard specifications, plus ethernet protocols and their diferences.

    Also if you've a DE2 board could be quiet easy to use the onboard DM9000.

    Did you read my UDP example ? is totally open.

    It is not directly usefull for you, but would be for understsnd better, how the ethernet works.

    The thread is at http://www.alteraforum.com/forum/showthread.php?t=3947

    Regards.

    Alberto.

    --- Quote End ---

    Thanks for your help!!!!!:)
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Thanks for your post. I am currently in my final year at OIT. I am having major trouble with receiving packets through the DM9000. I've read all of the documentation on ISRs, the DM9000A, and many threads; however, I cannot seem to get stable and reliable packet reception. If you could give me a hand or point me in the right direction I would greatly appreciate it.

    Thank You,

    Adam F.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Sorry Adam.

    I can not yet to get the recieve part working fine , seems that I had the same problems as you.

    I think that could be some wrong in the DM9000 driver code, but I've not time in this momment to play with it.

    Anyway when I'll get some free time, I'll continue trying, and I'll post the working code too, hope not to be so later for you.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Thank you. I'll keep playing with things and get back to you if I can figure it out.

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Got it, I wish I got it 4 weeks ago, but I am still elated. This is sloppy and I haven't fine tuned it; but calling DM9000_Init() in the ISR keeps the program running. Here is some sample code:

    # include "basic_io.h"# include "test.h"# include "LCD.h"# include "DM9000A.C"

    # define DE2_8_7Segs_BASE 0x01901028

    unsigned int aaa,rx_len,i,packet_num;

    unsigned char RXT[68];

    void ethernet_interrupts()

    {

    packet_num++;

    aaa=ReceivePacket (RXT,&rx_len);

    DM9000_init();

    }

    int main(void)

    {

    unsigned int Success;

    unsigned char TXT[] = { 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,

    0x01,0x60,0x6E,0x11,0x02,0x0F,

    0x08,0x00,0x11,0x22,0x33,0x44,

    0x55,0x66,0x77,0x88,0x99,0xAA,

    0x55,0x66,0x77,0x88,0x99,0xAA,

    0x55,0x66,0x77,0x88,0x99,0xAA,

    0x55,0x66,0x77,0x88,0x99,0xAA,

    0x55,0x66,0x77,0x88,0x99,0xAA,

    0x55,0x66,0x77,0x88,0x99,0xAA,

    0x55,0x66,0x77,0x88,0x99,0xAA,

    0x00,0x00,0x00,0x20 };

    //Initialize the LCD.

    LCD_Init();

    //Test the LCD.

    //LCD_Test();

    Success = DM9000_init();

    LCD_Show_Text("");

    if (Success == DMFE_SUCCESS)

    {

    //Tell the user if the DM9000A initialize or failed.

    LCD_Show_Text("DM9000A");

    LCD_Line2();

    LCD_Show_Text("Initialized.");

    alt_irq_register( DM9000A_IRQ, NULL, (void*)ethernet_interrupts );

    }

    else

    {

    LCD_Show_Text("DM9000 Failed.");

    }

    //printf("Device initialization complete.");

    packet_num=0;

    //Main loop.

    while (Success == 0)

    {

    Success = TransmitPacket(TXT,0x40);

    msleep(500);

    outport(DE2_8_7SEGS_BASE ,packet_num);

    }

    LCD_Show_Text("TX Failed.");

    return 0;

    }

    //-------------------------------------------------------------------------
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    This points to a problem with the code; the ISR mask must not be cleared; however, the behavior is different.