# \[Resources\] BW16 Ameba SPI Example Running Guide

**URL:** <https://forum.amebaiot.com/t/resources-bw16-ameba-spi-example-running-guide/716>\
**Category:** Arduino\
**Created:** [August 5, 2021, 12:22pm UTC](https://forum.amebaiot.com/t/resources-bw16-ameba-spi-example-running-guide/716 "2021-08-05T12:22:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dakamaster](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.amebaiot.com/dakamaster/32/1744_2.png) [@dakamaster](https://forum.amebaiot.com/u/dakamaster)\
**Post date:** [August 5, 2021, 12:22pm UTC](https://forum.amebaiot.com/t/resources-bw16-ameba-spi-example-running-guide/716/1 "2021-08-05T12:22:50Z")

</div>

# BW16 Ameba SPI Example Running Guide

## Require Material

- [Adafruit 2.8" TFT Touch Shield v2](https://learn.adafruit.com/adafruit-2-8-tft-touch-shield-v2?view=all#connecting)
- [BW16 (RTL8720DN)](https://forum.amebaiot.com/t/resources-bw16-getting-start-guide/683)
- Jumper Wires

* * *

## Connection Pinouts

### Adafruit 2.8" TFT Touch Shield v2

Since Adafruit 2.8" TFT Touch Shield shares the same pin map with Arduino UNO:

 ![1](https://us1.discourse-cdn.com/flex016/uploads/ameba/original/1X/beb08cb7a9ab40bf95082e733ba70bc66361d338.jpeg)

 ![2](https://us1.discourse-cdn.com/flex016/uploads/ameba/original/1X/79285b91b6a9851d46cdce63f40c9f56a479f01c.jpeg)

Therefore, pin configuration for the Touch Shield can be organized as the chart below:

| Adadruit TFT Touch Shield | Function |
| --- | --- |
| 8 | RST |
| 9 | DC (Data/Command select) |
| 10 | CS (Chip Select) |
| 11 | MOSI |
| 12 | MISO |
| 13 | CLK |

### RTL8720DN BW16

**Step 1**  
Following the **[BW16 Getting Started guide](https://forum.amebaiot.com/t/resources-bw16-getting-start-guide/683)** `Step 1` and `Step 2` to set up the Arduino IDE.

**Step 2**  
Go to:  
“_ **C:\Users\USER\_NAME\AppData\Local\Arduino15\packages\realtek\hardware\AmebaD\3.0.8\variants\rtl8720dn\_bw16\variant.h** _”, and check for the pin configurations for RTL8720DN BW16 development board.

 ![3](https://us1.discourse-cdn.com/flex016/uploads/ameba/original/1X/6f822b71078afee72cd468f1026e4ee71b032ae9.jpeg)

**Step 3**  
We will get the pin connections from BW16 to Adadruit TFT Touch Shield showing in the table and figure below:

 ![4](https://us1.discourse-cdn.com/flex016/uploads/ameba/original/1X/fa0a72ef59df0ee1df0c15fd1d2688e86829660a.jpeg)

| BW16 | | Adadruit TFT Touch Shield | |
| --- | --- | --- | --- |
| PA27 | 2 | 8 | RST |
| PA26 | 8 | 9 | DC (data/command select) pin |
| PA15 | 9 | 10 | CS (chip select) pin |
| PA12 | 12 | 11 | MOSI |
| PA13 | 11 | 12 | MISO |
| PA14 | 10 | 13 | CLK |

> Note that this method has only been tested on Arduino SDK version v3.0.8

* * *

## Program Modification

Ameba SPI

**Step 2**  
Open Arduino IDE and locate to “ILI8341\_TFT\_LCD\_basic.ino”:

 ![5](https://us1.discourse-cdn.com/flex016/uploads/ameba/original/1X/6b04e4e17b787eb0fd004b852a4da5a5f883a965.jpeg)

Add in Line 32 to 35 configuration for BW16:

 ![6](https://us1.discourse-cdn.com/flex016/uploads/ameba/original/1X/99a28b4fa467c6ca35e03991ee3386b6bbabb847.jpeg)

Compile and upload the example to BW16, after the uploading procedure is done successfully, press the `Reset` button, you will see the example successfully executing in the video below:

[![BW16 Ameba SPI Example](https://us1.discourse-cdn.com/flex016/uploads/ameba/original/1X/bd79f18ceb49b6f23949ca531c855ba46016f4c4.jpeg)](https://www.youtube.com/watch?v=TwoMbaga8YE)
