Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Fork of 161006_BDK_SPImaster by
Revision 8:2599e5a13e05, committed 2016-10-10
- Comitter:
- gandol2
- Date:
- Mon Oct 10 07:51:11 2016 +0000
- Parent:
- 7:d2710f5d6f66
- Commit message:
- 161010_bug fix multi byte read
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Fri Oct 07 08:16:15 2016 +0000
+++ b/main.cpp Mon Oct 10 07:51:11 2016 +0000
@@ -1,3 +1,11 @@
+// firmware for NUCLEO-F746ZG
+// ======== SPI Master Pin
+// PA5 - SCK
+// PA6 - MISO
+// PA7 - MOSI
+// PA14 - SEL
+
+
#include "mbed.h"
#include <SPI.h>
@@ -7,10 +15,10 @@
#define PRINTD(arg1,arg2...) printf(arg1,##arg2)
#endif
-
+// ======== SPI Master Pin define
+#define SPI_SCLK PA_5
+#define SPI_MISO PA_6
#define SPI_MOSI PA_7
-#define SPI_MISO PA_6
-#define SPI_SCLK PA_5
#define SPI_SSEL PA_4
SPI spi_master(SPI_MOSI,SPI_MISO,SPI_SCLK); // MOSI, MISO, SCLK(CLK,SCK)
@@ -435,15 +443,16 @@
spi_master.write(eepAddr);
- for(int i=0;i<10;i++)
+ for(int i=0;i<5;i++)
{
+ wait_ms(10);
//test_data[i] = spi_master.write(0);
//spi_master.write(++eepAddr);
- test_data[i] = spi_master.write(0);
+ test_data[i] = spi_master.write(0); // dummy write
}
- for(int i=0;i<10;i++)
+ for(int i=0;i<5;i++)
{
printf("\n[DEBUG] Read EEPROM Data[0x%02X]\n",test_data[i]);
}
