Hi,
I would like to see datalink layer access functions,
much like UDP.
For example, the UDP called library function
sub function Net_Ethernet_28J60_UserUDP(dim udpDsc as ^UDP_28j60_Dsc) as word
could have a simular MAC called library function
sub function Net_Ethernet_28J60_UserMAC(dim macDsc as ^MAC_28j60_Dsc) as word
to handle incomng datalayer packets
And like UDP send function
sub function Net_Ethernet_28j60_sendUDP(dim destIP as ^byte, dim sourcePort as word, dim destPort as word, dim pkt as ^byte, dim pktLen as word) as byte
there would be a MAC send function
sub function Net_Ethernet_28j60_sendMAC(dim destMAC as ^byte, dim sourcePort as word, dim destPort as word, dim pkt as ^byte, dim pktLen as word) as byte
I used the term MAC as the MAC module deals with datalink layer.
The functions are most probably already in the library because the TCP/IP and UDP
are at the network layer which is above the datalink layer.
I would like to see these functions be made public so we can implement datalink layer
protocols like LLDP. LLDP is required for requesting more power from POE+ switches
and currently it is not possible to send packets to a specific MAC address at the datalink
layer. My proposal MAC functions would allow for that.
regards peter
Datalink layer access
-
- Posts: 174
- Joined: 31 Aug 2009 22:44
Re: Datalink layer access
Hi,
Is there a way to retrieve packets received but not handled by the library?
The function doPacket() returns a word value
0 - upon successful packet processing (zero packets received or received packet processed successfully).
1 - upon reception error or receive buffer corruption. ENC28J60 controller needs to be restarted.
2 - received packet was not sent to us (not our IP, nor IP broadcast address).
3 - received IP packet was not IPv4.
4 - received packet was of type unknown to the library.
In case of values 2, 3 and 4
can we retrieve the received packet?
I can imagine that value 2 would be returned for a datalink packet
(eg. packet sent to our mac address).
If possible, how do I retrieve a received packet? Which registers identify
the packet and bufferspace ocupied by that packet?
regards peter
Is there a way to retrieve packets received but not handled by the library?
The function doPacket() returns a word value
0 - upon successful packet processing (zero packets received or received packet processed successfully).
1 - upon reception error or receive buffer corruption. ENC28J60 controller needs to be restarted.
2 - received packet was not sent to us (not our IP, nor IP broadcast address).
3 - received IP packet was not IPv4.
4 - received packet was of type unknown to the library.
In case of values 2, 3 and 4
can we retrieve the received packet?
I can imagine that value 2 would be returned for a datalink packet
(eg. packet sent to our mac address).
If possible, how do I retrieve a received packet? Which registers identify
the packet and bufferspace ocupied by that packet?
regards peter
- dejan.odabasic
- mikroElektronika team
- Posts: 2649
- Joined: 30 Apr 2012 14:20
Re: Datalink layer access
Hello,
In current implementation of Network library it's not possible to retrieve datalink layer packages.
Also, current abstraction level of library doesn't allow easy access to datalink layer.
I will present your suggestions to our developers and they will consider implementing function which will provide access to datalink layer.
Thank you for your suggestions.
Best regards.
In current implementation of Network library it's not possible to retrieve datalink layer packages.
Also, current abstraction level of library doesn't allow easy access to datalink layer.
I will present your suggestions to our developers and they will consider implementing function which will provide access to datalink layer.
Thank you for your suggestions.
Best regards.
-
- Posts: 174
- Joined: 31 Aug 2009 22:44
Re: Datalink layer access
Hi,
The correct way to allow development of more protocols
is to have raw sockets.
Is it possible to have raw sockets, so we can put in a custom protocol type?
Or can I use a UDP socket and then overwrite the protocol type field?
How can I receive raw socket data?
I ask these questions with LLDP in mind.
regards peter
The correct way to allow development of more protocols
is to have raw sockets.
Is it possible to have raw sockets, so we can put in a custom protocol type?
Or can I use a UDP socket and then overwrite the protocol type field?
How can I receive raw socket data?
I ask these questions with LLDP in mind.
regards peter
- dejan.odabasic
- mikroElektronika team
- Posts: 2649
- Joined: 30 Apr 2012 14:20
Re: Datalink layer access
Hello,
I'm afraid that my last answer applies to your new set of questions.
Current implementation of Network library doesn't allow access to "raw data".
Thank you for understanding.
Best regards.
I'm afraid that my last answer applies to your new set of questions.
Current implementation of Network library doesn't allow access to "raw data".
Thank you for understanding.
Best regards.
-
- Posts: 174
- Joined: 31 Aug 2009 22:44
Re: Datalink layer access
Hi,
Is it possible to get a callback function for a new received packet?
sub function Net_Ethernet_28J60_UserRaw(dim socket as Net_Ethernet_28J60_RawSocket) as word
If the function returns 0 than the packet is handled by the above function,
if it returns 0xFFFF than the Ethernet library calls userUDP() or userTCP() function
as it does now.
So any received packet is first offered to the userRAW() function.
It should take very little time to provide such a callback function
and allows us to receive layer 2 packets.
2nd question:
I noticed the subroutine Net_Ethernet_28J60_TxSend(dim l as word)
can be used in my program (so it appears to be public), but it is
not mentioned in the help file. Is there any info an all the subroutines
in the private mbas file?
regards peter
Is it possible to get a callback function for a new received packet?
sub function Net_Ethernet_28J60_UserRaw(dim socket as Net_Ethernet_28J60_RawSocket) as word
If the function returns 0 than the packet is handled by the above function,
if it returns 0xFFFF than the Ethernet library calls userUDP() or userTCP() function
as it does now.
So any received packet is first offered to the userRAW() function.
It should take very little time to provide such a callback function
and allows us to receive layer 2 packets.
2nd question:
I noticed the subroutine Net_Ethernet_28J60_TxSend(dim l as word)
can be used in my program (so it appears to be public), but it is
not mentioned in the help file. Is there any info an all the subroutines
in the private mbas file?
regards peter
- darko.jola
- Posts: 51
- Joined: 03 Aug 2011 16:18
Re: Datalink layer access
Hi,
we can try to implement such function in some of future releases of libraries, thanks for your suggestion. But for now reading raw data is not possible.
About your 2nd question, did you mean "Net_Ethernet_28J60_Txpacket(dim l as word)"? Such function is used by library to send prepared packet over network, and user should not use this function.
Best regards
Darko
we can try to implement such function in some of future releases of libraries, thanks for your suggestion. But for now reading raw data is not possible.
About your 2nd question, did you mean "Net_Ethernet_28J60_Txpacket(dim l as word)"? Such function is used by library to send prepared packet over network, and user should not use this function.
Best regards
Darko
Re: Datalink layer access
Hello, I have implemented a server in ATMEGA1284P but the system (atmega + enc28j60) freezes after some time .
All the time, I got the error code number 2 ( some times number 4) with Function doPackage. I do not what happens!!
Could you help me please?
Thanks so much!!
JMAT
All the time, I got the error code number 2 ( some times number 4) with Function doPackage. I do not what happens!!
Could you help me please?
Thanks so much!!
JMAT
- dejan.odabasic
- mikroElektronika team
- Posts: 2649
- Joined: 30 Apr 2012 14:20
Re: Datalink layer access
Hello,
Have you tried to reset the ENC28J60 after receiving the corrupted packet?
Toggle of RST pin and initialization(Net_Ethernet_28j60_Init) should help you solve the problem.
Error codes are explained in library help file.
For more details, please take a look at ..compiler\Packages\Network_Ethernet_AVR\Help\ folder.
Best regards.
Have you tried to reset the ENC28J60 after receiving the corrupted packet?
Toggle of RST pin and initialization(Net_Ethernet_28j60_Init) should help you solve the problem.
Error codes are explained in library help file.
For more details, please take a look at ..compiler\Packages\Network_Ethernet_AVR\Help\ folder.
Best regards.
Re: Datalink layer access
I will try reset the enc28j60 with the reset pin!
The help file does not help, neither case 2 or 4 say what should done!
Thanks so much
JMAT
The help file does not help, neither case 2 or 4 say what should done!
Thanks so much
JMAT