News:

;) This forum is the property of Proton software developers

Main Menu

Ethernet controller

Started by Colin G3YHV, Jul 15, 2023, 12:46 PM

Previous topic - Next topic

Colin G3YHV

I see that  ENC28J60 Ethernet controller modules are cheaply available.
I have a need to remotely control some radio gear at our local radio club.
There  seem to be lots of code to connect these to arduinos ( yuk )
but I would much prefer a pic chip solution
Has anybody played around with these and produced any code  ?
Regards Colin G3YHV

Mapo

Hi, I have used these "CH9121" on various projects and I found them good
They are managed via serial, and they are fast and cheap

https://it.aliexpress.com/item/32909543824.html?spm=a2g0o.order_list.order_list_main.109.21ef3696YCaRPu&gatewayAdapt=glo2ita

no library to use them

Colin G3YHV

Hi Mapo , thanks for the reply. I have ordered a couple of them to play with .
How do you set them up? do they generate a web page or something like that  ?
Colin

Mapo

Hi Colin,
I used these modules in UDP to transfer data.
I am attaching some information I have collected on these modules, the configuration software provides the TCP Server function, then you have to do some tests

http://www.chinalctech.com/m/view.php?aid=468

Colin G3YHV

Thanks for the information Mapo.
I have also found some useful info and it has better English!
It includes a link to the software for setting it up

https://h-2technik.com/online/webee/ETH-01/H2_ETH-01.pdf
 
looking forward to playing with it when it arrives from China
Colin

okmn


TimB


Slightly of topic but still relevant

UDP is from what I read a broadcast system with no ACK retry etc. This suits me but is there a protocol to what you send eg I have a 56 byte packet of bytes, words, Dwords and floats as the raw bytes being TX'ed every 1 hz

Would I need to format them in some way? Or can just send that to the device and anybody connecting to the address will be able to read get that data stream?

tumbleweed

UDP packets can be sent as a broadcast or to a particular address (unicast). There's no real connection involved.

There's no req'd format to the packet data per say... it can be a jumble of bytes if you wish. That's up to you.
There's only a format to the data if you're using one of the existing defined protocols.

With UDP, if the data gets there, fine. If it doesn't, well that's fine too.

JonW

#8
Tim it normally doesn't care in UDP, what's in the buffer in that particular sequence is transmitted straight out to an IP address, you can also broadcast with some devices so everything gets it.  You need to set up the device IP address, subnet mask etc and off you go.  I used the W5500 IC's and a 27k42 and got UDP running well, sending and receiving any packet length.  I did start to look into TCP, but UDP was good for my requirements, I just need some time to finish off the TCP version.  You can also get modules similar to the WCH ones, the Wiznet IC's are much easier to get hold of and cheaper.  I started with a module and then progressed with my schematics and design.  With the W5500 devices, you have a ring buffer that you fill and empty and just need to load it or read it and move the pointers.  It can even interrupt on reception etc.  Xojo can also do UDP easily if you want to build a PC app. 

You'll need a good PC-based packet-handling program to get going.  I used Packetsender, it's also free and a breeze to use.

UDP datagram is 8byte header + Data where 8 byte header is {Source Port [0.15]:Destination Port[0:15]:Length of Data[0:15]:Checksum[0:15]}:DATA[0:7]:DATA[0:7] etc

It wasn't easy bringing this chip up as the documentation isn't the best, but I managed to construct a library with fairly simple procs to do UDP with a couple of proc calls.  In my use case I reuse the serial buffer ram so I can keep the same "Parsing" routine for the received data,  once a packet is in the UDP buffer, I strip the header, process some of the incoming IP Info and copy the data bytes into the Serial buffer, flag a message in the buffer and then check the message as serial or UDP

Example of the Proc calls for setup, running code and a TX write, in my case, I am in RX mode waiting for a process command. 

I would post the library but it's not tidy enough as it's still work in progress.  :-[   :-[

Load common reg configures the sockets and IP info.

I then check if the port is opened or ready for connection so a live plug in is detected.  Its continuously monitored so it can close the port if the cable is pulled etc
RX is int driven and copies the Wiz socket buffer etc. 
Demo of the TX datagram Proc for a known IP address and socket, once a successful connection is made with a received datagram, the Wiz device has the IP info for return data, ( so my Xojo Gui pings a request for Ack so the Wiz gets the IP info for replies).  Other Procs can reply once a RX packet is received as they know the source IP address and socket. 

I am a newbie on this side of the force!

Edited my IP addresses in the snippet







TimB


Thanks JonW

I'm going to invest some time soon to see if I can get this running. If my the main purpose of my project works I would like to drop the idea of RS Coms and move to eithernet.

My board has
4 x DAC 0-5v out For chart recorders
2 Alarms active Low
2 Inputs active low
128 x 64 GLCD for in panel setup / monitoring
2 x 16 lcd for simple panel door status indication

Adding Ethernet will open up a whole host of remote access monitoring etc

My main issue now is that the main use of my product is not proven so while I needed the front end on the device to understand how it is operating I should stop now until I'm sue its worth the effort.

Also I doubt people like propitiatory protocols so may have to implement something like Modbus with regs so others will not need a custom parser.