|
SPI Slave |
Top Previous Next |
| Got to SUB-20 page |
|
Configuration To use SUB-20 in SPI slave mode following should be done:
Example Below is an example to exchange 12 bytes with SPI master:
sub_spi_config( hndl, SPI_ENABLE|SPI_SLAVE|SPI_CPOL_RISE|SPI_SMPL_SETUP, 0 ); sub_fifo_config( hndl, FIFO_SELECT_SPI ); sub_fifo_write( hndl, "Hello Master", 12, 100 ); read_sz=0; while( read_sz < 12 ) { rc = sub_fifo_read( hndl, in_buff, 64, 10000 ); /* wait 10 sec */ if( rc < 0 ) return rc; /* error */ read_sz += rc; }
Slave Select SUB-20 SPI Slave module use SS0 pin as slave select. SS0 must be pulled low by external SPI master to enable SUB-20 SPI module functionality. When SS0 is held low, the SPI is activated, and MISO becomes an output. All other pins are inputs. When SS is driven high, all pins are inputs, and the SPI is passive.
|