AnsweredAssumed Answered

stm3f334 with software spi

Question asked by ASSAAD on Oct 29, 2015
Latest reply on Oct 29, 2015 by AvaTar
hello all ;
I need to use a software SPI in stm32f334 @ 72Mhz ;
the maximum software SPI I can get is 1Mhz ; but I need 4 MHZ SPI ;
could you tell me how to do that please ?
here my code that I use :
unsigned char readspi_data_adc(void )
  
{
unsigned char i,spidata=0;
  
for (i = 0; i < 8; i++) {
  
    spidata = spidata << 1;
      
        GPIOB->BSRR = ADC_SCLK ;
  
        GPIOB->BRR = ADC_SCLK ;
      
    spidata += (unsigned char)GPIO_ReadInputDataBit(ADC_DOUT_PORT, ADC_DOUT);
    }
return((unsigned char)spidata);   
}

Thank you in advanced

Outcomes