Hello!
I have OMAP-L138 Experimenter Kit and I want to communicate with one of peripheral devices which is set on SPI CS1 (there is also flash memory on SP1 CS0).
Please may you help me to figure out which registers should I use to select chip 1 ?
According to OMAP-L138 Technical Reference Manual, I should
0. set 4-pin mode
spi->SPIPC0 = SOMI | SIMO | CLK | SCS0; //4-pin mode with chip select
1. set 1 bit of SPIPC0.SCS0FUN to show that SPI_CS1 - is a SPI functional pin
SETBIT(spi->SPIPC0, 0x00000002); //set 1st bit to show that SPI_CS1 - is a SPI functional pin
2. set 17 bit of SPIDAT1.CSNR (It means that SPI_CS1 pin is driven high.)
spi->SPIDAT1 = 0;
SETBIT(spi->SPIDAT1, 0x20000); //set 17th bit (corresponds to SPI_CS1)
3. set 1 bit of SPIDEF.CSDEF (It means that SPI_CS1 pin is driven high.)
spi->SPIDEF = 0;
SETBIT(spi->SPIDEF, 0x00000002); //set 1st bit (corresponds to SPI_CS1) in CSDEF field
4. finally, before reading data from SPI1_CS1 device, I should set SPIDAT1.CSHOLD to held active chip select signal
SETBIT(spi->SPIDAT1,0x10000000); //set 28th bit which represents CSHOLD
Is it correct or I misunderstood something?
Thank you!