Yahoo Groups archive

Lpc2000

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

Message

Re: accesing SPI registers

2005-05-25 by Thiadmer Riemersma (ITB CompuPhase)

> I should writing and reading SPI registers as 8-bit or as 32-bit
registers?
> LPC is 32bit, but SPI registers have 8 bit. 

You can access them as 32-bit, but it is wisest to only write zeros in
the undefined bits. Even though some registers are only 8-bit, they
are always spaced apart by 4 bytes.

The header files that come with the GNU-ARM toolchain specify all
registers as REG32. I experimented with setting the proper register
size in the header files (using REG8 for an 8-bit register). When
checking the assembly code, there now were more instructions to read
or write a register. I guess this is why the maintainers of the GNU
ARM toolchain chose to use REG32 exclusively.

By the way, this trick only works in  Little Endian. The LPC2000
series initializes the ARM7 core in Little Endian, but other
controllers may use Big Endian.

Kind regards,
Thiadmer

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.