Adding ethernet to a PSoC3/5 design

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Hi everyone.

   

A design I am working on just now uses PSoC5 as the main processor.

   

The client would like to add basic ethernet functionality to the system. In other words, they would like to be able to connect to a server socket on the system and have a basic command and control interface. An embedded webserver is NOT required.

   

So, what methods have you all used for adding ethernet functionality to PSoC designs?

   

Should I use something like a PIC18F and connect it to the PSoC with something like I2C?

   

Any other suggestions / ideas?

0 Likes
37 Replies
Anonymous
Not applicable

Hi Kenny,

   

As of now PSoC3/5 does not have an ethernet implementation/component. However it is possible to implement the MDIO(Magement Data Input/Output) protocol using the UDB and Data[ath tool and interface PSoC3 with an ethernet PHY chip. 

   

-Udayan

0 Likes
Anonymous
Not applicable
        I am working on this very issue,of adding ethenet connectivity,but am stuck on SPI communication.. 😞   
0 Likes
Anonymous
Not applicable

 Hi kmmankad,

   

Can you describe what you are trying to do? Can you provide more information. What issue are you facing with SPI.

0 Likes
MiSa_288856
Level 1
Level 1

I found a series of articles describing how to connect an ethernet controller to a PIC like micro. The controller is a Microchip ENC28J60 it's quite simple to connect and to manage trough SPI interface. The article also include the complete code to create a set of C functions to handle proper initialization of MAC, PHY layers (fully managed by ENC28J60) and to manage other layers, ARP, IP and TCP, ICMP. I'm going to adapt it to Cypress PSoC. After this I'll update the article and post an application note. Any help is appreciated of course.

0 Likes
Anonymous
Not applicable

@ michelesantucci : Hows that ethernet project coming along? I finished the hardware layer(basic SPI driver functions) some time back,but havent got around to debug the networking part of the code yet,since I was using an FTK.

0 Likes
Anonymous
Not applicable

Redpine Signals is releasing a PSoC3/5 Wi-Fi Solution soon, if you can connect that way...

   

http://www.redpinesignals.com/cypress/

   

It looks like their reference design includes both SPI and UART interfacing...

   

regards,

   

Tom Moxon

0 Likes
GeVa_264731
Level 3
Level 3
First like received

There examples of porting the uIP tcp/ip stack from Adam Dunkels, to a microcontroller.

   

This was specifically developed run on microcontrollers and to use up very little memory.

   

This code includes Apps such as dhcpc, hello-world, ntpclient, port_app_mapper,resolv, simple-httpd, smtp, telnetd, udpds, webclient, and webserver.

   

http://code.google.com/p/avr-uip/source/browse/trunk/#trunk%2Fdoc

   

or

   

http://code.google.com/p/uhttpd-avr/

   

 

   

These are designed to run on an Atmel AVR micro, but can easily be adapted to run on PSoC 3 or 5.

   

The Stack code can be left as is, and just the driver code needs to be modified for the PSoC SPI, and differences in type definitions and port access.

   

They contain dirvers for the Micrel KSZ8851 or the Microchip ENC28J60 ethernet chips. Both these chips use an SPI interface, and take up very little board space, and only a few IO pins.

0 Likes
HeLi_263931
Level 8
Level 8
100 solutions authored 50 solutions authored 25 solutions authored

You can look here: http://www.cypress.com/?app=forum&rID=64914 for how to connect an ENC28J60 to a PSoC3 - thanks to kmmankad for that!

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

If you want to expand beyond simple connectivity, or multiple ports,

   
   

Micrel has a number of solutions -

   
   

 

   
   

     http://www.micrel.com/page.do?page=product-info/ether_over.jsp    

   
   

 

   
   

Regards, Dana.

0 Likes
MaR_264466
Level 3
Level 3

I am unable to use this project for a PSoC 5 design. Can you advice me on the changes needed for use with PSoC 5? 

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Just an FYI, you should be posting in POSOC 5 forum.

   

 

   

As far as use PSOC 3 design in PSOC 5 device, port it ?

   

 

   

Regards, Dana.

0 Likes
MaR_264466
Level 3
Level 3

Thanks Dana.. this is the first time i will be doing something like changing a PSoC3 code to PSoC 5. Can you help me on how to do it? what all should i watch for? Can you point me to some documentationregarding this? 

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

To change the device the first approach will be to really do the change (under Project -> Device Selector) and watch for messages displayed. I Suppose when switching from PSoC3 to PSoC5 LP (watch the LP!) the only thing you'll have to care for is the Endianess in DMA and some of your own constructs where that might be encountered.

   

 

   

Bob

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

These might help -

   

 

   

www.cypress.com/

   

www.cypress.com/

   

www.cypress.com/

   

 

   

Regards, Dana

0 Likes
MaR_264466
Level 3
Level 3
0 Likes
lock attach
Attachments are accessible only for community members.
MaR_264466
Level 3
Level 3

The crux of the problem was this...

   

There were lots of "unsigned int"  in the code. changed everything to short.

   

One by one things have started to work. still debugging...

0 Likes
MaR_264466
Level 3
Level 3

Finally... ported kmmankad's code to PSoC5 🙂   ( a few days back actually) ... Webserver and UDO are working... Can someone help me with "How to share" the project here so that its useful for somebody else like me? 

0 Likes
MaR_264466
Level 3
Level 3

Finally... ported kmmankad's code to PSoC5 🙂   ( a few days back actually) ... Webserver and UDP are working... Can someone help me with "How to share" the project here so that its useful for somebody else like me? 

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Use "Create Workspace Bundle" function in Creator file menu, and post using attach file at bottom of

   

post window. Chrome apparently has problems, so use IE, Mozilla.

   

 

   

Regards, Dana.

0 Likes
lock attach
Attachments are accessible only for community members.
MaR_264466
Level 3
Level 3

Sorry for the Delay in uploading... Here's the PSoC5 port for Ethernet... UDP and Webserver are ported and tested in CY8CKIT-001 

0 Likes
HeLi_263931
Level 8
Level 8
100 solutions authored 50 solutions authored 25 solutions authored

Thanks a lot for this work!

0 Likes
MaR_264466
Level 3
Level 3

Thanks to kmmankad in fact... he started it all 🙂 

0 Likes
Anonymous
Not applicable

 Here's another spin on the ENC28J60 Ethernet chip for PSoC5.

   

This one is based on the lwip-1.4.1 stack by Adam Dunkels, with thanks to kmmankad for his work on the low level driver.

   

SPI is running at 11MHz connected to an Olimex ENC device. Datasheet says 20MHz max., I haven't been able to push the frequency any higher and my little soft-scope is starting to buckle beyond 10Mhz. Suggestions welcome.

   

Currently the stack is working and has both static and dynamic IP configuration through DHCP.

   

The only tidbit missing in the low level driver is link detect; it's currently hardwired to up.

   

Bonus feature: printf is routed to URT serial component through sys_stub.c

   

 

   

Here's the project link: github.com/lrds/lwip-psoc5

0 Likes
GeVa_264731
Level 3
Level 3
First like received

Has anyone ported Contiki to PSoC 5. It seems uIP and lwip-1.4.1 stack by Adam Dunkels are only now fully supported by having the Contiki OS. 

   

I was able to port uIP to PSoC 5 for use with the Micrel KSZ8851SNL Ethernet Controller.

   

Now I am attempting to port the full Contiki but it is more of a challenge due to the existing porting documentation for Contiki.

0 Likes
Anonymous
Not applicable

That was my ambition too,to port Contiki to the PSoC.I would be glad to work with you on that.Hows the work stand currently? I havent gotten much done in that direction,but I have a general idea.

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Hopefully you have Vargas's email address, as I would posit he may no

   

longer be looking at a 2 month old thread.

   

 

   

Regards, Dana.

0 Likes
lock attach
Attachments are accessible only for community members.
EvPa_264126
Level 7
Level 7
500 replies posted 250 replies posted 100 likes received
        I'm trying to understand how to work with LWIP. Unfortunately I can not quickly read texts in English, so I use other people's projects and friends - programmers. I took as a basis the draft avast link: https://github.com/lrds/lwip-psoc5 I deleted all of the project that I have not yet needed. My friend - programmer help me create an echo-server using xapp1026.pdf http://www.google.fi/url?sa=t&rct=j&q=&esrc=s&frm=1&source=web&cd=1 & Now I'm trying to transfer large amounts of data using the echo-server as an example. The program is attached below, I get the response: tcp_write: too much data (len = 1024> snd_buf = 48) ( i use Hercules Setup Utility and set LWIP_DBG_ON in opt.h) Please tell me the solution or information ho to do it. I hope to find information in a graphical(pictures,diagram e.t.c) This greatly facilitates understanding.   
0 Likes
Anonymous
Not applicable

hi pavloven,

   

I am using your program send.zip and not able to understand this error. "lwip-1.4.1\src\core\ipv4\ip.c:41:22: fatal error: lwip/opt.h: No such file or directory
 #include "lwip/opt.h"" 

   

please help me to solve this. thank you and i am using psoc creator 4

0 Likes
Anonymous
Not applicable

 @pavloven: Sorry for not getting back to you sooner.

   

Looks to me like you're trying to send 1024 bytes but your send buffer is only 48 bytes long.

   

Either enlarge the snd_buf to 1024 or call tcp_write with a length of 48 and stick that into a loop.

   

Either way feel free to mail me directly if you have more questions. I don't come here on a regular schedule 🙂

0 Likes
Anonymous
Not applicable

 @pavloven: There's also the possibility to study the example under "contrib-1.4.1\apps\tcpecho_raw\echo.c".

   

That should serve as a good starting point for you. Good luck!

0 Likes
GeVa_264731
Level 3
Level 3
First like received

 I was able to complete a Product using PSoC 5 and Contiki. http://t3innovation.com/netprowler     

   

I needed to switch dynamically between IPv4 and IPv6 modes, so I eliminated the conditional compiles with #if UIP_CONF_IPV6, and replaced it with a variable which selects between the two at runtime. This involves creating a separate uip_ip6addr_t and uip_ip4addr_t in place of uip_ipaddr_t. Also some connection structures which used uip_ipaddr_t had to be duplicated and renamed as for example uip_conn6 and uip_conn4.

   

One thing I found is that for IPv6 to work properly the Ethernet chip must pass all multicast addresses. This is because in addition to your own MAC address, several multicast MAC address are used for Neighbor Discover Protocol which is built into IPV6.     

   

 

   

Also Contiki calls your Ethernet driver with a null instead of a Mac address, if the address is a Multicast Mac address. Therefore the driver needs to detect this and make up the correct destination mac address which consists of 33:33::00:00:00:00 added with the  lower 4 bytes of the destination IP address.

   

I hope this helps someone else trying to accomplish the same thing.

   

     

0 Likes
brgoc_293481
Level 1
Level 1
First like given Welcome!

Hello to All

   

     I Am Glad to Read hear . But All The Commant is BAsed on the PSOC3/5 .
I have PSOC4 Module . and Try to communicat with Enc26j60 IC  . First I want to just Set the IP To the Entehr IC . and I can Ping to The Module by my local PC IP Which is already Connected In LAN .

   

Then I want to Transfer the Data by The Ethernet to PC By any Protocol like TCP or UDP.

   

So please Help For PSOC4 Code for the Erthernet Module .

   

 

   

Looking for the healthy Relationship

   

Best Regards to all

   

Brijesh Gohel

   

+91 9033344829

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

These might be of assistance (especially the 3'rd link) -

   

 

   

    

   

          

   

http://www.element14.com/community/thread/24880/l/psoc-4-pioneer-kit-community-project031-ethernet-s...

   

 

   

http://www.cypress.com/?app=forum&id=4749&rID=99353

   

 

   

https://hackaday.io/project/2538-Cheap-ENC28J60-%2B-PSoC-4-Connect-Device

   

 

   

Regards, Dana.

0 Likes
GeVa_264731
Level 3
Level 3
First like received

I think it depends on your final result,

   

If you are looking for a low cost final product, you probably want all your Ethernet software running on the same PSoC device, and just use SPI to interface with your Ethernet chip.      

   

On the other hand if you just want connectivity, and cost is not an issue, using a somewhat expensive Ethernet module will work fine and get you going more quickly.

   

     

   

If you are cost sensitive, I would still go with a PSoC 3 , PSoC 5 or the new PSoC 4 with BLE, because they have more memory than a standard PSoC 4.      

   

.

0 Likes
Anonymous
Not applicable

Hi Manojr_cet thank you for sharing project. I have a question for you. When I want to build big homePage(I mean datalen>3000) it is giving error in MACWrite function. When I am reading Read TX status vectors it says "TX was interrupted". Can you help me for that ?

   

Thanks

   

Alptigin

0 Likes
Anonymous
Not applicable

Hi, Let me know if you need ASIC verification engineeers with expertise in PSoCs and ethernet. I have worked on PSoCs ~5 years. And Ethernet 3+years. And System Verilog /UVM for 3+ years.

0 Likes