Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] VSC7398 - PHY works, but switch doesn't switch any packet to other port

Status
Not open for further replies.

coolrob

Newbie level 4
Joined
Aug 30, 2012
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
Poland
Activity points
1,339
Hello!

I'm trying to set up a 1Gbit switch, built witch VSC7398 from Vitesse. I have a mictrocontroller on this same PCB board, which is connected with VSC7398 via SPI, so I can read and write registers in VSC7398. Actually PHYs works with autonegotiation (LEDs indicate current speed), but there are not any transmission between ports :sad: MACs are configured as 1Gbit and I connect 1Gbps devices to my switch. I tried with 100Mbps but result was the same. What is strange, when I read the CHIPID I get following value: 0x273850E9, so it indicates that my chip is VSC7358! I use following initialization procedure:

Code:
    SwSpiWrite(_SIPAD_ADDR, 0x00);  // set dummy bytes to 0

    reg = SwSpiRead(_CHIPID_ADDR);    // read chip's ID

    // Memory initialization 
    uint32_t memId;
    for( memId = 0 ; memId < 15 ; memId++ )
    {
        if( memId != 6 && memId != 7 )
        {
            SwSpiWrite(_MEMINIT_ADDR, ( (uint32_t)0x1010400 + memId ) );
            delay(20000);
        }
    }
    
    delay( 30 * 20000 );    // wait 30ms
    
    // Format memory
    SwSpiWrite(_MACACCESS_ADDR, 5);   // clear MAC table
   [COLOR="#FF0000"] SwSpiWrite(_VLANACCESS_ADDR, 3);  // SwSpiWrite(_VLANACCESS_ADDR, 5) was before!!![/COLOR] 
    
    delay( 40 * 20000 );    // wait 40ms
    
    // set all buffers as 20kB
    int i;
    for( i = 0 ; i < 8 ; i++ )
    {
        SwSpiWrite( (_Q_MISC_CONF_ADDR | (i<<8)), 0x80000000 );
        delay(80);   // wait 4us
    }
    
    // release PHY reset
    SwSpiWrite(_GLORESET_ADDR, 2);
    
    // from PHY Configuration.pdf
    int port;    
    for( port=0 ; port < 8 ; port++ )   
    {
        SwSpiPhyWrite(port, 31, 0x2A30);
        phy_write_masked(port, 8, 0x0200, 0x0200);
        SwSpiPhyWrite(port, 31, 0x52B5);
        SwSpiPhyWrite(port, 16, 0xB68A);
        phy_write_masked(port, 18, 0x0003, 0xFF07);
        phy_write_masked(port, 17, 0x00A2, 0x00FF);
        
        SwSpiPhyWrite(port, 16, 0x968A);
        SwSpiPhyWrite(port, 31, 0x2A30);
        phy_write_masked(port, 8, 0x0000, 0x0200);
        SwSpiPhyWrite(port, 31, 0x0000);
        
        SwSpiPhyWrite(port, 31, 0x0000);
        SwSpiPhyWrite(port, 18, 0x0048);
        SwSpiPhyWrite(port, 31, 0x2A30);
        phy_write_masked(port, 22, 0x0240, 0x0FC0);
        phy_write_masked(port, 20, 0x4000, 0x6000);
        SwSpiPhyWrite(port, 31, 1);
        phy_write_masked(port, 20, 0x6000, 0xE000);
        SwSpiPhyWrite(port, 31, 0x0000);
    }

    //----------------                   
    
    // MAC configuration
    for( memId = 0 ; memId < 7 ; memId++ )
    {
        switch ( memId )
        {          
            case 0:
              SwSpiWrite( ( _MAC_CFG_ADDR | (memId<<8) ), 0x10070184 ); // 0x90010444 - off, 0x10050444 - 10 lub 100 full Duplex, 0x90010444 - 10 lub 100 half duplex, 0x10070184 - 1Gbit
              break;
            case 1:
              SwSpiWrite( ( _MAC_CFG_ADDR | (memId<<8) ), 0x10070184 );
              break;
            case 2:
              SwSpiWrite( ( _MAC_CFG_ADDR | (memId<<8) ), 0x10070184 );
              break;
            case 3:
              SwSpiWrite( ( _MAC_CFG_ADDR | (memId<<8) ), 0x10070184 );
              break;
            case 4:
              SwSpiWrite( ( _MAC_CFG_ADDR | (memId<<8) ), 0x10070184 );
              break;
            case 5:
              SwSpiWrite( ( _MAC_CFG_ADDR | (memId<<8) ), 0x10070184 );
              break;
            case 6:
              SwSpiWrite( ( _MAC_CFG_ADDR | (memId<<8) ), 0x10070184 );
              break;
            case 7:
              SwSpiWrite( ( _MAC_CFG_ADDR | (memId<<8) ), 0x10070184 );
              break;
        }
    }
    
    // LEDs configuration
    SwSpiPhyWrite(0, 0x1B, 0x8601);
    SwSpiPhyWrite(1, 0x1B, 0x8601);
    SwSpiPhyWrite(2, 0x1B, 0x8601);
    SwSpiPhyWrite(3, 0x1B, 0x8601);
    SwSpiPhyWrite(4, 0x1B, 0x8601);
    SwSpiPhyWrite(5, 0x1B, 0x8601);
    SwSpiPhyWrite(6, 0x1B, 0x8601);
    SwSpiPhyWrite(7, 0x1B, 0x8601);
    
    
    // set MAC mask - turn on the packets transmission
    SwSpiWrite(_RECVMASK_ADDR, 0xFF);

Can anybody help me?
 
Last edited:

Problem is fixed - small mistake in code. I marked it by red color in previous post. Switch works well :)
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top