# SPI0 Send

**URL:** <https://community.sparkfun.com/t/spi0-send/2654>\
**Category:** MicroMod\
**Tags:** arm-lpc\
**Created:** [September 11, 2006, 4:52am UTC](https://community.sparkfun.com/t/spi0-send/2654 "2006-09-11T04:52:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![seema](https://avatars.discourse-cdn.com/v4/letter/s/7cd45c/32.png) [@seema](https://community.sparkfun.com/u/seema)\
**Post date:** [September 11, 2006, 4:52am UTC](https://community.sparkfun.com/t/spi0-send/2654/1 "2006-09-11T04:52:44Z")

</div>

Hi

Can anyone see the problem with the following:

uint32\_t SPI\_Send(uint32\_t byte)

{

/\* Transmits data to the SPI bus and waits until the end of SPI data transmission. \*/

SPI\_SPDR = byte; // Data is sent

while (!(SPI\_SPSR & 0x08)); // Wait till end of transmission

SPI\_SPSR &= ~0x80; // Clear the ARM SPI interrupt flag

return SPI\_SPDR; // Receive data on SPI Read

}

When I debug it just sits on that ‘while’ loop.

---

<div class="post-metadata">

**Author:** ![lpcH2129](https://avatars.discourse-cdn.com/v4/letter/l/48db29/32.png) [@lpcH2129](https://community.sparkfun.com/u/lpcH2129)\
**Post date:** [September 11, 2006, 6:39am UTC](https://community.sparkfun.com/t/spi0-send/2654/2 "2006-09-11T06:39:23Z")

</div>

hello

if your code is blocked on the loop it is that the register of state is never equal 0x80, therefore your SPI does not work!!

I have a code SPI on LPC2129 which works fine well if you wants it!

look at your Doc. well if there is not particular configuration for the SSEL PIN

for the lpc2129 it is necessary to put this PIN to 3.3v for the master mode

---

<div class="post-metadata">

**Author:** ![seema](https://avatars.discourse-cdn.com/v4/letter/s/7cd45c/32.png) [@seema](https://community.sparkfun.com/u/seema)\
**Post date:** [September 11, 2006, 10:55am UTC](https://community.sparkfun.com/t/spi0-send/2654/3 "2006-09-11T10:55:57Z")

</div>

Hi

Wow thanks…now it makes sense! My SSEL pin isn’t connected to 3.3V…and I will leave it just to keep my options open…

You are right…i just had a look at my SPI\_Init code and I think there is something wrong with it…maybe i havent initialised the SPI properly…there is no SCK pulse…

PINSEL0 = 0x001500

what should the other registers be kept to make sure it’s in master mode?

Do you have any code for SPI0 initialiation? I am using an LPC2148 chip…
