This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

SPI init problem

Hi,
I have a LPC2294 board. When I try to init SPI program crashes. OS is RL-ARM and spi_init function executes "SSPCR0 = 0x00C7;" instruction in simulator then it gives the folloving error:
"Data Abort: Thumb Instruction at 00000C7EH, Memory Access at E005C000H"

void spi_init (void) {
   /* Initialize and enable the SSP Interface module. */
   U32 i;

   /* SSEL is GPIO, output set to high. */
   IODIR0  |= 1<<20;              // OK
   IOSET0   = 1<<20;              // OK
   /* SCK1, MISO1, MOSI1 are SSP pins. */
   PINSEL1  = (PINSEL1 & ~0x000003FC) | 0x000000A8;

   /* Enable SPI in Master Mode, CPOL=1, CPHA=1 (Clock low-active). */
   SSPCR0 = 0x00C7; //!!!!!CRASHES HERE
   SSPCR1 = 0x0002;
   SSPCPSR = 0xFE;
   /* Send SPI Command with card not selected at 400 KBit. */
   for (i = 0; i < 16; i++) {
      spi_send (0xFF);
   }

   /* Enable SSP auto select. */
   PINSEL1 |= 0x00000200;
}

0