This has been tested with 128D EVB SPI connection is shown as following D3 -> 128D EVB pin 82 D4 -> 128D EVB pin 12 D5 -> 128D EVB pin 39
Diff: main.cpp
- Revision:
- 0:01dbd5035212
diff -r 000000000000 -r 01dbd5035212 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Nov 06 06:07:02 2017 +0000 @@ -0,0 +1,36 @@ +#include "mbed.h" + +SPI spi(D3, D4, D5); // mosi, miso, sclk +DigitalOut cs(D2); + +int main() { + // Chip must be deselected + cs = 1; + + // Setup the spi for 8 bit data, high steady state clock, + // second edge capture, with a 1MHz clock rate + spi.format(8,3); + spi.frequency(1000000); + + printf("Start application \r\n"); + // Select the device by seting chip select low + cs = 0; + + spi.write(0x5); + spi.write(0x20); + spi.write(0x00); + spi.write('A'); + spi.write('B'); + spi.write('C'); + + spi.write(0xFF); + spi.write(0xFE); + spi.write(0xFD); + spi.write(0xFC); + + wait_ms(100); + + // Deselect the device + cs = 1; + printf("End of application \r\n"); +} \ No newline at end of file