Other Parts Discussed in Thread: CC3200
Hi all,
I am using CC3200 Launchpad and trying to interface it with ENC28J60 using SPI.
ENC28J60 is an ethernet controller from Microchip. Sending 0xff to it will do a soft reset of ENC.
I used the APIs from spi_demo and followed the sequence of initialisations as done in that.
Below is the initialisation part
lpg_cc3200_spi_init(void)
{
lpg_report("\n%s()",__FUNCTION__);
/* Enable SPI clock module */
MAP_PRCMPeripheralClkEnable(PRCM_GSPI,PRCM_RUN_MODE_CLK);
/* Reset SPI */
MAP_PRCMPeripheralReset(PRCM_GSPI);
MAP_SPIReset(GSPI_BASE);
/* Configure SPI Interface as Master */
MAP_SPIConfigSetExpClk(GSPI_BASE,MAP_PRCMPeripheralClockGet(PRCM_GSPI),
SPI_IF_BIT_RATE,SPI_MODE_MASTER,SPI_SUB_MODE_1,
(SPI_SW_CTRL_CS |
SPI_3PIN_MODE |
SPI_TURBO_OFF |
SPI_CS_ACTIVELOW |
SPI_WL_8));
/* Register Interrupt Handler */
//MAP_SPIIntRegister(GSPI_BASE,lpg_cc3200_spi_slave_interrupt_handler);
/* Enable Interrupts */
//MAP_SPIIntEnable(GSPI_BASE,SPI_INT_RX_FULL|SPI_INT_TX_EMPTY);
/* Enable SPI for Communication */
MAP_SPIEnable(GSPI_BASE);
return (CC3200_SPI_INIT_DONE);
}
I am facing a strange problem.
The chip select pin shows proper transitions in oscilloscope but the read operation do not go through.
But when I make the mode to 3PIN_MODE data goes on the lines, anyways as expected there is no response from ENC as it is not selected.
Below is the code snippet of write operation of 0xff to ENC
void
lpg_eth_enc28j60_soft_reset()
{
unsigned long recv_byte;
lpg_report("\n%s():Enter",__FUNCTION__);
lpg_report("\n%s():Chip select enable",__FUNCTION__);
MAP_SPICSEnable(GSPI_BASE); -------------------------------------> Chip select works, here
MAP_SPIDataPut(GSPI_BASE, 0xFF); --------------------------> Nothing happens on data bus, MOSI
MAP_SPIDataGet(GSPI_BASE, &recv_byte);
AP_SPICSDisable(GSPI_BASE); -------------------------------> Chip select works here also
}
Can some one please assist why SPIDataPut does not work in 4BIT mode. I need to write only one byte, i.e., 0xff
Thank you in advance.