Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

Re: [lpc2000] accesing SPI registers

2005-05-25 by Brett Delmage

Jaromir wrote:

> Hello ALL,
>
> I should writing and reading SPI registers as 8-bit or as 32-bit 
> registers?
> LPC is 32bit, but SPI registers have 8 bit.
>
Top of page 183 of LPC2119/2129/2194/2294 manual:

"The SPI contains 5 registers as shown in Table 115. All registers are 
byte, half word and word accessible"

Coincidently, just yesterday I tried modifying my code from REG8 
(unsigned char) to REG32 (unsigned int) to see what effect this would 
have on the assembler, if any.
The assember was the same size and the code ran fine in both cases.

Just remember that the SPI DATA register, and Clock Counter and 
Interrupt registers only have one byte of defined data.

This may vary for other LPC parts in the 21/22 series, so check before 
jumping :-)

Now, can anyone tell me if there is clean, way to generate faster code than:

#define REG(addr) (*(volatile unsigned long *)(addr))
#define REG8(addr) (*(volatile char *)(addr))

in gcc? I don't like the multiple instruction to generate the address 
each access, but maybe that is typical/not bad. I'm
relatively new to ARM and RISC.

   Brett

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.