Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
en:netzer:spi-master [2015/12/22 18:21] svesch [Communication] Fixed missing link |
en:netzer:spi-master [2015/12/23 17:37] svesch [SPI master in single slave operation] |
||
---|---|---|---|
Line 54: | Line 54: | ||
===== Communication ===== | ===== Communication ===== | ||
- | Since a [[connection|connection]] is established, the SPI Master can be used. All received characters from TCP Client but the backslash '\' (Escape) are transparently sent from Netzer to the SPI master module. Escaped characters, which are not supported due the installed firmware version are also transparently conveyed. For a complete listing of the supported escape sequencies see below. The ring buffer has a size of 256 byte for buffering transmission bursts. | + | Since a [[connection|connection]] is established, the SPI Master can be used. |
+ | All received characters from TCP Client but the backslash '\' (Escape) are transparently sent from Netzer to the SPI master module. | ||
+ | Escaped characters, which are not supported due to the installed firmware version are also transparently conveyed. | ||
+ | For a complete listing of the supported escape sequencies see below. The ring buffer has a size of 256 byte for buffering transmission bursts. | ||
- | The SPI Master module generates for each byte eight clock edges at SPI_CLK and shifts out the data at SPI_MO. At the same time the slave delivers data at SPI_MI (see figure above). The so received byte is sent automatically to the TCP Client. In this direction no escaping is used. | + | The SPI Master module generates for each byte eight clock edges at SPI_CLK and shifts out the data at SPI_MO. |
+ | At the same time the slave delivers data at SPI_MI (see figure above). | ||
+ | The so received byte is sent automatically on the TCP connection. | ||
+ | In this direction no escaping is used. | ||
Line 117: | Line 123: | ||
| T | 0x54 | Wait 1\ ms till processing of the next character. | 1.5 | | | T | 0x54 | Wait 1\ ms till processing of the next character. | 1.5 | | ||
| All others | Character is transparently transmitted. | | | All others | Character is transparently transmitted. | | ||
+ | |||
+ | |||
+ | ===== SPI master in single slave operation ===== | ||
+ | |||
+ | For using this SPI master in a single slave environment this example is provided here. | ||
+ | We assume that the slave is connected with the SPI_CS wire like shown below. | ||
+ | |||
+ | {{:en:netzer:spi_master_connection.gif|}} | ||
+ | |||
+ | The SPI_CS shall be low active - a low level selects the slave. | ||
+ | The pull up resistor at CS is needed to prevent false selection. | ||
+ | This may occur on power up if CS is not driven by Netzer. | ||
+ | The pull up resistor at SPI_MI is needed to prevent floating in case the slave is not selected and therefore the pin is not driven. | ||
+ | |||
+ | The data string <code>01 23 45 67 89</code> shall be sent to the SPI slave. | ||
+ | |||
+ | The command for controlling the SPI_CS line is an escape sequence consisting of two bytes: | ||
+ | <code>5c 69</code> for setting SPI_CS to low and | ||
+ | <code>5c 49</code> for setting SPI_CS to high. | ||
+ | |||
+ | The final code together: | ||
+ | <code>5c 69 01 23 45 67 89 5c 49</code> | ||