Shop OBEX P1 Docs P2 Docs Learn Events
Recommendation for Prop to Ethernet Interface? — Parallax Forums

Recommendation for Prop to Ethernet Interface?

ManAtWorkManAtWork Posts: 2,176
edited 2012-10-09 23:24 in Propeller 1
Hi,

I'm searching for an easy way to interface a propeller to ethernet. I don't need any complicated stuff like HTML server or DHCP. I only need a serial stream of bytes to replace the current serial communication using RS232 or VCP via FTDI chip. For reliability (automatic retransmit of lost packets) and compatibility reasons a TCP/IP stack would be good but is not absolutely necessary.

I've seen that there are obex projects for the W5100/W5200 and ENC28J60 chips. What are the pros and cons of both solutions? Has anyone experience with any of them and can recommend one? The ENC28J60 is a bit cheaper but has no built in TCP/IP so the propeller software has to be more complex, I think.

Comments

  • blittledblittled Posts: 681
    edited 2012-09-20 05:06
    You can find a link to the Spin code for the ENC28J60 at http://propellerpowered.com/shop/?page_id=513 and a thread describing its use at http://forums.parallax.com/showthread.php?118193-PropTCP-Beta-Now-fully-MIT-Licensed-%28w-AJAX-Enabled-HTTP-Server-Example!%29&highlight=ENC28J60. Also the Spinerette Forum deals with a W5100 chip and Propeller.
  • Mike GMike G Posts: 2,702
    edited 2012-09-20 06:03
    You can find a comprehensive Wiz 5200 library attached to the following post. The library has been well tested with plenty of examples.

    I've been using the WIZ820io. It works great and It's easy to connect.
  • twctwc Posts: 107
    edited 2012-09-20 08:23
    I'm using the Wiz820io too. Mike G. is doing some insanely great work in the Spinnerette forum! It sounds like you just need kind of a serial<->ethernet converter. It would be nice to have TCP/IP handshaking and reliability if you don't want to have the bother in your own code. I'm pretty sure there's a software TCP/IP stack floating around, probably takes a fair bit of memory and a COG or two. I personally think Wiznet is the way to go for anything less than a 'computer' running an 'OS' with full network stack (ex: Linux, RTOS). What you want to do would be super-easy; OPEN cmd, CONN cmd, put data in txbuffer, SEND cmd. Don't need to use any Prop RAM for buffers and spare txbuffer can be used as SPI RAM, handy in a pinch.
  • rwgast_logicdesignrwgast_logicdesign Posts: 1,464
    edited 2012-09-20 14:26
    microchip.com will give u samples of the ENC28J60 for free. there very easy to sample from chips arrive 3 days later. i belive this chip is ethernet to serial althouh a little harder to work with than the wiz i think as far as writing your own driver but there are obex objects to deal with that for you.

    the reference design is some .1 uf caps and aan rj45 adapter pretty basic to build. the enc is very popular the arduino ethernet sheild uses it so you will be able to take your reference design to any mcu and there should be drivers.

    www.propellerpowered.com has an encj reference board for 9 bucks if u dont wanna hassle with samples and soldeiring irons
  • localrogerlocalroger Posts: 3,451
    edited 2012-09-20 16:06
    microchip.com will give u samples of the ENC28J60 for free...i belive this chip is ethernet to serial althouh a little harder to work with than the wiz

    The ENC28J60 is SPI but it's not "serial to ethernet" because it doesn't implement TCP; it's strictly an ethernet hardware layer device and you have to do your own software TCP stack. As blittled mentions this has been done and the code is out there, but it takes a pretty hefty chunk of Hub RAM for the code. The WizNet products implement the TCP stack so there's very little code on the Prop other than requesting or accepting connection on a port and sending and receiving serial data.

    In addition to the ENC28J60 chip itself you need the jack and a few passives. There are numerous breakout boards available, including this cute li'l guy from Sparkfun: https://www.sparkfun.com/products/765? I like the ENC28J60 myself because you can get down and dirty with the protocol; if the WizNet doesn't do quite what you want there's not much you can do about that. But if you wanted to, for example, implement a SD card file system in the same application as the Ethernet TCP stack you wouldn't have much room left for other functions.
  • rwgast_logicdesignrwgast_logicdesign Posts: 1,464
    edited 2012-09-20 17:35
    so the microchip part cant be used for simple tcp to serial? i figured since you had to write a stack this would be very posible and easier than a full tcp stack, or is it that theres just no obex code to do ethernet to serial for the enc yet?

    that sparkfun board is sure nicce but why not supoort our forum memmbers for soooo much cheaper!

    http://propellerpowered.com/shop/?page_id=513

    like i said the enc is a little more work takes more prop space but u can sample it or buy a board for 9 bucks if you hate it try the more exspensive solutions.
  • ManAtWorkManAtWork Posts: 2,176
    edited 2012-09-21 02:17
    Many thanks to everybody responding. I have to look a bit at the available example code, first. But I already have the impression that the W5x00 is the preferable solution. I don't care about a few $ for eval hardware and samples. SMD soldering is also no problem. But if it works I have to make 1000 units a year. So if the 28J60 is $1 cheaper it would save me $1000 a year but I doubt I could write my own TCP stack for $1000. And even if there's code out there already working I'm afraid of spending much time on figuring out how and extracting the right parts for my project. And I also have not much hub ram left over. Another benefit of the W5200 would be that it supports 100Mbit which is not an issue for the current project but might be for future ones.
  • localrogerlocalroger Posts: 3,451
    edited 2012-09-21 15:48
    100baseT is not an issue because there's no way you will ever supply enough data to max out a 10baseT data from a P1, but if you're running short of Hub RAM the Wiznet will definitely save you 5 or 6K. It's really not too hard to use the software stack harrison wrote; you could look up IIRC "api-telnet-serial," once you get the port connected it's pretty much like using the serial objects. He might have even put it in the obex, I know he finally MIT licensed it because it was at the core of Thumper, his award winning entry to the Parallax project contest.
  • Heater.Heater. Posts: 21,230
    edited 2012-09-21 16:30
    I have no idea how much the solutions posted here might cost but one very cheap option is to use a RasperiPi board as your ethernet interface to the world. A simple serial connection from Prop to a full up Linux system.

    Yeah, yeah, I know a lot of people are fed up with hearing about Raspberry Pi, but it's cheap and it works. Unless you have a constraint on size it seems fine.
  • prof_brainoprof_braino Posts: 4,313
    edited 2012-09-21 17:06
    +1 RPi & prop.

    Go lang on the RPi and propforth on the prop is my fav. The prop thinks it has 9 cores and OS services, and the Pi thinks it has lots of deterministic software configurable peripherals. Sort of. Of course its all bleeding edge and none of the tutorials and demos are set up yet, but someone of your ability doesn't need those anyway. :)
  • ManAtWorkManAtWork Posts: 2,176
    edited 2012-09-22 03:25
    localroger wrote: »
    100baseT is not an issue because there's no way you will ever supply enough data to max out a 10baseT data from a P1

    Not with a single Prop over SPI, of course. But in some cases I might have more than one connected to the same ethernet and also an IP camera consuming a lot of bandwidth. Please forgive me for my ignorance but isn't it the same with ethernet and USB that a single low speed device can slow down all other devices connected to the same hub? Or will an ethernet switch translate the 10Mbit packets to 100Mbit and interleave them with other data on the common line to the PC?
    It's really not too hard to use the software stack harrison wrote; you could look up IIRC "api-telnet-serial," once you get the port connected it's pretty much like using the serial objects. He might have even put it in the obex, I know he finally MIT licensed it because it was at the core of Thumper, his award winning entry to the Parallax project contest.

    Thanks for the hint. I will try it out if I have enough time and hub ram left over.

    Heater and prof_braino, yes I know, the raspberry seems to be an intersting thing to play with, but it's definitely too expensive, too big and too power hungry. With a prop, wiznet chip, RJ45 jack, voltage regulator, PCB and some passives I plan to stay below $15 per unit, 2"² of PCB area and 1W power consumption.
  • ManAtWorkManAtWork Posts: 2,176
    edited 2012-09-22 03:42
    Ok, I did some homework and looked it up at wiki. Ethernet switches with inhomogenous port speeds are supposed to do store-and-forward transmission instead of cut-through. So packets from a 10Mbit segment are translated to 100Mbit and can be interleaved with other high-speed data over the same line without waste of bandwidth. This means, there is indeed no need for a 100Mbit PHY on the propeller side.

    I must admit it's a shame how little I know about thing I use every day. Long time ago when I was at the university, ethernet had no switches at all but a single coax cable backbone...
  • localrogerlocalroger Posts: 3,451
    edited 2012-09-22 12:45
    I see you beat me to the answer MAW -- your concern about slow devices slowing everything down would have been valid in the bad old days when it was hubs instead of switches, but hubs are so 1992 with switches costing $30 at Best Buy. 10baseT has some other advantages; it really only uses 2 pairs, and those can be cat 3 ordinary phone line instead of cat 5. Yeah, it was designed to transport over ordinary telephone wire. It's also very forgiving if you have to make an ugly splice or fold in the wire.

    The WizNet isn't much more expensive than the ENC28J60 -- I think Parallax was a bit surprised to find this out, and it solved an integration problem for them to adopt it for their Prop-Eth solution. I still tend to favor the ENC28J60 mainly because of the control you can take. All of these small stacks exist at the bleeding edge of what TCP/IP permits; they tend not to re-order packets that arrive outof sequence, depending instead on re-requesting out of order packets as if they went missing, and some networks don't like that. Harrison did some big-time tuning of his own stack for Thumper.to smoothly play and record music, and with the WizNet you're kind of stuck with the decisions they made on that level. If it works it's really easy to use, but if it doesn't there's not much you can do about it. With the ENC28J60, you can roll your own protocol if you want.
  • ManAtWorkManAtWork Posts: 2,176
    edited 2012-09-23 23:36
    Thanks, roger, this is really useful information. I'm going to write and test the rest of my application, first, using a standard serial/USB line. If everything works and I see that I have enough ram space left over for a software stack I'll give it a try.
  • ManAtWorkManAtWork Posts: 2,176
    edited 2012-09-24 01:55
    I just looked at the data sheets. Another drawback of the W5100 is that it has a really nasty LQFP package with 0.4mm pitch. That is beyond of what I can reliably do with my P&P machine. The W5200 has a QFN package with 0.5mm pitch, a little better. The ENC28J60 has a SSOP with 0.65mm pitch, much more relaxed, and is also available in SO package with 1.27mm pitch, even suitable for hand soldering.
  • twctwc Posts: 107
    edited 2012-09-24 05:51
    If packaging is a challenge you could use Wiz820io = W5200 + Magjack on small PCB with 0.1" pins. Also, if for some reason you want to bypass TCP/IP logic there's a 'RAW' mode that turns one of the sockets into a plain ethernet transceiver.
  • rosco_pcrosco_pc Posts: 464
    edited 2012-09-25 05:46
    Heater. wrote: »
    I have no idea how much the solutions posted here might cost but one very cheap option is to use a RasperiPi board as your ethernet interface to the world. A simple serial connection from Prop to a full up Linux system.

    Another option (cheaper, around $12 in China, and only consuming 0.5W with WIFI or 0.4W without) would be to use a TP-link wr703N with openwrt (http://wiki.openwrt.org/toh/tp-link/tl-wr703n) and socat (http://gertverdemme.nl/howto/arduino_serial_over_tcp_openwrt, even works directly with the serial port on teh 703 :) ) This gives you ethernet and wifi :D
  • prof_brainoprof_braino Posts: 4,313
    edited 2012-09-25 18:18
    rosco_pc wrote: »
    Another option (cheaper, around $12 in China use a TP-link wr703N with openwrt This gives you ethernet and wifi :D
    Totally cool. I've been meaning to play with that. Please post your progress.
  • rosco_pcrosco_pc Posts: 464
    edited 2012-09-26 00:08
    Totally cool. I've been meaning to play with that. Please post your progress.

    I'll be in China in 2 weeks and have ordered another 4 of them (they are about 50% more expensive here in Taiwan). The two I have here are doing AP duty at the moment and I don't think my kids will like it when I remove them ;)
    Can not promise quick reply though as my new job involves strange working hours and a lot of coding (which is making me a bit less eager to play at home).
  • ManAtWorkManAtWork Posts: 2,176
    edited 2012-10-05 09:52
    I just started to look at the Thumper code. Great work! But... could it be that the ENC28J60 and W5200 both do not have a MAC address rom?:frown: The ENC424J600 has one. I definitely must support multiple devices in one network so a static fake MAC address is no solution. Seems that I either have to buy mac addresses or write a driver for the ENC424.
  • localrogerlocalroger Posts: 3,451
    edited 2012-10-05 14:25
    ManAtWork, that's definitely a problem for most low-end Eth hardware. At one point I had my corporate masters convinced that it would make sense for us to buy a block of MAC addresses (our stuff goes on corporate networks so it would have to be 100% legit) and offer the many spares we'd never need for sale to hobbyists, but that project got deferred to the great if and when I solve the problem (which I only get to work on between work for actual now-paying customers) of getting larger applications supported for the type of work I want to do.

    Maybe we should hint to Parallax that low-quantity valid MAC addresses might be a product worth offering. How cool would it be to have Parallax come up as the vendor of your Eth hardware?
  • mindrobotsmindrobots Posts: 6,506
    edited 2012-10-05 14:48
    Do you have an old Ethernet card, router, cable modem, etc. ? Use those. Are you on your home network or is this going on a corporate network? If it's your network, you can make them up and as long as you're unique on your network, it doesn't matter. Once you leave your network (or any local network segment) the MAC address is irrelevant and unused.
  • mindrobotsmindrobots Posts: 6,506
    edited 2012-10-05 14:57
    It appears that the iEEE has set aside AC-DE-48 as a private MAC address block like the private IP networks. So, you can start with those three upper bytes and then append 00-00-01 and go from there. Hope you don't run out!!

    It also looks like there is a range set aside for XEN for virtualization purposes.
  • ManAtWorkManAtWork Posts: 2,176
    edited 2012-10-06 09:06
    Hi Roger and Rick,

    I don't know what can be considered low or high volume. I plan to sell 1000+ a year. It will run in industrial environment and I can't forsee what else will be connected to the network, so it would be best if it's compliant to the rules.

    I searched the internet a bit. I'm a bit scared buying MAC addresses directly from the IEEE. Although it might be not as expensive as expected I don't like bureaucracy. There are MAC address ROMs available from microchip like the 24AA02E48T for example. They don't cost much, around $0.20 for quantities >100. So a combination of the ENC28J60 and 24AA02E48T would still be cheaper than the Wiznet chip. The big advantage is that I don't need to change the spin code for every unit I program. The P&P machine can do the job. And I could use the unique number as a license key (dongle) for my PC software. It's easy to hack for the clever programmer so it's no real copy protection but at least a "childlock". Unfortunatelly, the 24AA02E48T has only 8kbit of EEPROM space, not enough for the propeller code, so I still need the 24C256.
  • ManAtWorkManAtWork Posts: 2,176
    edited 2012-10-06 09:37
    Price comparison*:
    ENC28J60: $2.32
    24AA02E48: $0.20
    ENC624J600: $3.22
    W5200: $4.34

    So the ENC28J60+24AA02E48 combination offers the lowest price. It's even lower than that of the FTDI USB chip (without magjack). The TCP/IP stack of the Thumper internet radio seems to be well documented and tested. It is said that it is very robust against lost packages and other network problems. The chip packages (SSOP28 and SOT23-5) have small size but are still well solderable (0.65mm pitch). Speed (10 vs. 100Mbit) is no issue. So I think the decision is clear, finally.

    (* 100+ pieces, source: microchip direct, mouser)
  • localrogerlocalroger Posts: 3,451
    edited 2012-10-06 13:33
    Yeah, if you're selling it to industry it needs to be compliant. AC-DE-48 isn't going to cut it because you can't be sure nobody else did the same thing. For our project we would be selling far less than 1000 units a year, at least for the first few years, and quickly decided that buying a block from IEEE was the thing to do. It really isn't that expensive when you factor in all the other costs of doing hardware production. Then again I work for a fairly substantial company that is used to doing tax and compliance paperwork so the IEEE held no terrors for my corporate masters.

    I understand hating bureaucracy but to me the process appeared pretty well automated, not so different than buying a high-ticket bit of merchandise online. The MAC address ROMs are a solution obviously, but they turn software into hardware and, since they can't support a Spin image, an extra part. (You could eliminate the extra part by programming your Spin PROMs first, then overflashing with the MAC address in some high area not used by your program or even going to a 24C512, but then you end up with a pile of PROMs that were used to transmit safe MAC addresses to you, which seems ridiculously wasteful.)
  • ManAtWorkManAtWork Posts: 2,176
    edited 2012-10-08 00:18
    I may sound crazy but I rather pay $0.20 per unit or $200 per year than having to write software to increment a number in the hex file and setup a test environment that verifies that the number was correctly prorammed. According to murphy's law everything that can go wrong will go wrong. The 24AA02E48 has a tiny little SOT23 case. It only takes one or two seconds additional assembly time and the software can self-test if it's present and working. So I think it's not worth complicating the programming procedure just to save a little space for the ROM device.

    But many thanks for your help!
  • dMajodMajo Posts: 855
    edited 2012-10-09 14:59
    I was an lantronix costumer, now I have switched to tibbo. I am using their products already 3 years.

    http://tibbo.com/products/?form_filter=yes&wclass_set=out&type%5B%5D=module&type%5B%5D=add-on&class%5B%5D=programmable

    I suggest you the EM500, is enough for your needs. With the optional GA1000 module beside the wired Ethernet you gain also the WiFi. You can use both the connections at the same time. Upgradable and programmable through ethernet, can be used as serial server (ethernet to serial, have virtual COM drivers for windows ad Linux). The development IDE is free, is programmable in basic and you can offload many tasks from the prop. You can use it as a web server also giving thus a nice interface to the prop. You can upgrade the prop firmware with it (some tricks are needed but works through the wired and wireless IF).

    Some features/capabilities: MySQL client, FTP server/client, WEB server/client, SMTP, SNTP, PPPoE, DHCP, DNS, NBNS... WPA/2-PSK ... I2C, SPI, ModbusRTU ... very easy to program

    The only week point was that you can program it freely without any password request7protection over ethernet. But this has been solved.

    If you need more than 8 IOs you can go to EM1206(17), EM1202(32), EM1000(54)
  • ManAtWorkManAtWork Posts: 2,176
    edited 2012-10-09 23:24
    Sorry for being sarcastic, but it's amazing how many of those who reply don't read the thread. $29 for the module only even without Magjack is way overpriced for my application. I planned half the budget for the complete product, including propeller, PCB, magjack, voltage regulator and passives.

    Anyway, it might be interesting to others who read this. If you only need a single or few unit(s) then development time is more important than saving some $, of course.

    BTW, does somebody know a source for cheap magjacks (vertical inlet preferred)? I found some without LEDs for around $2 but the ones with LEDs seem to be at least twice as expensive. I could add discrete LEDs but this would require custom case/panel cutouts.
Sign In or Register to comment.