Difference between revisions of "Component: SPI Slave (Comms: Interface)"

From Flowcode Help
Jump to navigationJump to search
(XML import)
 
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
+
{| style="width:50%"
 
 
{| width="50%"
 
 
|-
 
|-
| width="20%" style="color: gray;" | Author
+
| width="20%" style="color:gray;" | Author
 
| Matrix Ltd
 
| Matrix Ltd
 
|-
 
|-
| width="20%" style="color: gray;" | Version
+
| width="20%" style="color:gray;" | Version
| 1.0 (Release)
+
| 1.0
 
|-
 
|-
| width="20%" style="color: gray;" | Category
+
| width="20%" style="color:gray;" | Category
 
| Comms: Interface
 
| Comms: Interface
 
|}
 
|}
  
  
 +
==SPI Slave component==
 +
Low level routines for controlling or interacting with an SPI interface. SPI or Serial Peripheral Interface is a bus used for board level communications between devices. A target microcontroller will usually have at least one hardware SPI peripheral built in.
  
==[[File:Component Icon e2955f6c_d724_4ab0_afca_d62093a77248.png|Image]] SPI Slave component==
+
==Component Pack==
Low level routines for controlling or interacting with an SPI interface.
 
SPI or Serial Peripheral Interface is a bus used for board level communications between devices.
 
A target microcontroller will usually have at least one hardware SPI peripheral built in.
 
  
==Examples==
+
COMMSA
''<span style="color:red;">No additional examples</span>''
 
  
 +
==Detailed description==
  
==Downloadable macro reference==
 
  
===<span style="font-weight: normal;"><u><tt>SendChar</tt></u></span>===
 
General purpose SPI send byte macro
 
  
'''Parameters'''
 
  
:[[Variable Types|BYTE]] ''Char''
 
::Data byte to send
 
  
  
'''Return value'''
 
  
:''This call does not return a value''
 
  
  
===<span style="font-weight: normal;"><u><tt>GetChar</tt></u></span>===
 
General purpose SPI get byte macro
 
  
'''Parameters'''
 
  
:''This macro has no parameters''
+
''No detailed description exists yet for this component''
  
 +
==Examples==
  
'''Return value'''
 
  
:[[Variable Types|BYTE]]
 
  
  
===<span style="font-weight: normal;"><u><tt>UnInitialise</tt></u></span>===
 
Deactivates the SPI peripheral leaving the I/O pins in a state where they can be used for general purpose I/O.
 
  
'''Parameters'''
 
  
:''This macro has no parameters''
 
  
  
'''Return value'''
 
  
:''This call does not return a value''
 
  
  
===<span style="font-weight: normal;"><u><tt>Initialise</tt></u></span>===
 
Activates the SPI peripheral and claims control over the I/O pins.
 
  
'''Parameters'''
 
  
:''This macro has no parameters''
+
Simple Master program that sends an incrementing test value to the SPI bus as well as outputting the value onto LEDs.
  
 +
{{Fcfile|SPI_Master.fcfx|SPI_Master}}
  
'''Return value'''
 
  
:''This call does not return a value''
+
Simple Slave program that collects the value sent by the master and outputs the value onto LEDs. Allows the master slave comms to be compared to check that everything is working correctly.
  
 +
{{Fcfile|SPI_Slave.fcfx|SPI_Slave}}
  
  
==Simulation macro reference==
+
Another simple example to buffer incoming SPI bytes sent by the master and output these to the LCD.
  
''This component does not contain any simulation macros''
+
{{Fcfile|SPI_Slave2.fcfx|SPI_Slave2}}
  
  
==Property reference==
+
==Downloadable macro reference==
<span style="font-weight: normal;"><u>Channel</u></span>
 
  
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''cal_spi::CHANNEL''.
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SendChar'''
 +
|-
 +
| colspan="2" | General purpose SPI send byte macro&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | Char
 +
|-
 +
| colspan="2" | Data byte to send&nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
SPI Channel selector
 
  
<span style="font-weight: normal;"><u>MOSI</u></span>
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetChar'''
 +
|-
 +
| colspan="2" | General purpose SPI get byte macro&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
This property is of type ''Single digital pin'' and can be referenced with the variable name ''cal_spi::MOSI''.
 
  
SPI Data Out Pin SDO - Also Known as Master Out Slave In (MOSI) when used in Master mode.
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''UnInitialise'''
 +
|-
 +
| colspan="2" | Deactivates the SPI peripheral leaving the I/O pins in a state where they can be used for general purpose I/O.&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
<span style="font-weight: normal;"><u>MISO</u></span>
 
  
This property is of type ''Single digital pin'' and can be referenced with the variable name ''cal_spi::MISO''.
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Initialise'''
 +
|-
 +
| colspan="2" | Activates the SPI peripheral and claims control over the I/O pins.&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
SPI Data In Pin SDI - Also Known as Master In Slave Out (MISO) when used in Master mode.
 
  
<span style="font-weight: normal;"><u>CLK</u></span>
 
  
This property is of type ''Single digital pin'' and can be referenced with the variable name ''cal_spi::CLK''.
 
  
SPI Clock Pin CLK - The Clock signal is driven by the SPI master.
+
==Property reference==
  
<span style="font-weight: normal;"><u>Use Slave Select</u></span>
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
+
|-
This property is of type ''True or false'' and can be referenced with the variable name ''cal_spi::UseCS''.
+
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
 
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''  
''<span style="color:red;">No additional information</span>''
+
|-
 
+
|-
 
+
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
 
+
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Connections
<span style="font-weight: normal;"><u>CS / SS</u></span>
+
|-
 
+
|-
This property is of type ''Single digital pin'' and can be referenced with the variable name ''cal_spi::SS''.
+
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
+
| width="90%" | Channel
Chip Select / Slave Select Pin  
+
|-
 
+
| colspan="2" | SPI Channel selector&nbsp;
Master Mode: General purpose output pin used to select the remote SPI device.
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
Slave Mode: Hardware chip select pin input used to select the SPI device.
+
| width="90%" | MOSI
 
+
|-
<span style="font-weight: normal;"><u>Clock Phase</u></span>
+
| colspan="2" | SPI Data Out Pin SDO - Also Known as Master Out Slave In (MOSI) when used in Master mode.&nbsp;
 
+
|-
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''cal_spi::CKE''.
+
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
 
+
| width="90%" | MISO
Clock Phase (data change edge) selection
+
|-
 
+
| colspan="2" | SPI Data In Pin SDI - Also Known as Master In Slave Out (MISO) when used in Master mode.&nbsp;
<span style="font-weight: normal;"><u>Clock Polarity</u></span>
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''cal_spi::CKP''.
+
| width="90%" | CLK
 
+
|-
Clock Polarity setting, inactive (idle) state
+
| colspan="2" | SPI Clock Pin CLK - The Clock signal is driven by the SPI master.&nbsp;
 
+
|-
<span style="font-weight: normal;"><u>Sample Point</u></span>
+
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
 
+
| width="90%" | Use Slave Select
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''cal_spi::SMP''.
+
|-
 
+
| colspan="2" | &nbsp;
Data bit read sample point
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
<span style="font-weight: normal;"><u>Label</u></span>
+
| width="90%" | CS / SS
 
+
|-
This property is of type ''Line of text'' and can be referenced with the variable name ''label''.
+
| colspan="2" | Chip Select / Slave Select Pin Master Mode: General purpose output pin used to select the remote SPI device. Slave Mode: Hardware chip select pin input used to select the SPI device. &nbsp;
 
+
|-
Label used to identify the component on the panel.
+
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
 
+
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Bus Settings
<span style="font-weight: normal;"><u>Scope Traces</u></span>
+
|-
 
+
|-
This property is of type ''True or false'' and can be referenced with the variable name ''cal_spi::ScopeTraces''.
+
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
+
| width="90%" | Clock Phase
Selects if the scope traces are automatically generated or not
+
|-
 
+
| colspan="2" | Clock Phase (data change edge) selection&nbsp;
<span style="font-weight: normal;"><u>Console Data</u></span>
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
This property is of type ''True or false'' and can be referenced with the variable name ''cal_spi::ConsoleData''.
+
| width="90%" | Clock Polarity
 
+
|-
Selects if the console data is automatically generated or not
+
| colspan="2" | Clock Polarity setting, inactive (idle) state&nbsp;
 
+
|-
<span style="font-weight: normal;"><u>Injector</u></span>
+
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
+
| width="90%" | Sample Point
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''cal_spi::Injector''.
+
|-
 
+
| colspan="2" | Data bit read sample point&nbsp;
''<span style="color:red;">No additional information</span>''
+
|-
 +
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
 +
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Simulation
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-type-10-icon.png]]
 +
| width="90%" | Label
 +
|-
 +
| colspan="2" | Label used to identify the component on the panel.&nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
 +
| width="90%" | Scope Traces
 +
|-
 +
| colspan="2" | Selects if the scope traces are automatically generated or not&nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
 +
| width="90%" | Console Data
 +
|-
 +
| colspan="2" | Selects if the console data is automatically generated or not&nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 +
| width="90%" | API
 +
|-
 +
| colspan="2" | &nbsp;
 +
|}

Latest revision as of 17:22, 9 November 2022

Author Matrix Ltd
Version 1.0
Category Comms: Interface


SPI Slave component

Low level routines for controlling or interacting with an SPI interface. SPI or Serial Peripheral Interface is a bus used for board level communications between devices. A target microcontroller will usually have at least one hardware SPI peripheral built in.

Component Pack

COMMSA

Detailed description

No detailed description exists yet for this component

Examples

Simple Master program that sends an incrementing test value to the SPI bus as well as outputting the value onto LEDs.

FC6 Icon.png SPI_Master


Simple Slave program that collects the value sent by the master and outputs the value onto LEDs. Allows the master slave comms to be compared to check that everything is working correctly.

FC6 Icon.png SPI_Slave


Another simple example to buffer incoming SPI bytes sent by the master and output these to the LCD.

FC6 Icon.png SPI_Slave2


Downloadable macro reference

Fc9-comp-macro.png SendChar
General purpose SPI send byte macro 
Fc9-u8-icon.png - BYTE Char
Data byte to send 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png GetChar
General purpose SPI get byte macro 
Fc9-u8-icon.png - BYTE Return


Fc9-comp-macro.png UnInitialise
Deactivates the SPI peripheral leaving the I/O pins in a state where they can be used for general purpose I/O. 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png Initialise
Activates the SPI peripheral and claims control over the I/O pins. 
Fc9-void-icon.png - VOID Return



Property reference

Fc9-prop-icon.png Properties
Fc9-conn-icon.png Connections
Fc9-type-16-icon.png Channel
SPI Channel selector 
Fc9-type-5-icon.png MOSI
SPI Data Out Pin SDO - Also Known as Master Out Slave In (MOSI) when used in Master mode. 
Fc9-type-5-icon.png MISO
SPI Data In Pin SDI - Also Known as Master In Slave Out (MISO) when used in Master mode. 
Fc9-type-5-icon.png CLK
SPI Clock Pin CLK - The Clock signal is driven by the SPI master. 
Fc9-type-7-icon.png Use Slave Select
 
Fc9-type-5-icon.png CS / SS
Chip Select / Slave Select Pin Master Mode: General purpose output pin used to select the remote SPI device. Slave Mode: Hardware chip select pin input used to select the SPI device.  
Fc9-conn-icon.png Bus Settings
Fc9-type-16-icon.png Clock Phase
Clock Phase (data change edge) selection 
Fc9-type-16-icon.png Clock Polarity
Clock Polarity setting, inactive (idle) state 
Fc9-type-16-icon.png Sample Point
Data bit read sample point 
Fc9-conn-icon.png Simulation
Fc9-type-10-icon.png Label
Label used to identify the component on the panel. 
Fc9-type-7-icon.png Scope Traces
Selects if the scope traces are automatically generated or not 
Fc9-type-7-icon.png Console Data
Selects if the console data is automatically generated or not 
Fc9-type-16-icon.png API