Sample code to send Ethernet packet

Author
jrmymllr
Senior Member
  • Total Posts : 150
  • Reward points : 0
  • Joined: 2011/06/11 06:05:25
  • Location: MPLS
  • Status: offline
2017/12/06 19:13:16 (permalink)
0

Sample code to send Ethernet packet

I'm using a PIC32MZ2048EFG064 on a proto board (no eval board) and a Pickit3. Right now I'm only trying to send a junk packet on Ethernet, but after days I've accomplished little. I'm using the standard Ethernet pins and RMII and have #pragma statements to set this, but at this point I've disconnected the PHY and am only looking for evidence of a transmitted packet by looking at MAC registers and the descriptor TSV bits. And if I'm lucky, a scope to see activity on ETXEN, ETXD0 or ETXD1.
 
When I set TXRTS it does clear itself, but there is zero evidence of anything else happening. No changes in the MAC registers, all TSV bits are zero, nothing out on my scope. I originally had 50MHz going into EREFCLK, but then assuming the MAC is probably totally static, feed just 1kHz in there now in case the high frequency isn't playing well with my proto wiring job. I've verified the EREFCLK connection is there since I temporary turned off Ethernet and set it as an input and wrote some code to look for transitions. That's all good.
 
I've looked at other sample code, followed the initialization in DS60001155D, and tried everything I can think of.  I tried Harmony but it's darn near impossible to follow what that's even doing.
 
Does anyone have sample code for this chip so I can just send something out of the MAC pins? This peripheral is maddening. 
 
 
#1

5 Replies Related Threads

    NKurzman
    A Guy on the Net
    • Total Posts : 15119
    • Reward points : 0
    • Joined: 2008/01/16 19:33:48
    • Location: 0
    • Status: offline
    Re: Sample code to send Ethernet packet 2017/12/06 20:52:47 (permalink)
    5 (1)
    ProtoBoard?  What king/  The PIC32 and the PHY need proper layout to work.
    Does your schematic Match the Microchip boards?
    Why Don't you have an eval Board?  You would be up and working.
     
    There are several socket sample Projects in harmony.
     
    #2
    mrpackethead
    packet mangler
    • Total Posts : 857
    • Reward points : 0
    • Joined: 2007/04/01 23:33:39
    • Location: 0
    • Status: offline
    Re: Sample code to send Ethernet packet 2017/12/07 03:12:15 (permalink)
    0
    What kind of phy? What kind of clock source. Layout is critical.
    #3
    jrmymllr
    Senior Member
    • Total Posts : 150
    • Reward points : 0
    • Joined: 2011/06/11 06:05:25
    • Location: MPLS
    • Status: offline
    Re: Sample code to send Ethernet packet 2017/12/07 05:15:37 (permalink)
    0
    What I mean by protoboard is an SMT to through-hole adapter so I have a way to connect my debugger, power, decoupling, and some I/O. I do not have an eval board at this time, and while having that would certainly be helpful, I want to use a specific stack without an RTOS, and an example of that seems to be nowhere to be found. I do however have this same stack running on a TI ARM in this way so it's just a matter of porting it. In order to do this, I need to be able to send raw frames. This should be a simple task but ignoring the PHY, stuff just isn't working from a MAC perspective.
    #4
    jrmymllr
    Senior Member
    • Total Posts : 150
    • Reward points : 0
    • Joined: 2011/06/11 06:05:25
    • Location: MPLS
    • Status: offline
    Re: Sample code to send Ethernet packet 2017/12/07 05:21:10 (permalink)
    0
    It's a LAN8720 but that and layout is irrelevant right now. I do mention the clock in the OP. 
     
    My problem is the MAC registers and descriptor TSV bits aren't cooperating. I don't believe I need a PHY to see evidence of a transmitted frame, especially in full duplex mode. Right now my goal is to see activity on the MAC transmit pins and/or some evidence of a transmitted frame beyond the TXRTS clearing itself by looking at MAC registers, neither of which I see. Basically something MPSIM would demonstrate, if it simulated the MAC.
    #5
    jrmymllr
    Senior Member
    • Total Posts : 150
    • Reward points : 0
    • Joined: 2011/06/11 06:05:25
    • Location: MPLS
    • Status: offline
    Re: Sample code to send Ethernet packet 2017/12/07 05:39:38 (permalink)
    0
    I've been assuming in FDX mode the state of the MAC pins that are inputs are irrelevant if I only want to transmit something. But, how about CRS_DV? I was just looking at the RMII signals (again) and starting to wonder if Carrier Sense must be detected in order to transmit.
    #6
    Jump to:
    © 2017 APG vNext Commercial Version 4.5