Page 1 of 1

Can't read KSZ8851 device id

Posted: Sat Jul 23, 2016 1:48 pm
by muhu J
Right now, I am trying to interface SAM L21J18B with Ethernet xplained pro having KSZ885SNL PHY controller. ASF offered LWIP in their example projects for SAM D21 and KSZ8851SNL. I changed it to SAM L21. What problem I am facing now is that I couldn't read device ID of the KSZ8851.
I can send OP code and address of Chip ID and Enable Register of KSZ8851 to KSZ8851. But I didn't get any reply from that.

This is my code

while (!spi_is_ready_to_read(module)) {

static inline bool spi_is_ready_to_read(
struct spi_module *const module)
/* Sanity check arguments */

SercomSpi *const spi_module = &(module->hw->SPI);

/* Check interrupt flag */
return (spi_module->INTFLAG.reg & SERCOM_SPI_INTFLAG_RXC);
When while function calls the below function, it creates infinite loop as RXC not set. RXC will set once recieved buffer filled with data. This is why I suspect SPI read operation.

Pls help me.............