47.7.6.2 Two-Pin Mode Configuration
The Two-Pin mode is enabled when MCSPI_MR.TPMEN=1 and MCSPI_MR.MSTR=0.
When Two-Pin mode is enabled, SPI Mode 0 must be configured (MCSPI_CSR0.CPOL=0 and MCSPI_CSR0.NCPHA=0) and the data length must be 8 bits (MCSPI_CSRx.BITS=0).
For proper CRC calculation and checking, MCSPI_CRCR.FHE must be set to '0', MCSPI_CRCR.CRM to '0', MCSPI_CRCR.FRHL to '1' and MCSPI_CRCR.CRCS to '0'. MCSPI_CRCR.FRL must be set according to the value used for MCSPI_TPMR.OSR (refer to “Two-Wire Serial Interface Description” in the data sheet “MCP3910” available on www.microchip.com for more details on frame length and OSR).
See CRC Generation and Checking for details on CRC check configuration.
To obtain synchronization on the synchronization byte (SYNC BYTE), the Comparison mode must be enabled (MCSPI_MR.CMPMODE=1) and the comparison value must be configured to SYNC BYTE (MCSPI_CMPR.VAL1/2= 0xA5). The clock is generated on SPCK when MCSPI_CR.SPIEN is set.
Once the MCSPI is configured in Two-Pin mode and Comparison mode is set, SYNC BYTE is monitored to start receiving a frame. Upon SYNC BYTE reception, the previously received header byte is stored in the Two-Pin Header register (MCSPI_TPHR) and the SYNC BYTE is stored in MCSPI_RDR (the RDRF flag indicates when the data is available). Each frame byte received is written in MCSPI_RDR until reception of the CRCCOM end field (CRC is received as a data).
The Oversampling Rate (OSR) field in the Two-Pin Mode register (MCSPI_TPMR) defines the OSR frame configuration of the MCP3910, and thus the frame length.
