<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic LPC1837 with SPIFI in LPC Microcontrollers</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1837-with-SPIFI/m-p/666548#M26664</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to use the spifi memory as a storage for my data. I tried the example "lpcspifilib" which seems to work fine. Problem is when I only want to read the written data after the reset of the program. It reads only 0xFF like if the memory was erased. Any ideas what could be the problem?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for help.&lt;/P&gt;&lt;P&gt;Jan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 12 Jul 2017 13:26:31 GMT</pubDate>
    <dc:creator>jan92</dc:creator>
    <dc:date>2017-07-12T13:26:31Z</dc:date>
    <item>
      <title>LPC1837 with SPIFI</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1837-with-SPIFI/m-p/666548#M26664</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to use the spifi memory as a storage for my data. I tried the example "lpcspifilib" which seems to work fine. Problem is when I only want to read the written data after the reset of the program. It reads only 0xFF like if the memory was erased. Any ideas what could be the problem?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for help.&lt;/P&gt;&lt;P&gt;Jan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Jul 2017 13:26:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1837-with-SPIFI/m-p/666548#M26664</guid>
      <dc:creator>jan92</dc:creator>
      <dc:date>2017-07-12T13:26:31Z</dc:date>
    </item>
    <item>
      <title>Re: LPC1837 with SPIFI</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1837-with-SPIFI/m-p/666549#M26665</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;A _jive_internal="true" data-content-finding="Community" data-userid="286405" data-username="jan92" href="https://community.nxp.com/people/jan92"&gt;Jan Hakl&lt;/A&gt;,&lt;/P&gt;&lt;DIV style="color: #000000; font-family: 微软雅黑; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 21px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff;"&gt;&lt;SPAN style="background-color: #ffffff;"&gt;Thank you for your interest in NXP Semiconductor products and&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="color: #000000; font-family: 微软雅黑; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 21px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff;"&gt;&lt;SPAN style="background-color: #ffffff;"&gt;the opportunity to serve you.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="color: #000000; font-family: 微软雅黑; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 21px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff;"&gt;&lt;SPAN style="background-color: #ffffff;"&gt;I was wondering if you can tell me what SPIFI device you use and share the sample code you run.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="color: #000000; font-family: 微软雅黑; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 21px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff;"&gt;Have a great day,&lt;/DIV&gt;&lt;P&gt;TIC&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Jul 2017 02:19:39 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1837-with-SPIFI/m-p/666549#M26665</guid>
      <dc:creator>jeremyzhou</dc:creator>
      <dc:date>2017-07-13T02:19:39Z</dc:date>
    </item>
    <item>
      <title>Re: LPC1837 with SPIFI</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1837-with-SPIFI/m-p/666550#M26666</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jeremy,&lt;/P&gt;&lt;P&gt;It is the sample code: lpcspifilib&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First i run this code, which seems fine:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;static void RunExample(void)&lt;BR /&gt;{&lt;BR /&gt; uint32_t idx;&lt;BR /&gt; uint32_t spifiBaseClockRate;&lt;BR /&gt; uint32_t maxSpifiClock;&lt;BR /&gt; uint16_t libVersion;&lt;BR /&gt; uint32_t pageAddress;&lt;BR /&gt; uint32_t loopBytes;&lt;BR /&gt; uint32_t bytesRemaining;&lt;BR /&gt; uint32_t deviceByteCount;&lt;/P&gt;&lt;P&gt;SPIFI_HANDLE_T *pSpifi;&lt;BR /&gt; SPIFI_ERR_T errCode;&lt;BR /&gt; static uint32_t buffer[TEST_BUFFSIZE / sizeof(uint32_t)];&lt;BR /&gt; &lt;BR /&gt; /* Report the library version to start with */&lt;BR /&gt; libVersion = spifiGetLibVersion();&lt;BR /&gt; DEBUGOUT("\r\n\r\nSPIFI Lib Version %02d%02d\r\n", ((libVersion &amp;gt;&amp;gt; 8) &amp;amp; 0xff), (libVersion &amp;amp; 0xff));&lt;/P&gt;&lt;P&gt;/* set the blink rate while testing */&lt;BR /&gt; setLedBlinkRate(500);&lt;BR /&gt; &lt;BR /&gt; /* Setup SPIFI FLASH pin muxing (QUAD) */&lt;BR /&gt; Chip_SCU_SetPinMuxing(spifipinmuxing, sizeof(spifipinmuxing) / sizeof(PINMUX_GRP_T));&lt;/P&gt;&lt;P&gt;/* SPIFI base clock will be based on the main PLL rate and a divider */&lt;BR /&gt; spifiBaseClockRate = Chip_Clock_GetClockInputHz(CLKIN_MAINPLL);&lt;/P&gt;&lt;P&gt;/* Setup SPIFI clock to run around 1Mhz. Use divider E for this, as it allows&lt;BR /&gt; higher divider values up to 256 maximum) */&lt;BR /&gt; Chip_Clock_SetDivider(CLK_IDIV_E, CLKIN_MAINPLL, ((spifiBaseClockRate / 1000000) + 1));&lt;BR /&gt; Chip_Clock_SetBaseClock(CLK_BASE_SPIFI, CLKIN_IDIVE, true, false);&lt;BR /&gt; DEBUGOUT("SPIFI clock rate %d\r\n", Chip_Clock_GetClockInputHz(CLKIN_IDIVE));&lt;/P&gt;&lt;P&gt;/* Initialize the spifi library. This registers the device family and detects the part */&lt;BR /&gt; pSpifi = initializeSpifi();&lt;/P&gt;&lt;P&gt;/* Get some info needed for the application */&lt;BR /&gt; maxSpifiClock = spifiDevGetInfo(pSpifi, SPIFI_INFO_MAXCLOCK);&lt;/P&gt;&lt;P&gt;/* Get info */&lt;BR /&gt; DEBUGOUT("Device family = %s\r\n", spifiDevGetFamilyName(pSpifi));&lt;BR /&gt; DEBUGOUT("Capabilities = 0x%x\r\n", spifiDevGetInfo(pSpifi, SPIFI_INFO_CAPS));&lt;BR /&gt; DEBUGOUT("Device size = %d\r\n", spifiDevGetInfo(pSpifi, SPIFI_INFO_DEVSIZE));&lt;BR /&gt; DEBUGOUT("Max Clock Rate = %d\r\n", maxSpifiClock);&lt;BR /&gt; DEBUGOUT("Erase blocks = %d\r\n", spifiDevGetInfo(pSpifi, SPIFI_INFO_ERASE_BLOCKS));&lt;BR /&gt; DEBUGOUT("Erase block size = %d\r\n", spifiDevGetInfo(pSpifi, SPIFI_INFO_ERASE_BLOCKSIZE));&lt;BR /&gt; DEBUGOUT("Erase sub-blocks = %d\r\n", spifiDevGetInfo(pSpifi, SPIFI_INFO_ERASE_SUBBLOCKS));&lt;BR /&gt; DEBUGOUT("Erase sub-blocksize = %d\r\n", spifiDevGetInfo(pSpifi, SPIFI_INFO_ERASE_SUBBLOCKSIZE));&lt;BR /&gt; DEBUGOUT("Write page size = %d\r\n", spifiDevGetInfo(pSpifi, SPIFI_INFO_PAGESIZE));&lt;BR /&gt; DEBUGOUT("Max single readsize = %d\r\n", spifiDevGetInfo(pSpifi, SPIFI_INFO_MAXREADSIZE));&lt;BR /&gt; DEBUGOUT("Current dev status = 0x%x\r\n", spifiDevGetInfo(pSpifi, SPIFI_INFO_STATUS));&lt;BR /&gt; DEBUGOUT("Current options = %d\r\n", spifiDevGetInfo(pSpifi, SPIFI_INFO_OPTIONS));&lt;/P&gt;&lt;P&gt;/* Setup SPIFI clock to at the maximum interface rate the detected device&lt;BR /&gt; can use. This should be done after device init. */&lt;BR /&gt; Chip_Clock_SetDivider(CLK_IDIV_E, CLKIN_MAINPLL, ((spifiBaseClockRate / maxSpifiClock) + 1));&lt;/P&gt;&lt;P&gt;DEBUGOUT("SPIFI final Rate = %d\r\n", Chip_Clock_GetClockInputHz(CLKIN_IDIVE));&lt;BR /&gt; DEBUGOUT("\r\n");&lt;/P&gt;&lt;P&gt;/* start by unlocking the device */&lt;BR /&gt; DEBUGOUT("Unlocking device...\r\n");&lt;BR /&gt; errCode = spifiDevUnlockDevice(pSpifi);&lt;BR /&gt; if (errCode != SPIFI_ERR_NONE) {&lt;BR /&gt; fatalError("unlockDevice", errCode);&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;/* Next erase everything */&lt;BR /&gt; DEBUGOUT("Erasing device...\r\n");&lt;BR /&gt; errCode = spifiErase(pSpifi, 0, spifiDevGetInfo(pSpifi, SPIFI_INFO_ERASE_BLOCKS));&lt;BR /&gt; if (errCode != SPIFI_ERR_NONE) {&lt;BR /&gt; fatalError("EraseBlocks", errCode);&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;pageAddress = SPIFLASH_BASE_ADDRESS;&lt;BR /&gt; deviceByteCount = spifiDevGetInfo(pSpifi, SPIFI_INFO_DEVSIZE);&lt;/P&gt;&lt;P&gt;/* Enable quad. If not supported it will be ignored */&lt;BR /&gt; spifiDevSetOpts(pSpifi, SPIFI_OPT_USE_QUAD, true);&lt;/P&gt;&lt;P&gt;/* Enter memMode */&lt;BR /&gt; spifiDevSetMemMode(pSpifi, true);&lt;/P&gt;&lt;P&gt;DEBUGOUT("Verifying device erased...\r\n");&lt;BR /&gt; for (idx = 0; idx &amp;lt; deviceByteCount; idx += sizeof(uint32_t)) {&lt;BR /&gt; if ( ((uint32_t *) pageAddress)[(idx &amp;gt;&amp;gt; 2)] != 0xffffffff) {&lt;BR /&gt; fatalError("EraseDevice verify", SPIFI_ERR_GEN);&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt; spifiDevSetMemMode(pSpifi, false);&lt;/P&gt;&lt;P&gt;/* fill the buffer with 0x5a bytes */&lt;BR /&gt; for (idx = 0; idx &amp;lt; TEST_BUFFSIZE; ++idx) {&lt;BR /&gt; ((uint8_t *) buffer)[idx] = 0x5a;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;/* Get the maximum amount we can write and check against our buffer.&lt;BR /&gt; If larger, restrict to our buffer size */&lt;BR /&gt; loopBytes = spifiDevGetInfo(pSpifi, SPIFI_INFO_PAGESIZE);&lt;BR /&gt; if (loopBytes &amp;gt; TEST_BUFFSIZE) {&lt;BR /&gt; loopBytes = TEST_BUFFSIZE;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;pageAddress = spifiGetAddrFromBlock(pSpifi, 0);&lt;BR /&gt; bytesRemaining = spifiDevGetInfo(pSpifi, SPIFI_INFO_ERASE_BLOCKSIZE);&lt;/P&gt;&lt;P&gt;/* Write the Sector using the buffer */&lt;BR /&gt; DEBUGOUT("Writing Sector 0...\r\n");&lt;BR /&gt; while (bytesRemaining) {&lt;BR /&gt; if (loopBytes &amp;gt; bytesRemaining) {&lt;BR /&gt; loopBytes = bytesRemaining;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;errCode = spifiDevPageProgram(pSpifi, pageAddress, buffer, loopBytes);&lt;BR /&gt; if (errCode != SPIFI_ERR_NONE) {&lt;BR /&gt; fatalError("WriteBlock 0", errCode);&lt;BR /&gt; }&lt;BR /&gt; bytesRemaining -= loopBytes;&lt;BR /&gt; pageAddress += loopBytes;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;/* Get the maximum amount we can write and check against our buffer.&lt;BR /&gt; If larger, restrict to our buffer size */&lt;BR /&gt; loopBytes = spifiDevGetInfo(pSpifi, SPIFI_INFO_PAGESIZE);&lt;BR /&gt; if (loopBytes &amp;gt; TEST_BUFFSIZE) {&lt;BR /&gt; loopBytes = TEST_BUFFSIZE;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;pageAddress = spifiGetAddrFromBlock(pSpifi, 0);&lt;/P&gt;&lt;P&gt;bytesRemaining = spifiDevGetInfo(pSpifi, SPIFI_INFO_ERASE_BLOCKSIZE);&lt;/P&gt;&lt;P&gt;/* Read the sector and validate it using DevRead api*/&lt;BR /&gt; DEBUGOUT("Verifying Sector 0...\r\n");&lt;BR /&gt; while (bytesRemaining) {&lt;BR /&gt; if (loopBytes &amp;gt; bytesRemaining) {&lt;BR /&gt; loopBytes = bytesRemaining;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;errCode = spifiDevRead(pSpifi, pageAddress, buffer, loopBytes);&lt;BR /&gt; if (errCode != SPIFI_ERR_NONE) {&lt;BR /&gt; fatalError("WriteBlock 0", errCode);&lt;BR /&gt; }&lt;BR /&gt; /* Read the buffer and make sure it is programmed */&lt;BR /&gt; for (idx = 0; idx &amp;lt; loopBytes; ++idx) {&lt;BR /&gt; if (((uint8_t *) buffer)[idx] != 0x5a) {&lt;BR /&gt; fatalError("Verify block 0", SPIFI_ERR_GEN);&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt; bytesRemaining -= loopBytes;&lt;BR /&gt; pageAddress += loopBytes;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;/* Done, de-init will enter memory mode */&lt;BR /&gt; spifiDevDeInit(pSpifi);&lt;/P&gt;&lt;P&gt;/* indicate test complete serialy and with solid ON led */&lt;BR /&gt; DEBUGOUT("Complete.\r\n");&lt;BR /&gt; setLedBlinkRate(0);&lt;BR /&gt; &lt;BR /&gt; while (1) {&lt;BR /&gt; __WFI();&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Then I run the same code, but with commented erasing and writing functions. When I check the buffer&amp;nbsp;after reading, it is full of 0xFF instead of 0x5A.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;static void RunExample(void)&lt;BR /&gt;{&lt;BR /&gt; uint32_t idx;&lt;BR /&gt; uint32_t spifiBaseClockRate;&lt;BR /&gt; uint32_t maxSpifiClock;&lt;BR /&gt; uint16_t libVersion;&lt;BR /&gt; uint32_t pageAddress;&lt;BR /&gt; uint32_t loopBytes;&lt;BR /&gt; uint32_t bytesRemaining;&lt;BR /&gt; uint32_t deviceByteCount;&lt;/P&gt;&lt;P&gt;SPIFI_HANDLE_T *pSpifi;&lt;BR /&gt; SPIFI_ERR_T errCode;&lt;BR /&gt; static uint32_t buffer[TEST_BUFFSIZE / sizeof(uint32_t)];&lt;BR /&gt; &lt;BR /&gt; /* Report the library version to start with */&lt;BR /&gt; libVersion = spifiGetLibVersion();&lt;BR /&gt; DEBUGOUT("\r\n\r\nSPIFI Lib Version %02d%02d\r\n", ((libVersion &amp;gt;&amp;gt; 8) &amp;amp; 0xff), (libVersion &amp;amp; 0xff));&lt;/P&gt;&lt;P&gt;/* set the blink rate while testing */&lt;BR /&gt; setLedBlinkRate(500);&lt;BR /&gt; &lt;BR /&gt; /* Setup SPIFI FLASH pin muxing (QUAD) */&lt;BR /&gt; Chip_SCU_SetPinMuxing(spifipinmuxing, sizeof(spifipinmuxing) / sizeof(PINMUX_GRP_T));&lt;/P&gt;&lt;P&gt;/* SPIFI base clock will be based on the main PLL rate and a divider */&lt;BR /&gt; spifiBaseClockRate = Chip_Clock_GetClockInputHz(CLKIN_MAINPLL);&lt;/P&gt;&lt;P&gt;/* Setup SPIFI clock to run around 1Mhz. Use divider E for this, as it allows&lt;BR /&gt; higher divider values up to 256 maximum) */&lt;BR /&gt; Chip_Clock_SetDivider(CLK_IDIV_E, CLKIN_MAINPLL, ((spifiBaseClockRate / 1000000) + 1));&lt;BR /&gt; Chip_Clock_SetBaseClock(CLK_BASE_SPIFI, CLKIN_IDIVE, true, false);&lt;BR /&gt; DEBUGOUT("SPIFI clock rate %d\r\n", Chip_Clock_GetClockInputHz(CLKIN_IDIVE));&lt;/P&gt;&lt;P&gt;/* Initialize the spifi library. This registers the device family and detects the part */&lt;BR /&gt; pSpifi = initializeSpifi();&lt;/P&gt;&lt;P&gt;/* Get some info needed for the application */&lt;BR /&gt; maxSpifiClock = spifiDevGetInfo(pSpifi, SPIFI_INFO_MAXCLOCK);&lt;/P&gt;&lt;P&gt;/* Get info */&lt;BR /&gt; DEBUGOUT("Device family = %s\r\n", spifiDevGetFamilyName(pSpifi));&lt;BR /&gt; DEBUGOUT("Capabilities = 0x%x\r\n", spifiDevGetInfo(pSpifi, SPIFI_INFO_CAPS));&lt;BR /&gt; DEBUGOUT("Device size = %d\r\n", spifiDevGetInfo(pSpifi, SPIFI_INFO_DEVSIZE));&lt;BR /&gt; DEBUGOUT("Max Clock Rate = %d\r\n", maxSpifiClock);&lt;BR /&gt; DEBUGOUT("Erase blocks = %d\r\n", spifiDevGetInfo(pSpifi, SPIFI_INFO_ERASE_BLOCKS));&lt;BR /&gt; DEBUGOUT("Erase block size = %d\r\n", spifiDevGetInfo(pSpifi, SPIFI_INFO_ERASE_BLOCKSIZE));&lt;BR /&gt; DEBUGOUT("Erase sub-blocks = %d\r\n", spifiDevGetInfo(pSpifi, SPIFI_INFO_ERASE_SUBBLOCKS));&lt;BR /&gt; DEBUGOUT("Erase sub-blocksize = %d\r\n", spifiDevGetInfo(pSpifi, SPIFI_INFO_ERASE_SUBBLOCKSIZE));&lt;BR /&gt; DEBUGOUT("Write page size = %d\r\n", spifiDevGetInfo(pSpifi, SPIFI_INFO_PAGESIZE));&lt;BR /&gt; DEBUGOUT("Max single readsize = %d\r\n", spifiDevGetInfo(pSpifi, SPIFI_INFO_MAXREADSIZE));&lt;BR /&gt; DEBUGOUT("Current dev status = 0x%x\r\n", spifiDevGetInfo(pSpifi, SPIFI_INFO_STATUS));&lt;BR /&gt; DEBUGOUT("Current options = %d\r\n", spifiDevGetInfo(pSpifi, SPIFI_INFO_OPTIONS));&lt;/P&gt;&lt;P&gt;/* Setup SPIFI clock to at the maximum interface rate the detected device&lt;BR /&gt; can use. This should be done after device init. */&lt;BR /&gt; Chip_Clock_SetDivider(CLK_IDIV_E, CLKIN_MAINPLL, ((spifiBaseClockRate / maxSpifiClock) + 1));&lt;/P&gt;&lt;P&gt;DEBUGOUT("SPIFI final Rate = %d\r\n", Chip_Clock_GetClockInputHz(CLKIN_IDIVE));&lt;BR /&gt; DEBUGOUT("\r\n");&lt;/P&gt;&lt;P&gt;/* start by unlocking the device */&lt;BR /&gt; DEBUGOUT("Unlocking device...\r\n");&lt;BR /&gt; errCode = spifiDevUnlockDevice(pSpifi);&lt;BR /&gt; if (errCode != SPIFI_ERR_NONE) {&lt;BR /&gt; fatalError("unlockDevice", errCode);&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;/* Next erase everything */&lt;BR /&gt; /*DEBUGOUT("Erasing device...\r\n");&lt;BR /&gt; errCode = spifiErase(pSpifi, 0, spifiDevGetInfo(pSpifi, SPIFI_INFO_ERASE_BLOCKS));&lt;BR /&gt; if (errCode != SPIFI_ERR_NONE) {&lt;BR /&gt; fatalError("EraseBlocks", errCode);&lt;BR /&gt; }*/&lt;/P&gt;&lt;P&gt;pageAddress = SPIFLASH_BASE_ADDRESS;&lt;BR /&gt; deviceByteCount = spifiDevGetInfo(pSpifi, SPIFI_INFO_DEVSIZE);&lt;/P&gt;&lt;P&gt;/* Enable quad. If not supported it will be ignored */&lt;BR /&gt; spifiDevSetOpts(pSpifi, SPIFI_OPT_USE_QUAD, true);&lt;/P&gt;&lt;P&gt;/* Enter memMode */&lt;BR /&gt; spifiDevSetMemMode(pSpifi, true);&lt;/P&gt;&lt;P&gt;/*DEBUGOUT("Verifying device erased...\r\n");&lt;BR /&gt; for (idx = 0; idx &amp;lt; deviceByteCount; idx += sizeof(uint32_t)) {&lt;BR /&gt; if ( ((uint32_t *) pageAddress)[(idx &amp;gt;&amp;gt; 2)] != 0xffffffff) {&lt;BR /&gt; fatalError("EraseDevice verify", SPIFI_ERR_GEN);&lt;BR /&gt; }&lt;BR /&gt; }*/&lt;BR /&gt; spifiDevSetMemMode(pSpifi, false);&lt;/P&gt;&lt;P&gt;/* fill the buffer with 0x5a bytes */&lt;BR /&gt; for (idx = 0; idx &amp;lt; TEST_BUFFSIZE; ++idx) {&lt;BR /&gt; ((uint8_t *) buffer)[idx] = 0x5a;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;/* Get the maximum amount we can write and check against our buffer.&lt;BR /&gt; If larger, restrict to our buffer size */&lt;BR /&gt; loopBytes = spifiDevGetInfo(pSpifi, SPIFI_INFO_PAGESIZE);&lt;BR /&gt; if (loopBytes &amp;gt; TEST_BUFFSIZE) {&lt;BR /&gt; loopBytes = TEST_BUFFSIZE;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;pageAddress = spifiGetAddrFromBlock(pSpifi, 0);&lt;BR /&gt; bytesRemaining = spifiDevGetInfo(pSpifi, SPIFI_INFO_ERASE_BLOCKSIZE);&lt;/P&gt;&lt;P&gt;/* Write the Sector using the buffer */&lt;BR /&gt; DEBUGOUT("Writing Sector 0...\r\n");&lt;BR /&gt; while (bytesRemaining) {&lt;BR /&gt; if (loopBytes &amp;gt; bytesRemaining) {&lt;BR /&gt; loopBytes = bytesRemaining;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;//errCode = spifiDevPageProgram(pSpifi, pageAddress, buffer, loopBytes);&lt;BR /&gt; if (errCode != SPIFI_ERR_NONE) {&lt;BR /&gt; fatalError("WriteBlock 0", errCode);&lt;BR /&gt; }&lt;BR /&gt; bytesRemaining -= loopBytes;&lt;BR /&gt; pageAddress += loopBytes;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;/* Get the maximum amount we can write and check against our buffer.&lt;BR /&gt; If larger, restrict to our buffer size */&lt;BR /&gt; loopBytes = spifiDevGetInfo(pSpifi, SPIFI_INFO_PAGESIZE);&lt;BR /&gt; if (loopBytes &amp;gt; TEST_BUFFSIZE) {&lt;BR /&gt; loopBytes = TEST_BUFFSIZE;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;pageAddress = spifiGetAddrFromBlock(pSpifi, 0);&lt;BR /&gt; bytesRemaining = spifiDevGetInfo(pSpifi, SPIFI_INFO_ERASE_BLOCKSIZE);&lt;/P&gt;&lt;P&gt;/* Read the sector and validate it using DevRead api*/&lt;BR /&gt; DEBUGOUT("Verifying Sector 0...\r\n");&lt;BR /&gt; while (bytesRemaining) {&lt;BR /&gt; if (loopBytes &amp;gt; bytesRemaining) {&lt;BR /&gt; loopBytes = bytesRemaining;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;errCode = spifiDevRead(pSpifi, pageAddress, buffer, loopBytes);&lt;BR /&gt; if (errCode != SPIFI_ERR_NONE) {&lt;BR /&gt; fatalError("WriteBlock 0", errCode);&lt;BR /&gt; }&lt;BR /&gt; /* Read the buffer and make sure it is programmed */&lt;BR /&gt; for (idx = 0; idx &amp;lt; loopBytes; ++idx) {&lt;BR /&gt; if (((uint8_t *) buffer)[idx] != 0x5a) {&lt;BR /&gt; fatalError("Verify block 0", SPIFI_ERR_GEN);&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt; bytesRemaining -= loopBytes;&lt;BR /&gt; pageAddress += loopBytes;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;/* Done, de-init will enter memory mode */&lt;BR /&gt; spifiDevDeInit(pSpifi);&lt;/P&gt;&lt;P&gt;/* indicate test complete serialy and with solid ON led */&lt;BR /&gt; DEBUGOUT("Complete.\r\n");&lt;BR /&gt; setLedBlinkRate(0);&lt;BR /&gt;&lt;BR /&gt; while (1) {&lt;BR /&gt; __WFI();&lt;BR /&gt; }&lt;BR /&gt;}&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you so much for help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Jul 2017 07:19:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1837-with-SPIFI/m-p/666550#M26666</guid>
      <dc:creator>jan92</dc:creator>
      <dc:date>2017-07-14T07:19:15Z</dc:date>
    </item>
    <item>
      <title>Re: LPC1837 with SPIFI</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1837-with-SPIFI/m-p/666551#M26667</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;A _jive_internal="true" class="" data-content-finding="Community" data-userid="286405" data-username="jan92" href="https://community.nxp.com/people/jan92"&gt;Jan Hakl&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;Please refer to the user guide for checking.&lt;BR /&gt;Have a great day,&lt;BR /&gt;TIC&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Jul 2017 08:26:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1837-with-SPIFI/m-p/666551#M26667</guid>
      <dc:creator>jeremyzhou</dc:creator>
      <dc:date>2017-07-17T08:26:15Z</dc:date>
    </item>
  </channel>
</rss>

