SPIFI setup for LPC1800/4300 using LPCXpresso 6, running on LPCXplorer board

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

SPIFI setup for LPC1800/4300 using LPCXpresso 6, running on LPCXplorer board

561 Views
lpcware
NXP Employee
NXP Employee

Content originally posted in LPCWare by bavarian on Mon Jan 13 05:39:16 MST 2014
Here are two projects for LPC1800 and for LPC4300 which use the SPIFI library under LPCXpresso 6.

- import the files into the workspace and make a 'Build all'
- SPIFI libraries compile without error under GCC
- Code runs from SPIFI, using the LPC1830/4330 LPCXplorer board
- function spifi_init(...) is used to initialize the SPIFI
- SPIFI speed is set to 90MHz
- some data is programmed into the qSPI
- after a successful SPIFI write the application runs into a blinky loop

Further notes:
- the code example uses the libraries coming with LPCXpresso, these are different to the new structure from LPCOpen. These libs are a little bit outdated and will not be maintained anymore.
- if you are doing any new code development, then you should consider to port the SPIFI setup from this example into the current LPCOpen platform
- NXP will add a SPIFI setup in one of the next LPCOpen releases for LPC1800/4300


Regards
NXP Support Team

Original Attachment has been moved to: LPC43xx_SPIFI_LPCXpresso6_1.zip

Original Attachment has been moved to: LPC18xx_SPIFI_LPCXpresso6_1.zip

Labels (1)
0 Kudos
4 Replies

389 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mc on Fri Jan 17 13:15:19 MST 2014
Hi Meyer,
Please read the document from below link for detail information about erasing and program functions.
http://www.lpcware.com/system/files/SPIFI_report%20v0.1.pdf
0 Kudos

389 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Meyer on Fri Jan 17 02:39:37 MST 2014
Thank u very much

This was not my problem. It works fine at 102Mhz for me . I forgot to link the lib in Ram.

Can u tell me what the function spifi_program() exactly do ? The comment
"//It is not needed to do spifi_erase before, because spifi_program automatically erases as necessary" is
not entirely clear. I guess it is not possible to erase as much as necessary. Correct me if I'm wrong.

Thx, regards
0 Kudos

389 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by wellsk on Tue Jan 14 09:33:21 MST 2014
You can setup the clock source and divider for SPIFI using the the following code.
Chip_Clock_SetDivider(CLK_IDIV_E, CLKIN_MAINPLL, 4); /* Pick a source and divider here to get as close as possible to your desired rate */
Chip_Clock_SetBaseClock(CLK_BASE_SPIFI, CLKIN_IDIVE, true, false); /* Attach SPIFI clock to CLK_IDIV_E */

In the above example, you can use Chip_Clock_SetDivider(CLK_IDIV_E, CLKIN_MAINPLL, 3) to set the SPIFI clock to 68MHz if usnig the 204MHz main system clock (typically PLL setup to 204MHz).
If you need to get closer to 90MHz, you can run the main system clock at 180MHz and use a divider of 2, or try to use a different source clock.

You might need to setup the pin muxing too. You can do it with this code...
/* SPIFI high speed pin mode setup */
STATIC const PINMUX_GRP_T spifipinmuxing[] = {
{0x3, 3,  (SCU_PINIO_FAST | SCU_MODE_FUNC3)},/* SPIFI CLK */
{0x3, 4,  (SCU_PINIO_FAST | SCU_MODE_FUNC3)},/* SPIFI D3 */
{0x3, 5,  (SCU_PINIO_FAST | SCU_MODE_FUNC3)},/* SPIFI D2 */
{0x3, 6,  (SCU_PINIO_FAST | SCU_MODE_FUNC3)},/* SPIFI D1 */
{0x3, 7,  (SCU_PINIO_FAST | SCU_MODE_FUNC3)},/* SPIFI D0 */
{0x3, 8,  (SCU_PINIO_FAST | SCU_MODE_FUNC3)}/* SPIFI CS/SSEL */
};
Chip_SCU_SetPinMuxing(spifipinmuxing, sizeof(spifipinmuxing) / sizeof(PINMUX_GRP_T));

0 Kudos

389 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Meyer on Tue Jan 14 09:00:27 MST 2014
Hey bavarian,

great example thx ;) But I´m using lpcopen 2.0 and the clock api is different. In the systemInit my Spifi clock is set to 102Mhz is it too much? How can i divide it ? can u help me plz.
0 Kudos