Pic32 W5500 spi
Ethernet Chips
No replies yet. Be the first to reply.
Join the discussion.
Ethernet Chips
No replies yet. Be the first to reply.
Join the discussion.
Share projects and connect with makers.
Joined before the site update? first.
New to WIZnet Makers?
We sent a verification link to your address. Open it to activate your account, then log in.
Accounts from this email provider are reviewed by an administrator after verification. Approval usually takes one business day.
Already have an account?
Enter your email address. If it belongs to an account, we'll send a link to set a new password. Members who joined before the site update use this to set their password.
If an account uses that address, we sent a link to set a new password. The link works once and expires in 30 minutes.
Know your password?
Need an account?
RE: Pic32 W5500 spi
by Spanner ·
Hi there,
In responce to my own post, I have learnt a fair bit and am now starting to make a little progress…
This information is mainly going to be of use to those wanting to use the W5500 module with the microchip pic32.
Specifically i am working with an Olimex PIC32-T795 Development board This comes with the PIC32MX795F512H Micro.
At 1st i got absolutly noware at all then id desperation i checked with a scope and found i had the mosi and miso lines crossed over. After sorting that out i managed to open the spi channel with the right params to talk with the W5500
This is the spi-channel open statement i am useing the 25 on the end is the clock divisor but i have not yet reached the point were speed matters.
SpiChnOpen(SPI_CHANNEL3, SPI_OPEN_CKE_REV |SPI_OPEN_MSTEN |SPI_OPEN_MODE8 | SPI_OPEN_ON , 25);
In my system.h i have the following 4 defines for controlling the reset pin and the chip select pin.
#define WIZ550_SCSnSet() {LATDSET=_LATD_LATD0_MASK;} // Wiz550 scsn pin
#define WIZ550_SCSnClr() {LATDCLR=_LATD_LATD0_MASK;}
#define WIZ550_RSTSet() {LATDSET=_LATD_LATD11_MASK;} // Wiz550 reset pin
#define WIZ550_RSTClr() {LATDCLR=_LATD_LATD11_MASK;}
Then in the io library files i can just use WIZ550_SCSnClr(); to enable the slave selct line ( pull it low )
and of course WIZ550_SCSnSet(); to de_select the module.
in my system.c file i have this.
char writeSPI3( char i )
{
SPI3BUF = i; // write to buffer for TX
while( !SPI3STATbits.SPIRBF ); // wait for TX complete
return SPI3BUF; // read the received values
}
So that in the iolibrary i have this ( i sent a null byte to get the return value )
uint8_t wizchip_spi_readbyte(void)
{
return writeSPI3( 0x00 );
};
and this for the data send.
void wizchip_spi_writebyte(uint8_t wb)
{
writeSPI3( wb );
};
i also had to uncomment the following two lines in the _WIZCHIP WIZCHIP = structure.
.IF.SPI._read_byte = wizchip_spi_readbyte,
.IF.SPI._write_byte = wizchip_spi_writebyte
At this point i can in my main. file i can do this
unsigned char bbb[20];
WIZCHIP_READ_BUF(SIPR, bbb, 4);
lcd_clear();
sprintf(tbuff,“%d.%d.%d.%d”,bbb[0],bbb[1],bbb[2],bbb[3]);
lcd_puts(tbuff);
DelayMs(1000);
This prints out the default ip address of the module
and this prints out the version number for the module.
C = getVERSIONR();
lcd_clear();
sprintf(tbuff,“Wiz5500 Ver=%d”,C);
lcd_puts(tbuff);
DelayMs(500);
In the PDF file dated 2013/08/30 02:44 the module pinouts are shown as two rows of 8 contacts this is wrong it should show a row of 8 and a row of 6 pins.
I was also led astray when i looked at one of the header files w5500.h that showed to read a a value from the module
uint8_t WIZCHIP_READ (uint32_t AddrSel); supply the address and get back the value, i hadent realised that there is also some extrra pre-amble in the address field.
I hope this info helps a few others.
I will post again when i have the rewst workingh.
RE: Pic32 W5500 spi
by peter ·
How did you get the schematic?
Regarding pins of wiz550io, Please refer to below link.
wizwiki.net/wiki/lib/exe/fetch.p … 140117.pdf
RE: Pic32 W5500 spi
by Spanner ·
Hi again,
Yes that circuit is correct shows an 8 pin and a 6 pin interface to the module.
I have now downloaded and poped the udp and tcp echo examples and they both worked 1st time.
And i was quite pleased to see them just work without any great struggle, next get it working under interupts so i can
have a main loop ‘do stuff’ and only call in/out to the network when needed.
in my app i will have veriable sized data blocks to return to the pc ranging from a few status bytes to 30mbytes depending on
what functions are called. Even the big data block will only be coming in chunks of 50k or so due to local ram on the pic
not being large enough.
RE: Pic32 W5500 spi
by nealmartini ·
Would you please post a copy of your main.c. I am trying to use the ioLibrary with another PIC processor and it would be helpful if I could see the main.c code.
Thanks
RE: Pic32 W5500 spi
by sjoerd ·
Here’s some test code i’ve used for the PIC16F876.
It works pretty well when it comes to SPI communication but I’m keep getting a SOCKERR_SOCKMODE when calling the listen function…(still fighting with that…)