This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
I would like to get some clarification on a weird behavior regarding a modified PA_emacExample from pdk_C6670_1_0_0_17.
The objective of the modification is quite simple: to send packets from a PC and receive them in the TMDSEVM6670LE via the RJ45 connector.
1) To configure the PHY, I replaced the example's Init_Cpsw() function with Javier Malave-Bonet's SWSS_Setup_Swss() function, as instructed elsewhere in this forum. Sometimes this function will report that "PHY is running at 10mbps speed", and some times 1000mbps as well, though my PC's "mii-tool" will report "eth0: negotiated 1000baseT-HD flow-control, link ok" in all cases. I wonder which is correct and if I am actually able to get a full-duplex link.
2) I have modified the Add_MACAddress() function to route everything to pa_DEST_HOST (no filters), and have disabled the Add_IPAddress and Add_Port calls in Setup_PASS(). This way, every packet is captured in the interrupt service routine.
3) The interrupt service routine, Cpsw_RxISR, reads from the accumulator list and eventually calls VerifyPacket. All I did in the latter was disable the byte-wise check so that I can send any payload from the PC. This way, VerifyPacket will happily increment the receive counter and the ISR will terminate.
4) The main task, Cpsw_SingleCoreApp, will do a bunch of initializations and then send MAX_NUM_PACKETS to the wire. After that, there is a while loop which prints the number of received packets so far. I've turned this into an infinite loop and, here's my problem, I will only receive packets if SendPacket() runs at least once.
That's it. This is the relevant code:
/* Setup PA */
if (Setup_PASS () != 0)
{
System_printf ("PASS setup failed \n");
BIOS_exit (-1);
}
else
{
System_printf ("PASS setup successfully done \n");
}
if (SendPacket () != 0) {
System_printf ("Packet %d send failed \n", i);
BIOS_exit (-1);
}
while (gRxCounter >= 0) {
System_printf("Received %d packets so far...\n", gRxCounter);
CycleDelay (10000);
}
More specifically, this is the line inside SendPacket that must run:
Qmss_queuePush (gPaTxQHnd[8], pCppiDesc, dataBufferSize, SIZE_HOST_DESC, Qmss_Location_TAIL);
Anyway, in the main task, if I remove the SendPacket call, the ISR will never be called. I suspect the cause is that some queue has no descriptors and, after the PKTDMA recycles the descriptor which was sent to gPaTxQHnd[8], the whole thing can work again. I would like someone to suggest a way to remove this problem if possible, and an indication of a way to fix the problem in (1) is also very welcome.
Hey Igor,
To answer your questions by point:
1. For the 6670 device (or more specifically the Keystone I MAC) can operate in full duplex only in 1000 Mbit mode, and can do both half and full in 10/100. So, if you specify that speed, you're always in full duplex. When it reports the PHY is running at 'y' speed, it depends on how Javier's code is reading it. I can't tell you which is more correct, but I'll ping Javier and see. However, I would trust his code. He's our big NetCP expert.
2. If that is how you want to run your code, go for it! Just make sure you clear your interrupts when you are finished.
3. Just be careful that the payload you send is not too big to send, although it can handle jumbo packets. You should be okay.
4. You only receive packets if SendPacket has already ran once? This makes me suspect your Rx FDQ has no descriptors to process packets, and the first packet sent gives it the descriptors it needs to run the rest of them. It's a common problem, so I would make sure that has been ruled out. Just put some garbage descriptors for it to work with and see what happens. Your code looks fine.
Try that! Good luck, and I hope this works for you.
- Kat Kelsch
Dear Katherine and others,
i have a problem on my PA_emacExample (fairly default project, minor modification).
So, I merely want to test internal loopback using EMAC-2 (RJ45 SGMII1) using this example provided. Everyone who tried this example seem to successfully received the looped back packet. The minor modification I've done was changing the psFLags to 0x2; (i want to use EMAC2/RJ-45 SGMII-1 to connect the EVM with external NIC, e.g. PC or laptop in the near future).
The result in my EVM, kind of stuck on 'Received 0 packets so far...' loop. I am using C6670 EVM with cpswLpbkMode is on CPSW_LOOPBACK_INTERNAL mode.
What do you think the problem is?
Thank you.
Regards,
Aditya
Hey Aditya,
So, I'm going to say the obligatory "make sure you check your EVM setup/switches/config" comment, but I'm going to assume that you've already gone through that debug. Have you tried the setup with the PsFLags set to it's original value and see if it works? I don't think that's the source of your issue though, but just wanted to make sure.
When you say "kind of stuck" on received 0 packets, what do you mean by "kind of stuck"? Does it hang in an infinite loop there, or does it just time out? Usually the most common problem with this result is the Rx FDQ doesn't have enough descriptors provided with it to work with the packets that don't have descriptors. Obviously the connections are fine because you've gotten that far in the code without an error.
Another place I'd look is the GbE/CPSW user guide's procedure for setting up loopback (section 2.4 has it). Maybe even check that the SGMII control register has loopback enabled. If that bit is high, then you can rule out your setup procedure for doing that.
Try these procedures, and I'd bet you'd figure it out.
-Kat Kelsch
Dear Katherine,
I set the EVM to no-boot SW configuration with SW9 to Static IP configuration. Before, I've successfully ran HUA Demo with static IP.
For this PA_emacExample project, with cpswLpbkMode = CPSW_LOOPBACK_NONE, successfully transmit the packet to my laptop using wire. The transmission was captured using wireshark.
Next, I like to start to transmitting packet from laptop to EVM, i want to test the loopback first (i want to use mod RJ45 loopback cable). But, before I reach this step, I want to at least, successfully received the looped back data from internal loopback. But, yeah, the output of example hangs in an infinite loop "Received 0 packets blabla".
I have finished read the readme.txt in the example directory and already followed the step for RGMII-Loopback (not the NIC-Loopback because I want an internal loopback) and set the configuration.
Maybe, what should I check next in the example? And, what is the difference between PLL 0x00000041 and 0x00000051?
I think that's it for now. I'll come back shortly after running several changes.
-Aditya
I've got this correct result after changing PLL from 0x00000051 to 0x00000041. It seems that on the original one code, the PLL value is 0x00000041.
Now, I want to try external loopback. I hope it will be fine. Thanks.
-Aditya
[C66xx_0] **************************************************
[C66xx_0] ******* Ethernet Single Core Example Start *******
[C66xx_0] **************************************************
[C66xx_0] QMSS successfully initialized
[C66xx_0] CPPI successfully initialized
[C66xx_0] PASS successfully initialized
[C66xx_0] Ethernet subsystem successfully initialized
[C66xx_0] Tx setup successfully done
[C66xx_0] Rx setup successfully done
[C66xx_0] PASS setup successfully done
[C66xx_0] Following is the ALE table before transmits.
[C66xx_0] Port = 0, MAC address = 10:11:12:13:14:15, unicast_type = 0
[C66xx_0] Port = 1, MAC address = 10:11:12:13:14:15, unicast_type = 0
[C66xx_0] Port = 2, MAC address = 20:21:22:23:24:25, unicast_type = 0
[C66xx_0] Packet Transmission Start ...
[C66xx_0] Following is the ALE table after transmits.
[C66xx_0] Port = 0, MAC address = 10:11:12:13:14:15, unicast_type = 0
[C66xx_0] Port = 1, MAC address = 10:11:12:13:14:15, unicast_type = 0
[C66xx_0] Port = 2, MAC address = 20:21:22:23:24:25, unicast_type = 0
[C66xx_0] Packet Transmission Done.
[C66xx_0] Wait for all packets to be Received ...
[C66xx_0] Packets Sent = 10
[C66xx_0] Packets Received = 10
[C66xx_0] Example Done!
[C66xx_0] **************************************************
[C66xx_0] ******** Ethernet Single Core Example End ********
[C66xx_0] **************************************************
OK, now I've done an externel loopback test on my EVM (EVM TMDSEVM6670LE). But, it required me to change cpswEvm6678 to 1 instead of 0, because if I did cpswEvm6678 to 0, then it won't linked up on Init_SGMII::CSL_SGMII_getStatus()
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,
Yanuar
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 withTable 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 using function on this GEL file. (Scripts -> Shannon Interrupts APIs -> CorePac_event_set_fn)
I just wonder if it can be done, so ask you guys before.
Thank you and regards,
Aditya
Hi,
I think the solution comes from ignoring ARP behavior. When you try to send udp packets via an application software on PC, it sends the ARP packet first. The "ethertype" field of the ARP ethernet packet has the value of 0x0806. Whereas the value in Add_MACAddree() is 0x0800. This comes from the standart UDP packet's value. So, if you consider this phonomenon you can obtain meaningful results...
Alpaslan
Dear Alp,
thank you for coming up for a reply. Yes, I already made sure the packet is definitely the same with the packet sent from EVM. Also already set at IPv4 packet, not ARP, which correspond to 0x0800.
Eventually, this problem already been solved. My bad, not to understand enough about the receiving part of CPSW. So, for Rx, the packet can't be forwarded like in Tx. SGMII-1 (RJ45) port needs to look up to the packet's MAC destination address and match it with the ALE table which need to be set up before.
For the PA_emacExample from TI (PDK 1_1_2_6), changing the cpswLpbkMode to CPSW_LOOPBACK_NONE only enable user to transmit packet from EVM to PC, but not receiving process, because it didn't set the ALE of each port on cpsw_mgmt::Switch_update_addr(). So, I added an OR on 'if' statement if (cpswSimTest || (cpswLpbkMode == CPSW_LOOPBACK_NONE) ) right before ALE programming lines. Hence, the ALE is initialized, and user only needs to match the MAC address of the packet with the ALE table.
Zjd,
You can find the PA EMAC example at: C:\ti\pdk_C6678_1_1_2_6\packages\ti\drv\exampleProjects\PA_emacExample_exampleProject
If you do not have the MCSDK package for keystone-I device, You should download and install. Find the MCSDK download link here,
http://software-dl.ti.com/sdoemb/sdoemb_public_sw/bios_mcsdk/latest/index_FDS.html
Go through the BIOS_MCSDK user guide to find more detailed info,
http://processors.wiki.ti.com/index.php/BIOS_MCSDK_2.0_User_Guide
I would recommend, Please Create New Threads for New Issues, and even for similar issues that have already been reported. Do not reply to a thread that has already been answered and say "I'm having the same problem". You will get a faster response if you create a new issue that is not already marked answered.
Zjd,
Did you find the PA_emac example code from the MCSDK? Do you need further follow-up for this? If not, please close this thread.