Hi
I am using PIC18f4520 to implement the webserver along with w5500. I have jsut checked the SPI communication between both of them writing part is ok , while reading the same register i am zeros always.
Here is my code:
sbit Wizchip_Rst at LATE1_bit;
sbit Wizchip_CS at LATE0_bit;
sbit Wizchip_Rst_Direction at TRISE1_bit;
sbit Wizchip_CS_Direction at TRISE0_bit;
void CB_ChipSelect(void)
{
Wizchip_CS = 0;
}
// brief Call back function for WIZCHIP deselect.
void CB_ChipDeselect(void)
{
Wizchip_CS = 1;
}
uint8_t shar;
void main() {
SPI1_Init();
TRISC.B6 = 0;
TRISC.B7 = 1;
Wizchip_CS_Direction = 0;
Wizchip_Rst_Direction = 0;
Wizchip_Rst = 1 ;
UART1_Init(4800);
CB_ChipSelect();
SPI1_Write(0x00);
SPI1_Write(0x09);
SPI1_Write(0x01);
SPI1_Write(0x10);
CB_ChipDeselect();
while(1){
// UART_Write_Text("Hello123 !");
CB_ChipSelect();
SPI1_Write(0x00);
SPI1_Write(0x09);
SPI1_Write(0x05);
shar = SPI1_Read(0);
UART_Write(shar);
CB_ChipDeselect();
Delay_ms(100);
// UART_Write_Text("Hello !");
}
}
Thanks much,
Dhanunjay