ENC28J60 Component Updates

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 6.

Moderator: Benj

cruzxia
Posts: 88
Joined: Wed Jan 04, 2006 7:34 am
Been thanked: 8 times
Contact:

ENC28J60 Component Updates

Postby cruzxia » Mon May 23, 2016 12:17 am

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
These users thanked the author cruzxia for the post:
Rudi (Fri Jun 24, 2016 3:34 pm)
Rating: 5%
 

User avatar
Benj
Matrix Staff
Posts: 14786
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4750 times
Been thanked: 4358 times
Contact:

Re: ENC28J60 Component Updates

Postby Benj » Thu May 26, 2016 11:54 am

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 206 times
These users thanked the author Benj for the post:
Rudi (Fri Jun 24, 2016 3:33 pm)
Rating: 5%
 

cruzxia
Posts: 88
Joined: Wed Jan 04, 2006 7:34 am
Been thanked: 8 times
Contact:

Re: ENC28J60 Component Updates

Postby cruzxia » Thu May 26, 2016 1:37 pm

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
These users thanked the author cruzxia for the post:
Benj (Thu May 26, 2016 4:49 pm)
Rating: 5%
 

User avatar
Rudi
Posts: 666
Joined: Mon Feb 10, 2014 4:59 am
Has thanked: 494 times
Been thanked: 188 times

Re: ENC28J60 Component Updates

Postby Rudi » Sun Jun 26, 2016 1:38 pm

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 ;-)