No response from LAN9252 EtherCAT over SPI
Hello
I have an EtherCAT development board with LAN9252 controller, connected over SPI to a micro controller.
The board driver (XML-file for TwinCAT) is defined as SPI, 32 byte in, 32 byte out. According to TwinCAT, the board is in operational state. I am also able to switch to other states.
In a first step of my code, I try to execute a byte order test. So the micro controller sends the command 0x64.
for (i=0; i<10; i++) // check test register 10 times
{
Delay_ms(20); // wait 20 mS
TempLong.Long = SPIReadRegisterDirect (BYTE_TEST, 4); //
if (TempLong.Long == 0x87654321) //
break;
}
....
unsigned long SPIReadRegisterDirect (unsigned short Address, unsigned char Len)
// Address = register to read
// Len = number of bytes to read (1,2,3,4)
{
unsigned char i;
ULONG Result;
UWORD Addr;
Addr.Word = Address;
XMC_SPI_CH_EnableSlaveSelect(XMC_SPI1_CH0, XMC_SPI_CH_SLAVE_SELECT_0);
SPI1Transfer(COMM_SPI_READ); // SPI read command
SPI1Transfer(Addr.Byte[1]); // address of the register
SPI1Transfer(Addr.Byte[0]); // to read, MsByte first
for (i=0; i<Len; i++) // read the requested number of bytes
{ // LsByte first
Result.Byte[i] = SPI1Transfer(DUMMY_BYTE); //
}
XMC_SPI_CH_DisableSlaveSelect(XMC_SPI1_CH0);
return Result.Long; // return the result
}
If I execute the code, I read 0xFFFFFFFF from SPI (MISO).
I checked the hardware -> Pinning OK
I did some measurements with a scope and the levels are OK:
SPI Clock is 10 kHz
/CS => OK
MOSI => OK
MISO => always +3V3
If I disconnect the micro controller from the LAN9525-Eval-Board and measure the voltage level on LAN9252 on pins (13 MISO), (17 MOSI), (19 CLK) and (50, /CS) all pins deliver +3.3V. For my opinion, the voltage level should be zero..
Does anyone have an idea what the problem could be?
Thank you and best regards
Geri
post edited by Geri - 2018/07/09 06:31:12
Attached Image(s)
