AnsweredAssumed Answered


Question asked by M N on Jan 27, 2017
Latest reply on May 16, 2017 by


I have problem by SPI that is :

When i want to send data for example in slave mode during receiving from master. data will corrupt ( if i just receive data and send to UART it works fine). I think it happens Because both TXE and RXNE occurs at same time and when MCU is in ISR data will rewrite in data register before transfer to Tx/Rx buffer  . How can i Handle this in continuous transmission ?  . it's my code :


//Slave Part

void SPI2_IRQHandler(void){ 

static char counter = 0x40;

            if ( SPI2->SR & SPI_SR_RXNE ) {   
            if ( SPI2->SR & SPI_SR_TXE ) {               
                SPI2->DR = counter;
                if(counter >= 0x5B)counter=0x40;