Wiznet makers

mvpatel

Published August 14, 2023 © Creative Commons Attribution-NonCommercial CC BY-NC version 4.0 or later (CC BY-NC4+)

0 UCC

0 VAR

2 Contests

0 Followers

0 Following

W5300 custom Library for Any Arduino board and Application

I have developed and shared open source custom library for W5300 to use it with any Arduino Compatible Boards and its application here.

COMPONENTS Hardware components

WIZnet - W5300-TOE-Shield

x 1

W5300 TOE SHIELD


Arduino - Arduino Mega 2560

x 1

Arduino Mega

Software Apps and online services

Arduino - Arduino IDE

x 1

Arduino IDE


PROJECT DESCRIPTION

Idea :  Idea of this project is to develop modified W5300 Arduino Ethernet library to use it with W5300-TOE-SHIELD and Arduino Mega 2560 (or other AVR/Non AVR Arduino board with changed pin assignment and Modified IO Driver). 

Initially I have worked on modified W5300 Arduino Mega library using direct addressing and 16 bit data bus as Arduino Mega having lots of IO to spare. But recently I came across this nice project  where author used 8-bit data bus and indirect addressing to access W5300 and save IO pins of MCU. I have taken reference from this project to write W5300 IO Driver to be used in my modified W5300 Arduino library that requires 14 IO Pins of MCU and It can be used with other low pin count AVR or Non-AVR Arduino compatible MCU as well.

Project Video on Youtube: This video demonstrate installation and use of Modified W5300 Arduino library with Arduino Mega 2560.

Github Link of Custom W5300 Library for Any Arduino Compatible Boards and PCB files:

Github repo

Circuit diagram and Pin assignment Arduino Mega and W5300-TOE-SHIELD :

 

Hardware PCB Design (Failed due to no solder mask on W5300 Pins ) :

I have designed PCB Layout for W5300 module and assembled the PCB and tested it, but get to know that there are many short circuits on W5300 pin as no solder mask around w5300 pins. I have tried hard to rework the board but ended up with few broken pins of w5300 and failed board. If any one want to try this board, I have attached its Gerber files and other PCB data for reference only.

PCB Layout W5300 Module (only for reference) :

  

Schematic W5300 Module (Only for Reference):

Assembled Board (Failed due to no solder mask on W5300 Pins) :

 

So with this failure I have no spare W5300 IC and also deadline of contest approaching fast, so I have decided to borrow W5300_TOE_SHIELD from my friend and made connections with Arduino mega on General purpose board.

Following Section shows W5300 and Arduino mega connections on General Purpose Board.

Hardware Development on GPB (Worked great ):

 

Arduino Mega/ Any AVR / Non AVR based Arduino board usage :

If user want to change pin assignment for Arduino Mega or any other AVR Microcontroller based Arduino board than change following lines in w5300_anymcu.h with desired pin assignment.

// Assign W5300 DATA Lines to 8 bit port (PORTK used here)
#define DATA_OUT  PORTK
#define DATA_DIR  DDRK
#define DATA_IN   PINK
// Assign W5300 COntrol lines in any sequence to 6 pins of any port
// (PORTF used here)
#define CTRL_OUT  PORTF
#define CTRL_DIR  DDRF
#define CTRL_IN   PINF
// control pin numbers
#define ADR0 7
#define ADR1 6
#define ADR2 5

#define RD  2
#define WR  3
#define CS  4 

If user want to any other Non AVR microcontroller like RP2040 etc with Arduino IDE than need to make changes in following files,

edit w5300_anymcu.h with pin assignment of desired MCU
edit w5300_anymcu.cpp with w5300 io driver logic by keeping function name, return type and argument as it is for following functions for desired MCU,

uint16_t w5300_read_indirect(uint16_t addr);
void w5300_write_indirect(uint16_t addr, uint16_t data1);
void w5300_setup_indirect_MR(void);
void w5300_init(void);
void w5300_reset(void);

As this functions are used in remaining source files of Arduino Ethernet library of W5300.

With This I really hopes that shared Arduino AVR W5300 library will be useful to community and will attract more quality submissions to this contest...

Thank You

 

Documents
  • Schematic Diagram

    Schematic Diagram W5300 and Arduino Mega Interface

  • W5300 Pin Assignment

    W5300 and Arduino Mega Pin Assignment

  • W5300_Module_Gerber (Only for reference)

    W5300_Module_Gerber (Only for reference , Failed due to no solder mask)

  • W5300_Module_Schematic (Only for reference)

    W5300_Module_Schematic (Only for reference)

  • W5300_Module_BOM (Only for reference)

    W5300_Module_BOM (Only for reference)

  • Github Code and Hardware repo

    Github Code and Hardware repo

Comments Write