161007_BDK_EEPROM
Dependencies: mbed
Fork of 161006_BDK_SPImaster by
Diff: main.cpp
- Revision:
- 8:2599e5a13e05
- Parent:
- 7:d2710f5d6f66
--- 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]); }