Hi,
i ran in some problems using rlp on my cobra to send data over spi.
i collect all informations from the forum here and the example files from nxp.
using ghi’s rlp is not the problem. so here my code for spi init and spi writing :
void SPIInit()
{
PCONP |= (1 << 8); /* by default, it's enabled already, for safety reason */
S0SPCR = 0x00;
/* Port 0.15 SPI SCK, port0.16 uses GPIO SPI_SEL,
port0.17 MISO, port0.18 MOSI */
//PINSEL0 |= 0xC0000000;
PINSEL0 |= (0x02UL << 14) | (0x02UL << 18);
SSP0CPSR = 254; // SSP max speed
/* Setting SPI0 clock, for Atmel SEEPROM, SPI clock should be no more
than 3Mhz on 4.5V~5.5V, no more than 2.1Mhz on 2.7V~5.5V */
S0SPCCR = 0x8;
S0SPCR = SPI0_MSTR;
return;
}
void WriteSPI(unsigned char* buf, unsigned int Length)
{
unsigned int i;
if ( Length == 0 )
return;
for ( i = 0; i < Length; i++ )
{
RLPext->Delay(5);
S0SPDR = *buf;
while ( !(S0SPSR & SPIF) );
buf++;
}
//Debug_println_STR("SPIWrite Ok)");
return;
}
sending only some bytes is functional, sending a byte array of , for example, 384 bytes crashes the system. you can see the delay i insert, with this delay all run, without crashes. why ?? any hints ??
and what are the importent register settings in the spi init for only sending data bytes as fast as possible ?
cu
Andreas