Page 1 of 1

ENC28J60 Component Updates

Posted: Mon May 23, 2016 12:17 am
by cruzxia
I have two requests for this component. Is it possible to modify the Initialize to include setting the IP and MAC addresses.
That way I can make them software selectable. I need to allow them to be set in software, because if you have two or more systems on one network, different addresses are required currently requiring a recompile each time.

I have added a CheckForARPReply function, this is needed if you use MakeARPRequest. You could include this in the revised component. See below.

Parameters are - LENGTH
Returns 1 for successful ARP reply
Use - GetSendersMAC address from local network hosts. E.g modem/gateway so you can send email.

Code: Select all

{
    //Local variable definitions
    MX_UINT8 FCR_RETVAL;


    FCR_RETVAL = 0;

    if (FCL_LENGTH < 60)
    {

        goto FCC_CheckForARP_R;

    // } else {

    }

    if (FCV_0f5c1_TCPIP_ENC28J60__BUFFER[12] != 0x08 || FCV_0f5c1_TCPIP_ENC28J60__BUFFER[13] != 0x06) //Test for ARP
    {

        goto FCC_CheckForARP_R;

    // } else {

    }
    if (FCV_0f5c1_TCPIP_ENC28J60__BUFFER[21] != 0x02)  //Test for ARP Reply code 2
    {

        goto FCC_CheckForARP_R;

    // } else {

    }

    if (FCV_0f5c1_TCPIP_ENC28J60__BUFFER[0x26] != 192)
    {

        goto FCC_CheckForARP_R;

    // } else {

    }

    if (FCV_0f5c1_TCPIP_ENC28J60__BUFFER[0x27] != 168)
    {

        goto FCC_CheckForARP_R;

    // } else {

    }

    if (FCV_0f5c1_TCPIP_ENC28J60__BUFFER[0x28] != 1)
    {

        goto FCC_CheckForARP_R;

    // } else {

    }

    if (FCV_0f5c1_TCPIP_ENC28J60__BUFFER[0x29] != 90)
    {

        goto FCC_CheckForARP_R;

    // } else {

    }

    FCR_RETVAL = 1;

FCC_CheckForARP_R:
;

    return (FCR_RETVAL);

}

Cruzxia

Re: ENC28J60 Component Updates

Posted: Thu May 26, 2016 11:54 am
by Benj
Hello,

There is already a CheckForARP function which checks for an ARP at the local IP address. Is this not doing what you need?

I can add variables to hold the local MAC and IP addresses and make them variable but this will increase overall RAM usage.

The attached function has your specified code in the CheckForARPReply function and the variable MAC and IP.
TCPIP_ENC28J60.fcpx
(13.32 KiB) Downloaded 394 times

Re: ENC28J60 Component Updates

Posted: Thu May 26, 2016 1:37 pm
by cruzxia
Benj

The CheckForARP function is for incoming requests to give out the MAC address of the ENC28j60 server.
The CheckForARPReply function is used after the ENC28j60 server has sent a MakeArpRequest to the local Modem/gateway, so that I can get its MAC address.
You need the local Modem/gateway MAC address in order to send out emails.

The small amount of extra ram is not an issue.

I have loaded the new component and everything is working as expected. I will fully test it tomorrow and let you know if there are any issues.

Thanks
Cruzxia :D

Re: ENC28J60 Component Updates

Posted: Sun Jun 26, 2016 1:38 pm
by Rudi
Benj wrote:Hello,

There is already a CheckForARP function which checks for an ARP at the local IP address. Is this not doing what you need?

I can add variables to hold the local MAC and IP addresses and make them variable but this will increase overall RAM usage.

The attached function has your specified code in the CheckForARPReply function and the variable MAC and IP.
TCPIP_ENC28J60.fcpx

hi benj
txs for the update!
only a question, because i do not know, how is this handle officially with released versions / update versions:

if a component is given in the FC version ( example 6.1.3.2 from 18 Feb 2016 ) like the TCP_ENC28J60.fcpx ( Release V 1.0 )
and we read in threads ( works on this / updates on this ) and the Revision is the same ( Release V 1.0 )
releaseV.png
how we can difference in projects, are there difference in the component?

Is this component a replace for the 6.1.3.2 ? does it must not named then as difference Revision like 1.1.. ?
( only a question benj - i do not know this - same if i made a own component - and do updates on this - so i ask )

thank you for the update!
i have downloaded it, but have seen the same revision so i have thinked , that is the same like in 6.1.3.2
and the user has not update FC itself to 6.1.3.2

you have done nice updates to this :)
txs!!!

best wishes
rudi ;-)