BS85B12-3/BS85C20-3/BS85C20-5
Touch Key Flash MCU with LCD/LED Driver
Serial Interface Module – SIM
TheseꢀdevicesꢀcontainꢀaꢀSerialꢀInterfaceꢀModule,ꢀwhichꢀincludesꢀbothꢀtheꢀfourꢀlineꢀSPIꢀinterfaceꢀorꢀ
theꢀtwoꢀlineꢀI2Cꢀinterfaceꢀtypes,ꢀtoꢀallowꢀanꢀeasyꢀmethodꢀofꢀcommunicationꢀwithꢀexternalꢀperipheralꢀ
hardware.ꢀHavingꢀrelativelyꢀsimpleꢀcommunicationꢀprotocols,ꢀtheseꢀserialꢀinterfaceꢀtypesꢀallowꢀ
theꢀmicrocontrollerꢀtoꢀinterfaceꢀtoꢀexternalꢀSPIꢀorꢀI2Cꢀbasedꢀhardwareꢀsuchꢀasꢀsensors,ꢀFlashꢀorꢀ
EEPROMꢀmemory,ꢀetc.ꢀTheꢀSIMꢀpinsꢀareꢀpinꢀsharedꢀwithꢀotherꢀI/Oꢀpinsꢀandꢀmustꢀbeꢀselectedꢀusingꢀ
theꢀSIMENꢀbitꢀinꢀtheꢀSIMC0ꢀregister.ꢀAsꢀbothꢀinterfaceꢀtypesꢀshareꢀtheꢀsameꢀpinsꢀandꢀregisters,ꢀtheꢀ
choiceꢀofꢀwhetherꢀtheꢀSPIꢀorꢀI2CꢀtypeꢀisꢀusedꢀisꢀmadeꢀusingꢀtheꢀSIMꢀoperatingꢀmodeꢀcontrolꢀbits,ꢀ
namedꢀSIM2~SIM0,ꢀinꢀtheꢀSIMC0ꢀregister.
SPI Interface
TheꢀSPIꢀinterfaceꢀisꢀoftenꢀusedꢀtoꢀcommunicateꢀwithꢀexternalꢀperipheralꢀdevicesꢀsuchꢀasꢀsensors,ꢀ
FlashꢀorꢀEEPROMꢀmemoryꢀdevicesꢀetc.ꢀOriginallyꢀdevelopedꢀbyꢀMotorola,ꢀtheꢀfourꢀlineꢀSPIꢀ
interfaceꢀisꢀaꢀsynchronousꢀserialꢀdataꢀinterfaceꢀthatꢀhasꢀaꢀrelativelyꢀsimpleꢀcommunicationꢀprotocolꢀ
simplifyingꢀtheꢀprogrammingꢀrequirementsꢀwhenꢀcommunicatingꢀwithꢀexternalꢀhardwareꢀdevices.
Theꢀcommunicationꢀisꢀfullꢀduplexꢀandꢀoperatesꢀasꢀaꢀslave/masterꢀtype,ꢀwhereꢀtheꢀdeviceꢀcanꢀbeꢀ
eitherꢀmasterꢀorꢀslave.ꢀAlthoughꢀtheꢀSPIꢀinterfaceꢀspecificationꢀcanꢀcontrolꢀmultipleꢀslaveꢀdevicesꢀ
fromꢀaꢀsingleꢀmaster,ꢀbutꢀthisꢀdeviceꢀprovidedꢀonlyꢀoneꢀSCSꢀpin.ꢀIfꢀtheꢀmasterꢀneedsꢀtoꢀcontrolꢀ
multipleꢀslaveꢀdevicesꢀfromꢀaꢀsingleꢀmaster,ꢀtheꢀmasterꢀcanꢀuseꢀI/Oꢀpinꢀtoꢀselectꢀtheꢀslaveꢀdevices.
SPI Interface Operation
TheꢀSPIꢀinterfaceꢀisꢀaꢀfullꢀduplexꢀsynchronousꢀserialꢀdataꢀlink.ꢀItꢀisꢀaꢀfourꢀlineꢀinterfaceꢀwithꢀpinꢀ
namesꢀSDI,ꢀSDO,ꢀSCKꢀandꢀSCS.ꢀPinsꢀSDIꢀandꢀSDOꢀareꢀtheꢀSerialꢀDataꢀInputꢀandꢀSerialꢀDataꢀ
Outputꢀlines,ꢀSCKꢀisꢀtheꢀSerialꢀClockꢀlineꢀandꢀꢀSCSꢀisꢀtheꢀSlaveꢀSelectꢀline.ꢀAsꢀtheꢀSPIꢀinterfaceꢀ
pinsꢀareꢀpin-sharedꢀwithꢀnormalꢀI/OꢀpinsꢀandꢀwithꢀtheꢀI2Cꢀfunctionꢀpins,ꢀtheꢀSPIꢀinterfaceꢀmustꢀfirstꢀ
beꢀenabledꢀbyꢀsettingꢀtheꢀcorrectꢀbitsꢀinꢀtheꢀSIMC0ꢀandꢀSIMC2ꢀregisters.ꢀCommunicationꢀbetweenꢀ
devicesꢀconnectedꢀtoꢀtheꢀSPIꢀinterfaceꢀisꢀcarriedꢀoutꢀinꢀaꢀslave/masterꢀmodeꢀwithꢀallꢀdataꢀtransferꢀ
initiationsꢀbeingꢀimplementedꢀbyꢀtheꢀmaster.ꢀTheꢀMasterꢀalsoꢀcontrolsꢀtheꢀclockꢀsignal.ꢀAsꢀtheꢀdeviceꢀ
onlyꢀcontainsꢀaꢀsingleꢀSCSꢀpinꢀonlyꢀoneꢀslaveꢀdeviceꢀcanꢀbeꢀutilized.ꢀTheꢀSCSꢀpinꢀisꢀcontrolledꢀbyꢀ
software,ꢀsetꢀCSENꢀbitꢀtoꢀ"1"ꢀtoꢀenableꢀSCSꢀpinꢀfunction,ꢀsetꢀCSENꢀbitꢀtoꢀ"0"ꢀtheꢀꢀSCSꢀpinꢀwillꢀbeꢀ
asꢀI/Oꢀfunction.
S
I
P
a
M
s
t
e
r
S
I
P
S
a
l
e
v
S
K
C
S
S
S
S
K
I
O
S
C
D
D
C
S
O
D
S
I
D
S
S
C
SPI Master/Slave Connection
TheꢀSPIꢀfunctionꢀinꢀthisꢀdeviceꢀoffersꢀtheꢀfollowingꢀfeatures:
•ꢀ Fullꢀduplexꢀsynchronousꢀdataꢀtransfer
•ꢀ BothꢀMasterꢀandꢀSlaveꢀmodes
•ꢀ LSBꢀfirstꢀorꢀMSBꢀfirstꢀdataꢀtransmissionꢀmodes
•ꢀ Transmissionꢀcompleteꢀflag
•ꢀ Risingꢀorꢀfallingꢀactiveꢀclockꢀedge
TheꢀstatusꢀofꢀtheꢀSPIꢀinterfaceꢀpinsꢀisꢀdeterminedꢀbyꢀaꢀnumberꢀofꢀfactorsꢀsuchꢀasꢀwhetherꢀtheꢀdeviceꢀ
isꢀinꢀtheꢀmasterꢀorꢀslaveꢀmodeꢀandꢀuponꢀtheꢀconditionꢀofꢀcertainꢀcontrolꢀbitsꢀsuchꢀasꢀCSENꢀandꢀ
SIMEN.
Rev. 1.20
121
�ꢀꢁꢀst 10ꢂ 2012