Tool/software:
Hi Community Members,
We would like to read the 0x00 register of the KSZ8795CLX ethernet switch using tm4c123gh6pm with SPI.
We expect to get the value of 0x87 from 0x00 register of the KSZ8795CLX.
We send 0x03 (SPI read data command), 0x00 (register address), and 4 dummy bytes while receving 4 bytes.
However, we have not yet managed to get any meaningful data from the register. System clock, initialization, and reading functions with the logic analyzer screenshot can be seen in the followings:
How can we solve this problem?
System Clock:
SysCtlClockSet(SYSCTL_SYSDIV_10 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ);
Initialization Function:
// Enable SSI0 peripheral
SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI0);
// Enable GPIO port A
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
// Configure the pin muxing for SSI0 functions on port A2, A3, A4, and A5
GPIOPinConfigure(GPIO_PA2_SSI0CLK);
GPIOPinConfigure(GPIO_PA3_SSI0FSS);
GPIOPinConfigure(GPIO_PA4_SSI0RX);
GPIOPinConfigure(GPIO_PA5_SSI0TX);
// Configure the GPIO settings for the SSI pins
GPIOPinTypeSSI(GPIO_PORTA_BASE, GPIO_PIN_5 | GPIO_PIN_4 | GPIO_PIN_3 |GPIO_PIN_2);
// Configure and enable the SSI port for SPI master mode
SSIConfigSetExpClk(SSI0_BASE, SysCtlClockGet(), SSI_FRF_MOTO_MODE_1, SSI_MODE_MASTER, 1000000, 8);
// Enable the SSI0 module
SSIEnable(SSI0_BASE);
Reading Function:
while(SSIDataGetNonBlocking(SSI0_BASE, &pui32DataRx[0]))
{
}
SSIDataPut(SSI0_BASE, 0x03);
SSIDataPut(SSI0_BASE, 0x00);
for(ui32Index = 0; ui32Index < 4; ui32Index++)
{
SSIDataPut(SSI0_BASE, 0x00);
SSIDataGet(SSI0_BASE, &pui32DataRx[ui32Index]);
}
Thank you very much.
Best Regards.