SPI1 CR0 CR1 not writable

07 Nov 2012

Hi,

I write a function, content is :

	printf("%x %x %x %x %x %x %x %x\n\r", LPC_IOCON->PIO1_20, LPC_IOCON->PIO1_21, LPC_IOCON->PIO1_22, LPC_SYSCON->SYSAHBCLKCTRL, LPC_SYSCON->SSP1CLKDIV, LPC_SYSCON->PRESETCTRL, LPC_SSP1->CR0, LPC_SSP1->CR1);
	LPC_IOCON->PIO1_20 |= 0x2;
	LPC_IOCON->PIO1_21 |= 0x2;
	LPC_IOCON->PIO1_22 |= 0x2;
	LPC_SYSCON->SYSAHBCLKCTRL |= 0x400;
	LPC_SYSCON->SSP1CLKDIV = 2;
	LPC_SYSCON->PRESETCTRL |= 0x4;
	LPC_SSP1->CR0 |= 0xc7;
	LPC_SSP1->CR1 |= 0x2;
	printf("%x %x %x %x %x %x %x %x\n\r", LPC_IOCON->PIO1_20, LPC_IOCON->PIO1_21, LPC_IOCON->PIO1_22, LPC_SYSCON->SYSAHBCLKCTRL, LPC_SYSCON->SSP1CLKDIV, LPC_SYSCON->PRESETCTRL, LPC_SSP1->CR0, LPC_SSP1->CR1);

The result is:

90 90 90 801585f 0 0 0 0
92 92 92 8015c5f 2 4 0 0

I follow the procedure in the User Manual, but CR0 and CR2 can not write.

Why?

Thank you,

Cid

07 Nov 2012

my bad, should be

LPC_SYSCON->SYSAHBCLKCTRL |= 0x40000;