TECHNICAL MANUAL
Telit GM862-GPS
Quad Band GPS Data Terminal Module
Pag.45 of 79
Rev. 0
corresponding Slave Select line is mapped. Up to 8 slave select lines can be defined (also
none if only 1 slave is used).
Return value is the Python custom SPI bus object pointer which then shall be used to
interface with the SPI bus created.
Example:
bus3 = SPI.new(3,4,5)
bus4 = SPI.new(6,7,8,9,10)
This creates two SPI bus, one over the GPIO3, GPIO4, GPIO5 and one over the GPIO6,
GPIO7, GPIO8, GPIO9, GPIO10 where the GPIO9 is the Slave 0 select and GPIO10 is the
Slave 1 select pin.
Available pins for the SPI bus are GPIO3 - GPIO13, while GPIO1 and GPIO2 are not
available for SPI.
3.13.7.2 SPI
object
method: init(CPOL, CPHA)
Does the first pin initialisation on the SPI bus previously created.
Bus clock polarity is controlled by CPOL value:
CPOL = 0 - clock polarity low
CPOL = 1 - clock polarity high
Bus clock phase transmission is controlled by CPHA value:
CPHA = 0 - data bit is clocked/latched on the first edge of the SCLK.
CPHA = 1 - data bit is clocked/latched on the second edge of the SCLK.
Return value is a Python integer which is -1 if an error occurred otherwise is 1.
Example:
a = bus3.init(0,0)
3.13.7.3 SPI
object
method: sendbyte(byte, <SS_number>)
Sends a byte to the SPI bus previously created addressed for the Slave number
SS_number whose Slave Select signal is activated.
Input parameter byte is a Python byte which is the byte to be sent to the SPI bus.
Optional Parameter SS_number is a Python byte representing the Slave number to be
activated, if not present no slave line is activated.
Return value is a Python integer which is -1 if an error occurred otherwise is 1 the byte has
been sent.
Example:
a = bus3.sendbyte(123)
sends byte 123 to the SPI bus , assigning return result value to a.
b=bus4.sendbyte(111,1)
sends byte 111 to the SPI bus activating the Slave Select line of the SS1 device (in our
example GPIO10)
3.13.7.4 SPI
object
method:
send(string, <SS_number>)
Sends a string to the SPI bus previously created.
Input parameter string is a Python string which is the string to send to the SPI bus.
Optional Parameter SS_number is a Python byte representing the Slave number to be
activated, if not present no slave line is activated.