AnsweredAssumed Answered

SSP not working (not signals out) SOLVED

Question asked by lpcware Employee on Jun 15, 2016
Content originally posted in LPCWare by fjrg76 on Sun May 03 17:18:18 MST 2015
Hi

I've been struggling with the SSP block since few weeks. In order to keep my project moving on I implemented bit-banging SPI. But I need the SPI working for this and any other project that needs that interface.

I've tried some diferents codes, but none has given results. I'm pretty shure I'm missing something trivial, but I can't see what it is. The next code is the last I've tried:

void Delay(uint32_t ticks)
{
volatile uint32_t i;

for (; ticks > 0; --ticks) {
for (i = 1000; i > 0; --i) {
__NOP();
}
}
}

int main(void)
{
SSP_InitTypeDef spi;
SSP_StructInit(&spi);
SSP_Init(&spi);
// spi estándar config

SSP_SetClockRate(1000000);
// clock rate a 1MHz

IOCON_PIO_CFG_Type io;
IOCON_StructInit(&io);
io.type = IOCON_PIO_0_14; IOCON_SetFunc(&io);
//sck

io.type = IOCON_PIO_0_17; IOCON_SetFunc(&io);
// mosi

SSP_Cmd(ENABLE); // (1)

while (1)
{
SSP_SendData(0xaa);
//while (SSP_GetStatus(SSP_STATUS_TFE) == RESET) ;
                // I've commented this line in order no to mess right now with those flags
                // Anyway they are not helping at all

Delay(100);
                // I guess this is enough time for a byte to go out
                // Board is running at 12MHz
}
    return 0 ;
}


After the line marked with (1) is passed these are the values taken for the most important registers in the SSP block:

CR0 = 0xB07
CR1 = 0x2
SR = 0x3
CPSR = 0x2

All of them seems to be Ok, but I get nothing in the output (SCK and MOSI). I remember an errata from the elder LPC2129 in which the SSEL pin must be configured as part of the SPI (in oposition of letting it as gpio in master mode). Would be the same case?

In order to be easier to read the dozens bits while configuring the SSP block I took some notes and those are attached.

Any help or idea is welcomed. Thank you!

Attachments

Outcomes