Content originally posted in LPCWare by NickAtKandevsys on Mon Feb 17 05:26:36 MST 2014
Hi MC,
The information in the link looks promising. However, I hit a problem trying to examine the SPIFI flash controller registers. I wanted to see what values they had been set to by the boot loader.
I defined the structure below - it was missing from the board support package I have.
typedef struct { /*!< (@ 0x40003000) SPIFI Structure */
__IO uint32_t CTRL; /*!< (@ 0x40003000) Control register */
__IO uint32_t CMD; /*!< (@ 0x40003004) Command register */
__IO uint32_t ADDR; /*!< (@ 0x40003008) Address register */
__IO uint32_t IDATA; /*!< (@ 0x4000300C) Intermediate data register */
__IO uint32_t CLIMIT; /*!< (@ 0x40003010) cache limit register */
__IO uint32_t DATA; /*!< (@ 0x40003014) data register */
__IO uint32_t MCMD; /*!< (@ 0x40003018) memory command register */
__IO uint32_t STAT; /*!< (@ 0x4000301C) status register */
} LPC_SPIFI_Type;
#define LPC_SPIFI_BASE 0x40003000
#define LPC_SPIFI ((LPC_SPIFI_Type *) LPC_SPIFI_BASE)
volatile LPC_SPIFI_Type *psSPIFI = LPC_SPIFI;
I then let my code boot from SPIFI flash and place a breakpoint at a point where psSPIFI is valid. However, when I try and dereference the pointer to see what values the registers currently have I see 0xfefefefe in all members. eg:
CTRL: 0xfefefefe
CMD: 0xfefefefe
This doesn't make any sense, to me. Do I have to do something extra to enable the registers to be read? If so does the spi_rom_api library take care of that setup?
Thanks
Nick