ENC28J60 Ethernet LAN

Please add any feature requests for Flowcode version 6 here

Moderator: Benj

Forum rules
Only feature requests will be considered here. General questions should not be posted in this forum.
Rudi
Posts: 666
Joined: Mon Feb 10, 2014 4:59 am
Has thanked: 493 times
Been thanked: 187 times

Re: ENC28J60 Ethernet LAN

Post by Rudi »

hi
my first step in this was first time wrong too..
hint,
i have made the connection MOSI MISO wrong
after i change ( cross ) the cable - the LED blinked ;-)
;-)
perhabs it helps

best wishes
rudi
;-)

pic18F2550 i will test next times too
( think this weekend )

hyperion007
Posts: 528
Joined: Sat Dec 01, 2012 1:23 pm
Location: Sweden
Has thanked: 49 times
Been thanked: 101 times

Re: ENC28J60 Ethernet LAN

Post by hyperion007 »

It will probably work. I only connected:
Vdd
GND
SI
SO
SCK (I also tried to swith to CLK)
CS

The other pins, will not be used? What about the WOL pin for example?

Thanks.

Rudi
Posts: 666
Joined: Mon Feb 10, 2014 4:59 am
Has thanked: 493 times
Been thanked: 187 times

Re: ENC28J60 Ethernet LAN

Post by Rudi »

hyperion007 wrote:It will probably work. I only connected:
Vdd
GND
SI
SO
SCK (I also tried to swith to CLK)
CS

The other pins, will not be used? What about the WOL pin for example?

Thanks.
i changed to PIC24FJ256GB106
i have set the clock speed in project from ;-) ..140 000 000 to 4 000 000
config3= 0xffff
config2= 0xffbf // .. normally 0x43be but i will post so..
config1= 0x7f7f

cal_spi ( will update oi change in Panel..so i post only status )
Channel : Channel1
MOSI : G.8
MISO: G.7
CLK: G.6
SS: ( unconnected )
Prescale: Fosc/4
Clock Polarity: Idle Low
Clock Phase: Trailing Edge
Sample Point: End

Panel..
SPI Settings
Chip Select: D.8
Channel : Channel1
MOSI : G.8
MISO: G.7
CLK: G.6
Prescale: Fosc/4

connected
MOSI
MISO
CLK
CS
Vdd
GND


Best wishes
rudi
;-)

hyperion007
Posts: 528
Joined: Sat Dec 01, 2012 1:23 pm
Location: Sweden
Has thanked: 49 times
Been thanked: 101 times

Re: ENC28J60 Ethernet LAN

Post by hyperion007 »

Ok, so SCK/SCL (Can't remember what was printed on the module) is not to be used and I should use CLK instead. got it. Will try when I get home. I don't have any 16 Bit MCU that I can try it on so I have to stick with the PIC18F4550

Rudi
Posts: 666
Joined: Mon Feb 10, 2014 4:59 am
Has thanked: 493 times
Been thanked: 187 times

Re: ENC28J60 Ethernet LAN

Post by Rudi »

connected

Code: Select all


MOSI .. G.8     < - SDO
MISO .. G.7     > - SDI
CLK   .. G.6(SCK) - CLK
CS    .. D.8          . CS

Vdd ..
GND ..

MISO (Master In Slave Out) - The Slave line for sending data to the master,
MOSI (Master Out Slave In) - The Master line for sending data to the peripherals,
SCK (Serial Clock) - The clock pulses which synchronize data transmission generated by the master

and one line specific for every device:
SS (Slave Select) - the pin on each device that the master can use to enable and disable specific devices.

if description is SDI ... SDO
the cross:

Master output for Slave Input MOSI <<__SDO
Master Input for Slave Output MISO <<__SDI

or

if description MOSI MOSI and MISO MISO
then
  • Master | Slave
    MOSI .. MOSI
    MISO .. MISO


The SPI bus specifies four logic signals:
* SCLK : Serial Clock (output from master).
* MOSI : Master Output, Slave Input (output from master).
* MISO : Master Input, Slave Output (output from slave).
* SS : Slave Select ([[logic level|active low]], output from master).


Alternative naming conventions are also widely used, and SPI port pin names for particular IC products may differ from those depicted in these illustrations:
* SCLK : SCK, CLK.
* MOSI : SIMO, SDO (for master devices), SDI(for slave devices), DO, DOUT, SI, MTSR.
* MISO : SOMI, SDO (for slave devices ), SDI(for master devices), DI, DIN, SO, MRST.
* SS : nCS, CS, CSB, CSN, nSS, STE, SYNC.

The MOSI/MISO convention requires that, on devices using the alternate names, SDI on the master be connected to SDO on the slave, and vice versa. Chip select polarity is rarely active high, although some notations (such as SS or CS instead of nSS or nCS) suggest otherwise. Slave select is used instead of an addressing concept.

;-)

Code: Select all


CLKOUT               INT

WOL                    SO

SI                       SCK

CS                   RESET

VCC                  GND

Code: Select all

MASTER @  SLAVE
MCU       -   ENC
----------------------
MOSI     -    SI
MISO     -    SO
CS         -    CS
CLK       -    SCK

VCC
GND
best wishes
rudi
;-)

hyperion007
Posts: 528
Joined: Sat Dec 01, 2012 1:23 pm
Location: Sweden
Has thanked: 49 times
Been thanked: 101 times

Re: ENC28J60 Ethernet LAN

Post by hyperion007 »

That's exactly how I connected it as I am familiar with the MOSI MISO terminology. But I'll have another go when I get home.
MASTER__|__SLAVE
MCU | ENC
_________|_______
MOSI | SI
MISO | SO
CS | CS
CLK | SCK


The only thing I thought was a bit confusing was that the ENC28J60 module has one pin labled SCK and one pin labled CLK:
ENC28J60.jpg
ENC28J60.jpg (77.1 KiB) Viewed 31505 times

hyperion007
Posts: 528
Joined: Sat Dec 01, 2012 1:23 pm
Location: Sweden
Has thanked: 49 times
Been thanked: 101 times

Re: ENC28J60 Ethernet LAN

Post by hyperion007 »

Still no luck with this, oh well.

Rudi
Posts: 666
Joined: Mon Feb 10, 2014 4:59 am
Has thanked: 493 times
Been thanked: 187 times

Re: ENC28J60 Ethernet LAN

Post by Rudi »

hyperion007 wrote:Still no luck with this, oh well.
head up, don't give it up.
your compiling is ok?
because i have a short - extrem short try -
to compile for pic18f2550 but do not -
i have not deeper look to find what 's going wrong.
but this is pi pa fax this will found..
..do you can post your flowchart perhabs?
thank you!
best wishes
rudi
;-)

hyperion007
Posts: 528
Joined: Sat Dec 01, 2012 1:23 pm
Location: Sweden
Has thanked: 49 times
Been thanked: 101 times

Re: ENC28J60 Ethernet LAN

Post by hyperion007 »

sure.
It compiles ok
Attachments
ENC28J60_PIC18F4550.fcfx
(118.77 KiB) Downloaded 600 times

Rudi
Posts: 666
Joined: Mon Feb 10, 2014 4:59 am
Has thanked: 493 times
Been thanked: 187 times

Re: ENC28J60 Ethernet LAN

Post by Rudi »

hyperion007 wrote:sure.
It compiles ok
hi thank you,
yes yours compile if i run compile ( pic18F4550 )
after change to PIC18F2550 and change the "E2" to disable icon ( PIC18F2550 no E port )
and try to compile - errorlevel 1 ;-)
but this is not so important now,
will try to find by search at weekend.

you must go on ;-)
my pic24 runs..

ok
i write what i think to try to change

i had a look to the Clock Speed, do you need 40 000 000 or can you try run under 4 000 000 this clk i set up for pic24
is the flashing ok at 40 000 000?

The SPI Settings in Panel is this ok that is Software Mode?
Chipselect A.5
MOSI ( SDO ) A.0
MISO ( SDI ) A.1
CLK A.2
is this your connect with the chip?
can you try a Channel Port?

the cal_spi
can you try to uncheck SS ( is connected to A.5 too ) try a unconnected here.
SS Slave Select

i have make 2 Disable Icon in Main
0-> D3
1-> D3
all two i make Disable

í have make 2 Disable icon in Loop too
scroll a little from top to the "Ping Request"
i have Disable
1-> E2
0-> E2

perhabs this helps
last but not least, controll again the connects between MOSI und MISO ;-)
i have make this wrong in first try ;-) ...

Best wishes
rudi
;-)

hyperion007
Posts: 528
Joined: Sat Dec 01, 2012 1:23 pm
Location: Sweden
Has thanked: 49 times
Been thanked: 101 times

Re: ENC28J60 Ethernet LAN

Post by hyperion007 »

I have tried both hardware channel 1 SPI and software, tried switching MISO/MOSI on both, I have tried CS on other pins than A5 but I thought I would try A5 as well. No difference.

No worries, I can wait for the component. I'm sure it will be more clear to me how it all works then as it is quite confusing as it is right now with remapped pins and SPI pins in a big mess :)

Rudi
Posts: 666
Joined: Mon Feb 10, 2014 4:59 am
Has thanked: 493 times
Been thanked: 187 times

Re: ENC28J60 Ethernet LAN

Post by Rudi »

Pic18F2550
i had disabled the icon D3 and E2..
this was not helped. perhabs a refresh mistake in code ..
after delete this it compile for PIC18F2550 ;-)
i will test later the connection with ENC and will update the info
many txs again!
best wishes
rudi
;-)


edit:
;-) i will wait for the icon for pic18 too ;-) ;-)
the pic18F2550 runs, if ping, then LED is flash but the answere do not come.
but i will go on at weekend this again. perhabs a little shake ;-)
my head is at the wifi modules - hope this will come asap. ;-)

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

Re: ENC28J60 Ethernet LAN

Post by Benj »

Hello,

I've made some progress with the component and generated some examples. Need to do a client example to make it complete so I will try and get this done ASAP.

Note I have not tested these so will likely be testing over the weekend. Fingers crossed it all should work
TCPIP_ENC28J60.fcpx
(11.5 KiB) Downloaded 584 times
Ping.fcfx
(6.84 KiB) Downloaded 548 times
WebserverWithPing.fcfx
(15.26 KiB) Downloaded 560 times
I'll also try and make a web server example that collects data from an SD card as this would be a very nice implementation of an embedded web server and means the micro doesn't have to store any of the HTML data.

The component is still not as clean as I would like but I'm worried about restricting possibilities if I take too much of the complexity away. As long as there are working examples it should be pretty much ok.

For PIC you will need to adjust the Buffer Size property to 255 or less.

I connect up the following pins and leave all the other pins disconnected.

VCC -> 3V3
Reset -> Reset Pin
GND -> GND
SCK -> SPI SCK
SO -> SPI MISO
SI -> SPI MOSI
CS -> SPI CS

To do this cleanly I used a 10-way IDC connector on a modified E-blocks ribbon cable and this allows me to connect the module right onto a port without the need for veroboard etc. I'll post a picture if I get time.

hyperion007
Posts: 528
Joined: Sat Dec 01, 2012 1:23 pm
Location: Sweden
Has thanked: 49 times
Been thanked: 101 times

Re: ENC28J60 Ethernet LAN

Post by hyperion007 »

I have tried the Ping program on my PIC18F4550 but no go. I can't get the two LEDs to show link/activity and I've connected it as per the instructions, tried switching the MISO/MOSI around, nothing. Tried swapping SCK to CLK and all combinations but still nothing.

Am I doing anything wrong in the settings?

Edit: I did try to put a blinking LED in the main loop but no go, so I think it gets stuck at the initialize macro at the top.
Attachments
ENC28J60_PIC18F4550.fcfx
(6.92 KiB) Downloaded 464 times

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

Re: ENC28J60 Ethernet LAN

Post by Benj »

Cheers I'll check it out.

Have you tried using the software mode for the SPI at all?

hyperion007
Posts: 528
Joined: Sat Dec 01, 2012 1:23 pm
Location: Sweden
Has thanked: 49 times
Been thanked: 101 times

Re: ENC28J60 Ethernet LAN

Post by hyperion007 »

yes I tried that too :(

cheers

hyperion007
Posts: 528
Joined: Sat Dec 01, 2012 1:23 pm
Location: Sweden
Has thanked: 49 times
Been thanked: 101 times

Re: ENC28J60 Ethernet LAN

Post by hyperion007 »

Anyone have any luck with this component on an 8 bit PIC?

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

Re: ENC28J60 Ethernet LAN

Post by Benj »

I've rigged up a 8-bit PIC ECIO to the module and I can get the LEDs to flash as expected but then nothing else seems to be working.

I powered the module at 3V3 but the I/O pins are connected directly supplying 5V. According to the datasheet I think this is ok and the flashing LEDs seem to confirm this.

I also tried the dsPIC with a buffer size of 255 and this worked fine so it's not the buffer size that is causing problems.

I will investigate.

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

Re: ENC28J60 Ethernet LAN

Post by Benj »

I'm using software SPI on the ECIO and have managed to get the Ping working and the Webserver partially working by using the component debugger window.

Clicking expose full component tree on the comp debugger. Then selecting the CAL SPI component from the drop down list on the top of the properties window. Finally setting the "Sample Point" property from "End" to "Middle".

I'd be interested to see how hardware SPI is behaving but I'm guessing this is currently causing the hardware lockup you mentioned. Could be that software SPI on an 8-bit PIC is too slow to work reliably for full webserver applications.

hyperion007
Posts: 528
Joined: Sat Dec 01, 2012 1:23 pm
Location: Sweden
Has thanked: 49 times
Been thanked: 101 times

Re: ENC28J60 Ethernet LAN

Post by hyperion007 »

I only used 3.3V for all pins. The pic is using the same power supply as well. I didn't even get the LEDs to light up

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

Re: ENC28J60 Ethernet LAN

Post by Benj »

Here is my program and my connections.
WebserverWithPingECIO.fcfx
(17.22 KiB) Downloaded 544 times
Reset - RB3
CS - RB7
SI - RB6
SO - RB1
SCK - RB2
CLK - Unconnected
NT - Unconnected
WOL - Unconnected
VCC - 3V3
GND - GND

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

Re: ENC28J60 Ethernet LAN

Post by Benj »

Also I just noticed that the standard 18F4550 won't run at 48MHz (12MIPs) at 3V3, the lowest voltage it seems the standard chip will run at all is 4.2V.

Could this be something to do with the issue do you think?

hyperion007
Posts: 528
Joined: Sat Dec 01, 2012 1:23 pm
Location: Sweden
Has thanked: 49 times
Been thanked: 101 times

Re: ENC28J60 Ethernet LAN

Post by hyperion007 »

That's strange odd. I didn't know this and have been running 48Mhz and 3.3V for about a year on all my projects that I usually test out on a few PIC18F4550 standard DIP40 chips :)
I really should try this on some other hardware because I rarely use 5V anymore as most other ICs tend to use 3.3V or lower. I'll try using it on 5V on this PIC and also 3.3V on a PIC18F28K80. Will keep you posted.

claudemir
Posts: 58
Joined: Sat Nov 03, 2012 7:43 am
Has thanked: 12 times
Been thanked: 5 times

Re: ENC28J60 Ethernet LAN

Post by claudemir »

Hello.
After a missing period I went back to work tcc college project.
I want to turn on and off an LED through the internet with android.O my project uses the ip 192.168.1.90 , I used the examples that Rudi put , but can not receive the command from the comparator in the project, the command that I try to send the android for pic ( http://192.168.1.90:81/Led1 On) I see that the command is received by the pic I'm using , I would like some help from more knowledgeable of Flowcode .
Send the flowchart to analizarem where they are wrong. I really want to make it work . :D :D
Attachments
App Of Android.jpg
image android app
(302.17 KiB) Downloaded 1889 times
automation_via_the_Internet.fcfx
flowchart
(16.86 KiB) Downloaded 449 times

Post Reply