CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Wake on LAN - sending the frame from a PIC

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
JBM



Joined: 12 May 2004
Posts: 54
Location: edinburgh, Scotland

View user's profile Send private message

Wake on LAN - sending the frame from a PIC
PostPosted: Mon Dec 26, 2005 11:11 am     Reply with quote

I've recently found an application where it would be handy to have a PIC based device send Wake-On-Lan frames to PCs. I thought it would be very straightforward, but I've run into a problem (or two).

I'm using the PICDEM.net board from MCHP, and the CCS port of their stack.

My problem is that when I send my data as a frame and use Ethereal to view it, more is data is being sent than I want to be. More specifically, it assumes the frame I send is a multicast packet of IP type (i think), then tacks the data I want on to the end. I want only the bytes I send using MACPut to be sent.

I'll post the code and a frame it sends below. I'm sure it's something pretty obvious, but since i've never gone down to the MAC layer beofre, it's not so obvious to me!

Code:
void MagicPacket()
{
    int8 to[6]={0x00,0x12,0x3F,0xD0,0x97,0xF8};

    int8 i;

    MACPut(to[0]);                     //to
    MACPut(to[1]);
    MACPut(to[2]);
    MACPut(to[3]);
    MACPut(to[4]);
    MACPut(to[5]);

    MACPut(MY_MAC_BYTE1);                     //from
    MACPut(MY_MAC_BYTE2);
    MACPut(MY_MAC_BYTE3);
    MACPut(MY_MAC_BYTE4);
    MACPut(MY_MAC_BYTE5);
    MACPut(MY_MAC_BYTE6);


    MACPut(0x00);                           
   MACPut(0xFE);

   MACPut(0xFF);
   MACPut(0xFF);
   MACPut(0xFF);
   MACPut(0xFF);
   MACPut(0xFF);
   MACPut(0x00);

   for(i=0; i<16; i++){
      MACPut(to[0]);                     //to
       MACPut(to[1]);
       MACPut(to[2]);
       MACPut(to[3]);
       MACPut(to[4]);
       MACPut(to[5]);
   }


   MACFlush();
}


Here's what etheral says is being sent.
Code:

0000   ff ff ff ff ff ff 46 20 46 41 54 20 08 00 45 00  ......F FAT ..E.
0010   01 14 01 76 00 00 64 11 54 64 00 00 00 00 ff ff  ...v..d.Td......
0020   ff ff 00 44 00 43 01 00 00 00 00 12 3f d0 97 f8  ...D.C......?...
0030   46 20 46 41 54 20 00 fe ff ff ff ff ff 00 00 12  F FAT ..........
0040   3f d0 97 f8 00 12 3f d0 97 f8 00 12 3f d0 97 f8  ?.....?.....?...
0050   00 12 3f d0 97 f8 00 12 3f d0 97 f8 00 12 3f d0  ..?.....?.....?.
0060   97 f8 00 12 3f d0 97 f8 00 12 3f d0 97 f8 00 12  ....?.....?.....
0070   3f d0 97 f8 00 12 3f d0 97 f8 00 12 3f d0 97 f8  ?.....?.....?...
0080   00 12 3f d0 97 f8 00 12 3f d0 97 f8 00 12 3f d0  ..?.....?.....?.
0090   97 f8 00 12 3f d0 97 f8 00 12 3f d0 97 f8 00 12  ....?.....?.....
00a0   3f d0 97 f8 46 20 46 41 54 20 00 fe ff ff ff ff  ?...F FAT ......
00b0   ff 00 00 12 3f d0 97 f8 00 12 3f d0 97 f8 00 12  ....?.....?.....
00c0   3f d0 97 f8 00 12 3f d0 97 f8 00 12 3f d0 97 f8  ?.....?.....?...
00d0   00 12 3f d0 97 f8 00 12 3f d0 97 f8 00 12 3f d0  ..?.....?.....?.
00e0   97 f8 00 12 3f d0 97 f8 00 12 3f d0 97 f8 00 12  ....?.....?.....
00f0   3f d0 97 f8 00 12 3f d0 97 f8 00 12 3f d0 97 f8  ?.....?.....?...
0100   00 12 3f d0 97 f8 00 12 3f d0 97 f8 00 12 3f d0  ..?.....?.....?.
0110   97 f8 00 12 3f d0 97 f8 46 20 46 41 54 20 00 fe  ....?...F FAT ..
0120   ff ff                                            ..



I can see the data I want sent withing the above block:
Code:

                                     00 12 3f d0 97 f8  ...D.C......?...
0030   46 20 46 41 54 20 00 fe ff ff ff ff ff 00 00 12  F FAT ..........
0040   3f d0 97 f8 00 12 3f d0 97 f8 00 12 3f d0 97 f8  ?.....?.....?...
0050   00 12 3f d0 97 f8 00 12 3f d0 97 f8 00 12 3f d0  ..?.....?.....?.
0060   97 f8 00 12 3f d0 97 f8 00 12 3f d0 97 f8 00 12  ....?.....?.....
0070   3f d0 97 f8 00 12 3f d0 97 f8 00 12 3f d0 97 f8  ?.....?.....?...
0080   00 12 3f d0 97 f8 00 12 3f d0 97 f8 00 12 3f d0  ..?.....?.....?.
0090   97 f8 00 12 3f d0 97 f8 00 12 3f d0 97 f8


The other problem is that i'm not sure how to generate a frame check - I have a feeling it's done for me, but I'd like someone who knows to confirm it to me!
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group