Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

ENC28J60 and Bascom-AVR working!!
Goto page 1, 2  Next
 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    www.mcselec.com Forum Index -> BASCOM-AVR Archive
View previous topic :: View next topic  
Author Message
bzijlstra

Bascom Ambassador



Joined: 30 Dec 2004
Posts: 1179
Location: Tilburg - Netherlands

netherlands.gif
PostPosted: Sun Jun 17, 2007 1:35 pm    Post subject: ENC28J60 and Bascom-AVR working!! Reply with quote

Got it running, an Atmega168 and the ENC28J60 ethernetcontroller. With some very nice routines. For pictures, check my weblog at http://benshobbycorner.nl

Bascom-AVR is GREAT!!

Have fun
Ben Zijlstra
Back to top
View user's profile Visit poster's website
Evert :-)

Bascom Expert



Joined: 18 Feb 2005
Posts: 2165

netherlands.gif
PostPosted: Sun Jun 17, 2007 2:01 pm    Post subject: Reply with quote

Very nice Ben ! Good job Wink
Now we can add cheap and very compact (hardware) Tcp/ip to our projects.

Evert
Back to top
View user's profile Visit poster's website
DToolan

Bascom Member



Joined: 14 Aug 2004
Posts: 1384
Location: Dallas / Fort Worth, Texas (USA)

blank.gif
PostPosted: Sun Jun 17, 2007 8:44 pm    Post subject: Reply with quote

Ben,

Just to let you know, i've been working with the ETHERNUT 1.3 (10mbps) Rev H board and adapting your Bascom WebTiger code to it. Your work there has been very helpful.

I also have an ETHERNUT 2.1 (10 / 100 mbps) Rev B board which i plan to adapt next.

Thank you for your wonderful guides.
Back to top
View user's profile Yahoo Messenger
bzijlstra

Bascom Ambassador



Joined: 30 Dec 2004
Posts: 1179
Location: Tilburg - Netherlands

netherlands.gif
PostPosted: Mon Jun 18, 2007 12:21 am    Post subject: Tutorial soon Reply with quote

Thanks for the compliments. Got still some work to do but there will be a tutorial on the Bascom-AVR code for the ENC28J60 soon. There are some very neat tricks to drive this chip and the total code for the main subroutines don't take more than 5 Kbyte of flash.

Have fun
Ben Zijlstra
Back to top
View user's profile Visit poster's website
bzijlstra

Bascom Ambassador



Joined: 30 Dec 2004
Posts: 1179
Location: Tilburg - Netherlands

netherlands.gif
PostPosted: Tue Jun 19, 2007 2:48 pm    Post subject: Small tutorial Reply with quote

You can find the start of a small tutorial about Bascom-AVR and ENC28J60 on my homepage.

Have fun
Ben Zijlstra
Back to top
View user's profile Visit poster's website
i.dobson

Bascom Expert



Joined: 05 Jan 2006
Posts: 1571
Location: Basel, Switzerland

switzerland.gif
PostPosted: Thu Jun 21, 2007 6:49 am    Post subject: Reply with quote

Hi,

Nice one Ben. I saw the board on the tuxgraphics site and started thinking about having a go at getting it working in bascom but asalways you beat me too it.

You say on your site that the core routines use about 5Kb flash. Is that just for communication or do you already support "higher level protocols" ie UDP,ARP and TCP/IP in this figure?

It would make are really nice addition to my AVR home network. As at the moment I'm using the NE2000 lib and writing "server applications" that handle the UDP data communication. Going over to TCP/IP and HTTP would make things much simpler (Just use CGI with get/post to get/send data).

Regards
Ian Dobson

_________________
Walking on water and writing software to specification is easy if they're frozen.
Back to top
View user's profile
bzijlstra

Bascom Ambassador



Joined: 30 Dec 2004
Posts: 1179
Location: Tilburg - Netherlands

netherlands.gif
PostPosted: Fri Jun 22, 2007 8:14 am    Post subject: higher level protocols Reply with quote

More to come. In the tutorial up to this point just sending a single packet of 60 bytes on the ethernet, just to show that SPI-communication with the ENC28J60 is working and that we are able to send something on the line.

There are two more subroutines before the base-routines are finished.
enc28j60readbuffer
enc28j60packetreceive

When I compile the code, including these two subroutines, a.k.a. the base-routines, I have 6238 bytes in use. When finished (and taking more than the 6238 bytes) you get an array with the complete ethernetpacket in it. Just like the code I have written for the RTL8019as.

I am planning to take all summer to finish the tutorial.

Have fun
Ben Zijlstra

BTW Have a look at the Etherrape from www.lochraster.org. Quality of the bare-board is very good. And that just for 12 euro....
Back to top
View user's profile Visit poster's website
lpa

Bascom Member



Joined: 12 Dec 2006
Posts: 27
Location: Oreokastro, Greece

greece.gif
PostPosted: Fri Jun 22, 2007 9:58 am    Post subject: Reply with quote

Very nice and very useful work !!

I shall follow your work at your web site all summer long.

By the way, I like your web site's style.

Thank you.
Back to top
View user's profile Visit poster's website
deeexit

Bascom Member



Joined: 08 May 2007
Posts: 7

slovenia.gif
PostPosted: Wed Aug 22, 2007 5:10 pm    Post subject: Reply with quote

Hi Ben and all others Smile

I've been looking at the enc28j60 bascom code and I like it very much. Can't wait for higher level protocols to be implemented Smile Very good work indeed! Bravo Smile
Back to top
View user's profile
bzijlstra

Bascom Ambassador



Joined: 30 Dec 2004
Posts: 1179
Location: Tilburg - Netherlands

netherlands.gif
PostPosted: Wed Aug 22, 2007 8:08 pm    Post subject: Kids back to school..... Reply with quote

Thanks!!

Now the kids are back to school and looking back on a very nice holiday in Greece, I will continue the work on the tutorial.

Have fun
Ben Zijlstra
Back to top
View user's profile Visit poster's website
bzijlstra

Bascom Ambassador



Joined: 30 Dec 2004
Posts: 1179
Location: Tilburg - Netherlands

netherlands.gif
PostPosted: Mon Aug 27, 2007 9:49 am    Post subject: ARP, PING and Viktor.... Reply with quote

We got some help from Viktor Varga from Hungary. He has written the ARP and PING routines for the ENC28J60. Working very well. He has some doubts about the Broadcast filtering. Have to check that.

Thanks Viktor!!!
Ben Zijlstra
Back to top
View user's profile Visit poster's website
bzijlstra

Bascom Ambassador



Joined: 30 Dec 2004
Posts: 1179
Location: Tilburg - Netherlands

netherlands.gif
PostPosted: Sat Sep 08, 2007 9:47 am    Post subject: UDP ready... Reply with quote

Bascom-AVR UDP-code ready for the ENC28J60.

It is a very powerfull device the ENC28J60. Especially the filtering is very nice, only the ethernettraffic with its destination for this Tuxgraphics-board has to be handled by the Atmega168.

Still something to check in the broadcast-filtering but the first UDP-application is working very well.



Have fun
Ben Zijlstra
Back to top
View user's profile Visit poster's website
lpa

Bascom Member



Joined: 12 Dec 2006
Posts: 27
Location: Oreokastro, Greece

greece.gif
PostPosted: Mon Sep 10, 2007 1:12 pm    Post subject: Reply with quote

Than you Ben Zijlstra.
Back to top
View user's profile Visit poster's website
rdagger

Bascom Member



Joined: 27 Feb 2006
Posts: 68

comoros.gif
PostPosted: Mon Sep 24, 2007 11:01 pm    Post subject: Reply with quote

Thanks for the great contribution to the AVR community.
Back to top
View user's profile Visit poster's website
rdagger

Bascom Member



Joined: 27 Feb 2006
Posts: 68

comoros.gif
PostPosted: Tue Sep 25, 2007 8:49 pm    Post subject: Reply with quote

I created a WOL sub for Ben's great code. It enables you to turn on a computer over ethernet from an AVR.

Here is the code:
Code:
Sub Wol
'MAC-header
'Destination hardware address
T_enetpacketdest0 = Myroutermac(1)
T_enetpacketdest1 = Myroutermac(2)
T_enetpacketdest2 = Myroutermac(3)
T_enetpacketdest3 = Myroutermac(4)
T_enetpacketdest4 = Myroutermac(5)
T_enetpacketdest5 = Myroutermac(6)
' source (own source)
T_enetpacketsrc0 = Mymac(1)
T_enetpacketsrc1 = Mymac(2)
T_enetpacketsrc2 = Mymac(3)
T_enetpacketsrc3 = Mymac(4)
T_enetpacketsrc4 = Mymac(5)
T_enetpacketsrc5 = Mymac(6)
T_enetpackettype = &H0008                                  
' fill IP-header
T_ip_vers_len = &H45
T_tos = &H00
T_ip_pktlen0 = &H00
T_ip_pktlen1 = &H30
T_id0 = &H4A
T_id1 = &HA5
T_flags = &H00
T_offset = &H00
T_ttl = &H80
'protocol (ICMP=1, TCP=6, UDP=11)
T_ip_proto = &H11
'header checksum
'IP address of source
T_ip_srcaddr0 = Myip(1)
T_ip_srcaddr1 = Myip(2)
T_ip_srcaddr2 = Myip(3)
T_ip_srcaddr3 = Myip(4)
'IP address of destination                                   'broadcast IP
T_ip_destaddr0 = &HFF
T_ip_destaddr1 = &HFF
T_ip_destaddr2 = &HFF
T_ip_destaddr3 = &HFF

'UDP-header
T_udp_srcport0 = &H13
T_udp_srcport1 = &H88
T_udp_destport0 = &H9C                                      'port 40000
T_udp_destport1 = &H40
T_udp_len0 = &H00
T_udp_len1 = &H6E

T_udp_data = &HFF                                           'WOL 6-byte trailer
T_udp_data1 = &HFF
T_udp_data2 = &HFF
T_udp_data3 = &HFF
T_udp_data4 = &HFF
T_udp_data5 = &HFF
                                                            'WOL magic packet = MAC address 16x
Dim Buf_counter As Byte                                     'Next UDP data (T_udp_data6) is buffer 49
Dim Mac_counter As Byte
Mac_counter = 1
For Buf_counter = 49 To 144
   Buffer(buf_counter) = Wake_mac(mac_counter)              'MAC Address of computer to wake (6 byte array)
   Incr Mac_counter
   If Mac_counter > 6 Then
      Mac_counter = 1
   End If
Next Buf_counter


Call Ip_header_checksum
Call Udp_checksum
Call Echopacket
End Sub
Back to top
View user's profile Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    www.mcselec.com Forum Index -> BASCOM-AVR Archive All times are GMT + 1 Hour
Goto page 1, 2  Next
Page 1 of 2

 
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
You cannot attach files in this forum
You cannot download files in this forum