Hi, I have to connect GbE port of MCH AM4901 (BCM5396 Ethernet switch) with EMAC port 0 of 6678EVM via MicroTCA. I am using PA_emacExample with modification.There is a part of cpsw_mgmt.c: Int32 Init_SGMII (UInt32 macPortNum) { CSL_SGMII_ADVABILITY sgmiiCfg; CSL_SGMII_STATUS sgmiiStatus; /* Configure SGMII Port 1 only since it is connected to RJ45 at all known EVMs */ if(macPortNum == 0) { /* Reset the port before configuring it */ CSL_SGMII_doSoftReset (macPortNum); while (CSL_SGMII_getSoftResetStatus (macPortNum) != 0); /* Hold the port in soft reset and set up * the SGMII control register: * (1) Enable Master Mode (default) * (2) Enable Auto-negotiation */ CSL_SGMII_startRxTxSoftReset (macPortNum); if (SGMII_MASTER == 0) { CSL_SGMII_disableMasterMode (macPortNum); } else { CSL_SGMII_enableMasterMode (macPortNum); } /* Setup the Advertised Ability register for this port: * (1) Enable Full duplex mode * (2) Enable Auto Negotiation */ sgmiiCfg.linkSpeed = CSL_SGMII_1000_MBPS; sgmiiCfg.duplexMode = CSL_SGMII_FULL_DUPLEX; CSL_SGMII_setAdvAbility (macPortNum, &sgmiiCfg); CSL_SGMII_enableAutoNegotiation (macPortNum); CSL_SGMII_endRxTxSoftReset (macPortNum); /* Wait for SGMII Link */ if (!cpswSimTest) {infinite loop -->
-> do-> {-> CSL_SGMII_getStatus(macPortNum, &sgmiiStatus);-> } while (sgmiiStatus.bIsLinkUp != 1); /* Wait for SGMII Autonegotiation to complete without error */ do { CSL_SGMII_getStatus(macPortNum, &sgmiiStatus); if (sgmiiStatus.bIsAutoNegError != 0) return -1; } while (sgmiiStatus.bIsAutoNegComplete != 1); /* * May need to wait some more time for the external PHY to be ready to transmit packets reliabily. * It is possible to access the PHY status register through the MDIO interface to check when * the PHY is ready. * To avoid platform-dependent code, we just introduce about 2ms wait here */ if((cpswLpbkMode == CPSW_LOOPBACK_EXTERNAL) || (cpswLpbkMode == CPSW_LOOPBACK_NONE)) CycleDelay(2000000); } } /* All done with configuration. Return Now. */ return 0; }I have infinite loop in: do { CSL_SGMII_getStatus(macPortNum, &sgmiiStatus); } while (sgmiiStatus.bIsLinkUp != 1);The value of the variables: cpswSimTest=0; SGMII_MASTER=1 | SGMII_MASTER=0Why not pass the initialization of the port 0?
Is the problem in EVM or in MHC? Thank You,Vladimir.
2727.eth_utils_250.c
0020.eth_utils_312_5.c
Hi Vladimir,
The emacExample on PA LLD examples directory does not program the EVM PHY. Futhermore, I see that you are trying to setup SGMII Port 0 instead of SGMII Port 1. The EVM's has only 1 port mapped to the RJ-45 and that is SGMII Port 1. Why do you say you want to connect specifically Port 0?
I am attaching a self-contained Ethernet configuration code for the EVM. Since I don't know which version you have of the EVM I am attaching two versions, one that assumes a SERDES refclk of 312.5mhz and one that assumes a refclk of 250mhz. Pick the appropriate one and add it to your emacExample project. Then, substitute the call to Init_CPSW() on cpsw_mgmt.c with SWSS_Setup_Swss (1). This sets up CPSW, ALE, CPGMAC, SGMII, SERDES and PHY on the EVM. You will need to setup the Broadcoam switch as master and set auto-negotiation with desired advertise ability configuration.
Regards,
Javier
Hi,
I encountered this problem before. You must use SGMII to SGMII with forced link configuration as in mentioned in GbE Switch Subsystem User Guide. If it resides "sgmiiStatus.bIsLinkUp" loop this can correspond a physical connection problem. You can observe the same behavior when you disconnect SGMII port 0.
Hi, Alpaslan,
You have already solved this problem?Unfortunately all my attempts to link the two boards 6678 through the SGMII port 0 were unsuccessful. I have tried to establish a link between the two cards directly, by combining the transmitters and receivers in mode SGMII to SGMII with forcedlink configuration as described in the sprugv9a-GbE_ug.pdf ).The value of the variable sgmiiStatusbIsLinkUp in do { CSL_SGMII_getStatus (macPortNum, &sgmiiStatus); } while (sgmiiStatus.bIsLinkUp! = 1);is equal to 0.
Thanks.
I attached the proper ethernet configuration code. If you are connecting SGMII-to-SGMII through an AMC setup then you only need to comment out the
mdio_init(PHY_1, duplex); call.
And change
*((volatile unsigned int *) (SGMII_BASE[i] + 0x10)) |= 0x00000001; to *((volatile unsigned int *) (SGMII_BASE[i] + 0x10)) |= 0x00000020; // 0x20 is forced link, 0x21 is master with auto-negotiation, then the broadcoam switch will need to be a slave with auto-negotiation turned on.
If the link is not coming up either your SERDES configuration is wrong (i.e. MPY and/or RATE) or your hardware setup is wrong. I have given you two SERDES configurations one that works for a reference clock of 250mhz and one for 312.5mzh depdneing on the EVM version your using.
Kind regards,
Also, change
#define SGMII_BASE_A 0x02090200 -> 0x02090100
#define EMAC_BASE_A 0x02090940 -> 0x02090900
Assuming you have made correct settings for cpsw&sgmii, I suggest checking SGMII clock and SGMII0P/N signal. You can watch the eye diagram of them to see whether what's wrong.
Dear guys,
I just got my EVM C6670 several weeks and now, I want to use PA_emacExample for receiving UDP packets generated by my PC using RJ45 port, which means I will be using EMAC Port-1 from now on. At this state, I am successfully running these cases: LOOPBACK_INTERNAL and EXTERNAL, and LOOPBACK_NONE (one-way EVM to PC only). The packet captured by Wireshark in my PC.
My plan is to send exactly same packet, with the MAC, IP and Port exchanged between Destination and Source, because now the source is my PC and the destination is the EVM. But, it seems like the packet never trigger the interrupt.
Several changes and steps I've done on PA_emacExample:
1. Set cpswSimTest = 0;
2. Set cpswLpbkMode = CPSW_LOOPBACK_NONE;
3. Set cpswEvm6678 = 1 (I'm using C6670, but If set this var to 0, then always got stuck when linking up the emac port 0)
Int cpswSimTest = 0;Int cpswLpbkMode = CPSW_LOOPBACK_NONE;Int cpswEvm6678 = 1;
4. on Init_CPSW, the EMAC Port initialization start at 1 (EMAC Port-1 connected to RJ-45), because I don't want to use AMC connected EMAC Port-0.
for (macPortNum = 1/*0*/; macPortNum < NUM_MAC_PORTS; macPortNum++) {
/*.....codes.....*/
}
5. on Init_CPSW, leave the Init_MDIO() as it be, it seems this function is empty and always return SUCCESS.
6. on Send_Packet(), I changed the psFlags to 0x2, because I read that 0x1 would configure EMAC Port-0 and 0x2 for EMAC Port-1.
7. on Send_Packet(), on pktMatch (main data and payload), I changed the MAC header, specifically, I changed the MAC destination with my laptop's NIC MAC Address. I left the rest on default.
8. Build, Connect, load GEL, and RUN.
9. Watch my laptop NIC activity using Wireshark, packet successfully read by Wireshark. There are 10 UDP packets. (It seems the packets is unicasted).
10. Generate same stream of packets using Packeth, but the MAC address, IP address and Port swapped. Generate the 10 packets with 1ms delay between each packet.
11. On CCS console stuck on "Receiving 0 packets...." infinite loop.
You can see that I want to have standard PC to EVM and vice versa operation using wired RJ-45 connection. How I should make those steps works? And how I can watch/debug the interrupt and make sure whether the interrupt is triggered or not?
Thank you and regards,
Aditya
Hey,
I've just found about Shannon_Interrupts_v0.2.gel in http://processors.wiki.ti.com/index.php/File:Shannon_Interrupts_v0.2.gel.zip. And it seems that we can trigger the interrupt using the function inside GEL instead, rather using trigger from original interrupt from the SGMII-1 (RJ-45) which still be my problem right now. I just want to know why the packet sent from my PC can't trigger the interrupt inside EVM.
Now, from the code inside cppi_qmss_mgmt.c on PA_emacExample, the interrupt event ID is 48, and linking it up with Table 5-11 from Keystone Multicore Guide (C6670 sprugr9e.pdf), it does make sense that the Rx Queue is 704 because the core ID or N is 0 (i'm using core 0 to run the PA_emacExample). So, I guess just execute a trigger to interrupt for event ID 48 with correspond vector ID using function on this GEL file.
I just wonder if it can be done, so ask you guys before.
Hey guys,
later after last problem, I've updated the PDK and the CCS. Now, just with a little change on cpswLoopbackMode to LOOPBACK_NONE, already set the app to use RJ45 Port (SGMII-1 port) instead of AMC connected port. Now much more easier to use this emacExample on new PDK (1.1.2.6) to send packets to external PC.
Later, on Setup_PASS, I removed IPv4 and Port filter, left only Add_MACAddress only to forward packet to accumulator with corresponding MAC destination address. Now it seems that ALE table updated whenever a packet generated from PC (I'm using packeth). However, the ISR Rx (CPSW_RXISR) never been triggered yet.
Anyone have any solution or clue on how to solve this out?
Thank you,