This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

SPI on the ezDSP with 5505 (rev. C)

Hi, i try to play with an lcd connected to SPI on the expansionslot.

The only thing wich work is the datapin.  The CS1 is permanently high, and CLK permanently low.

Whats wron with my code?

 


void spi_init(void){
    volatile Uint16 delay, tmp;
   
    SPI_REG_CDR = 199; // divider
    SPI_REG_CCR = (1<<15); //clock enable
    //              delay   CS lowactive 
    SPI_REG_DCR1 = (3<<11) | (1<<8);
    PCGCR1 &=~(0x0002);
    PSRCR = 4;

    PRCR |=0x0080;
    for(delay = 0; delay < 100; delay++);
   
    tmp=EBSR&0x0fff;
    EBSR = tmp | 0x6000;       

}
void spi_tx(Int16 value){

    unsigned short i;

    //8 bit write
    SPI_REG_CMD1 = 0x0000;         //1 character
    SPI_REG_DAT2 = value << 8;
    SPI_REG_DAT1 = 0x0000;
    SPI_REG_CMD2 = 0x003A;         //CS0, 8 bits per character, write
    i=0;
    while(SPI_REG_STAT1 & 0x0002 == 0) { if(i++ == 0xFFFF) {break;} }    //wait for CC=1
    i=0;
    while(SPI_REG_STAT1 & 0x0001 != 0) { if(i++ == 0xFFFF) {break;} }    //wait for BUSY=0

}