From 2a8da387f75f8e58cf683733ceae6b211de2b38c Mon Sep 17 00:00:00 2001 From: Kevin Townsend Date: Mon, 3 Oct 2011 22:06:13 +0200 Subject: [PATCH] Updated SPI flash example --- build/crossworks/LPC1343_CodeBase.hzs | 8 ++++---- tools/examples/spiflash/erase_write_read/main.c | 12 ++++++++++-- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/build/crossworks/LPC1343_CodeBase.hzs b/build/crossworks/LPC1343_CodeBase.hzs index fea48a7..f4373df 100644 --- a/build/crossworks/LPC1343_CodeBase.hzs +++ b/build/crossworks/LPC1343_CodeBase.hzs @@ -52,10 +52,10 @@ - - - + + + @@ -68,7 +68,7 @@ - + diff --git a/tools/examples/spiflash/erase_write_read/main.c b/tools/examples/spiflash/erase_write_read/main.c index 76fb3c4..4704a9f 100644 --- a/tools/examples/spiflash/erase_write_read/main.c +++ b/tools/examples/spiflash/erase_write_read/main.c @@ -88,7 +88,7 @@ int main(void) } } - printf("Writing 8 bytes to page 0 (bytes 0..7)\r\n"); + printf("Writing 8 bytes to page 0 starting at address 0x04 (byte 5)\r\n"); buffer[0] = 0x12; buffer[1] = 0x34; buffer[2] = 0x56; @@ -97,7 +97,7 @@ int main(void) buffer[5] = 0xCD; buffer[6] = 0xEF; buffer[7] = 0xAA; - error = spiflashWritePage (0, buffer, 8); + error = spiflashWritePage (0x04, buffer, 8); if (error) { // Check what went wrong @@ -131,6 +131,14 @@ int main(void) buffer[5] = 0; buffer[6] = 0; buffer[7] = 0; + buffer[8] = 0; + buffer[9] = 0; + buffer[10] = 0; + buffer[11] = 0; + buffer[12] = 0; + buffer[13] = 0; + buffer[14] = 0; + buffer[15] = 0; error = spiflashReadBuffer (0, buffer, 16); if (error) { -- 2.20.1