AnsweredAssumed Answered

SPISTA register is not working as expected

Question asked by drakesoft on Oct 17, 2012
Latest reply on Jan 23, 2013 by ADUzer

Hi, I have a problem with the SPISTA register. This is seemingly always 0. At least when I debug it. When I write during initialization in the SPITX register, then the return value of spi_send() is always the byte belongs to the previous transmission, but the transmission itself is correctly. What am I doing wrong?

 

void init_spi (uint32_t spi_clock) {       

    GP1CON |= (1<<17) | (1<<21) | (1<<25);

    SPICON = (1<<0) | (1<<1) | (1<<6) | (1<<8);

    spi_set_clock ( spi_clock ); 

    //SPITX = 0xFF;

}  

 

uint8_t spi_send ( uint8_t send_val ) {   

    SPITX = send_val;       

    while(!(SPISTA & (1<<8)));   

    return SPIRX;

}

 

Thank you for your help.

 


Outcomes