# Using SPI?

**URL:** <https://forums.digi.com/t/using-spi/5190>\
**Category:** NET+OS\
**Created:** [January 2, 2003, 8:16pm UTC](https://forums.digi.com/t/using-spi/5190 "2003-01-02T20:16:33Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/digi/original/1X/11da31a6a1fbcd03ef21d3f785c317c824009ae2.png) [@system](https://forums.digi.com/u/system)\
**Post date:** [January 2, 2003, 8:16pm UTC](https://forums.digi.com/t/using-spi/5190/1 "2003-01-02T20:16:33Z")

</div>

I’d like to use SPI. How do I set this up?

---

<div class="post-metadata">

**Author:** ![muscleman](https://avatars.discourse-cdn.com/v4/letter/m/f1d935/32.png) [@muscleman](https://forums.digi.com/u/muscleman)\
**Post date:** [January 3, 2003, 3:30pm UTC](https://forums.digi.com/t/using-spi/5190/2 "2003-01-03T15:30:45Z")

</div>

A serial port driver is supplied as part of the BSP. This device driver provides support for two synchronies serial ports implemented in the NET ARM chip. This driver supports Serial peripheral Interface (SPI) protocol. Detailed information is supplied in the HW reference guide and also in the sample example application “naspi”. Unlike well-defined asynchronies serial protocol (RS-232), SPI protocol is a proprietary specification used in the EEPROMs and some Robotic applications. This particular driver is designed ant tested using: SPI Serial EEPROM X25020 by XICOR. Direct Board-to-Board data transfer. The SPI driver for the serial port 1 will be included in the BSP library if the constant BSP\_INCLUDE\_SPI\_DRIVE\_1 is defined in h\bspconf.h. The SPI driver for port 2 will be included in the BSP library if the constant BSP\_INCLUDE\_SPI\_DRIVE\_2 is defined in h\bspconf.h. Because the RS-232 serial drivers and the SPI drivers use the same hardware, they are commonly exclusive. You cannot specify BSP\_INCLUDE\_SERIAL\_DRIVER\_1 and BSP\_INCLUDE\_SPI\_DRIVE\_1 at the same time. Likewise, you cannot specify BSP\_INCLUDE\_SERIAL\_DRIVER\_2 and BSP\_INCLUDE\_SPI\_DRIVE\_2 at the same time. Unlike RS-232 protocol that does not have notion about block of data, SPI protocol has a notion about block of data. As the result of this, one block of data must be sent (received) using a single write (read) operation. SPI protocol makes no distinguish between read or write operation. HW will send and receive one bit of the data with every clock signal. If device is holding high signal on it TXD port during the write operation, hardware will read 0XFF byte into the input FIFO buffer for every byte written. In order to prevent sending or receiving information that left over in the serial port registers, driver will reset serial port before each read or write operation. The SPI driver can support MASTER and SLAVE mode. When configure to be a master, ability to control more then one device is provided. Driver can support NET ARM 40 and NET ARM 50-1 chip. NET ARM 40 can control one device that requires desertion and reassertion of the SEL signal between each successive serial byte. NET ARM 50-1 cannot control such devices. When running on the NET ARM 50-1 SPI driver can control serial clock phase and polarity.

---

<div class="post-metadata">

**Author:** ![hjpinnix](https://avatars.discourse-cdn.com/v4/letter/h/8dc957/32.png) [@hjpinnix](https://forums.digi.com/u/hjpinnix)\
**Post date:** [January 20, 2004, 7:21pm UTC](https://forums.digi.com/t/using-spi/5190/3 "2004-01-20T19:21:33Z")

</div>

It there and example for the connect em? The naspi example doesn’t seem to be included with NET-OS 6.0

---

<div class="post-metadata">

**Author:** ![uriel](https://avatars.discourse-cdn.com/v4/letter/u/53a042/32.png) [@uriel](https://forums.digi.com/u/uriel)\
**Post date:** [November 13, 2003, 1:28am UTC](https://forums.digi.com/t/using-spi/5190/4 "2003-11-13T01:28:18Z")

</div>

My application needs to negotiate state using a handshake before invoking SPI Are there APIs for IO control? Where are the functions narm\_write\_reg / narm\_read\_reg documented?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/digi/original/1X/11da31a6a1fbcd03ef21d3f785c317c824009ae2.png) [@system](https://forums.digi.com/u/system)\
**Post date:** [February 16, 2004, 1:22pm UTC](https://forums.digi.com/t/using-spi/5190/5 "2004-02-16T13:22:03Z")

</div>

Where can I take a look at the device driver API:s, in general, and for SPI in particular ?

---

<div class="post-metadata">

**Author:** ![muscleman](https://avatars.discourse-cdn.com/v4/letter/m/f1d935/32.png) [@muscleman](https://forums.digi.com/u/muscleman)\
**Post date:** [November 13, 2003, 7:23pm UTC](https://forums.digi.com/t/using-spi/5190/6 "2003-11-13T19:23:23Z")

</div>

Check out the bsp api reference guide for this.

---

<div class="post-metadata">

**Author:** ![hjpinnix](https://avatars.discourse-cdn.com/v4/letter/h/8dc957/32.png) [@hjpinnix](https://forums.digi.com/u/hjpinnix)\
**Post date:** [January 20, 2004, 7:25pm UTC](https://forums.digi.com/t/using-spi/5190/7 "2004-01-20T19:25:18Z")

</div>

Is there an example for Connect EM on how set up and use the SPI mode? The naspi example doesn’t seem to be included with NET-OS 6.0.
