Altera_Forum
Honored Contributor
10 years agoYet Another TSE/SGDMA/Simple Socket Server Post
Hello Altera Forums! I have been a long time lurker, and am making my first post. I have been searching for my particular issue, but that has not yielded any specifically useful results.
Let me get you acquainted with my general setup and desired overall outcome. software: Quartus 13.0 sp1 Subscription Edition (Currently running NIOS and TSE as OpenCore Plus, but do have licenses for both) board: Custom Stratix IV EP4SE530 (27Mbit Ram, 530k LE) with 2x 256MB DDR3 Components mac: Altera Triple Speed Ethernet (RGMII @ 100Mbps), so I'm using a 25 MHz Tx CLK on RGMII Interface phy: Micrel KSZ9021RN, RGMII Only 10/100/1000 qsys: NIOS II /f with no flash and a connected 4Mbit onchip_mem (using this for instruction/data storage, will update code via FPGA recompile) I started with a Stratix IV Standard Ethernet Example for a development kit, then imported it into 13.0 sp1, removed the CFI Flash Controller, and added the DDR3 controllers. So far I've run the HAL/ucosii hello world example, count_binary (LED PIO), and also ran successful memory tests using the "Memory Test Small" example. So most of the NIOS here is working. The Ethernet Subsystem is exactly the same as the (hyperlink):ethernet standard example (https://www.altera.com/support/support-resources/design-examples/intellectual-property/embedded/nios-ii/exm-net-std-de.html), except in the top level my DDR3 is not connected to instruction memory. At this point I pretty much generated an SSS example in NIOS SBT, hard coded the MAC/IP/Subnet/Default Gateway, and added detection support for the Micrel PHY (it auto negotiates, and detects correct link speed). In SignalTap I am watching packets from the RGMII interface arrive, go through the MAC, and into the Avalon-ST RX SGDMA. The SGDMA will then send an IRQ to the NIOS, which gets handled by 'tse_sgdmaRx_isr'. This happens over and over, but no ping packets I have sent have ever been responded to. Here's where things get strange. The descriptors are not pointing to the packet... They are pointing into the onchip_mem! To give an outline of what is happening, here is some more relevant information: sdram: 0x00000000 - 0x0fffffff (256Mbyte) sdram2: 0x10000000 - 0x0fffffff (256Mbyte) onchip_mem: 0x20080000 - 0x200fffff (4Mbit) descriptor_memory: 0x20100000 - 0x20100fff (4Kbyte) As a sanity check, here is a random descriptor I ripped using the System Console. I did this to make sure the debugger wasn't lying :rolleyes: % master_read_memory $mypath 0x20100040 40 source: 0x00 0x00 0x00 0x00 (indicates avalon-st)reserved: 0x00 0x00 0x00 0x00
destination: 0xdc 0x97 0x0d 0x20 (memory written to)
reserved: 0x00 0x00 0x00 0x00
next_desc_ptr: 0x60 0x00 0x10 0x20 (desc + 20)
This means the destination is 0x200d97dc. Which by the way is WRONG! But why? What am I missing? Let's do another sanity check and read that address.
% master_read_memory $mypath 0x200d97dc 40 (onchip_mem access)
0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
Yup, pretty much what I expected. No packet! Well obviously there isn't going to be a packet there... The SGDMA isn't even connected to the onchip_mem, it's connected to the sdram. So if we look at the sdram at that address (which sort of makes sense?) take a look at what we find: % master_read_memory $mypath 0x000d97dc 80 (sdram access) 0x00 0x00 0xff 0xff 0xff 0xff 0xff 0xff 0x00 0x1e 0x68 0x7a 0xf5 0x94 0x08 0x06 0x00 0x01 0x08 0x00 0x06 0x04 0x00 0x01 0x00 0x1e 0x68 0x7a 0xf5 0x94 0xc0 0xa8 0x01 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0xc0 0xa8 0x01 0x0a 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0xf1 0x7e 0x6c 0xdb 0x00 0x00 0x00 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x09 0x6e 0x69 0x67 Well that definitely looks like an ethernet packet. In fact, it's the packet sent from my laptop, with the MAC address: 00:1e:68:7a:f5:94!!! I'm not entirely sure why the start of all the ST packets as 0x00 0x00, I'll need to read into that a bit more. Can anybody please explain to me why the SGDMA descriptor is pointing to 0x200d97dc instead of 0x000d97dc? Is it because my sdram isn't on the instruction memory and thus no part of the data memory is linked and nothing gets put there? I am really just confused at this point, and was not able to find any sort of sgdma_base_address# define in the sgdma_descriptor.h files or anything. I just don't know why the descriptor is claiming to have written to the onchip_mem when a) the data isn't there, and b) it's not even connected to the onchip_mem. I have attached my qsys files in case anybody would like to investigate the qsys setups. The Simple Socket Server program code is largely the same, just it has all the flash elements removed with everything hardcoded + KSZ9021RN support + a bunch of random printf()s. In case you don't want to open my Qsys Files: (hyperlink):screen cap of top level qsys (http://i.imgur.com/xmytg9z.png) (hyperlink):screen cap of ethernet subsystem (http://i.imgur.com/lum7r32.png) (hyperlink):screen cap of peripheral subsystem (http://i.imgur.com/nmw8tm7.png) If there are any other files that I can upload to help you help me, please let me know! Thank you!