Skip to main content
ASSAAD.ASSAAD
Associate III
October 29, 2015
Question

stm3f334 with software spi

  • October 29, 2015
  • 1 reply
  • 528 views
Posted on October 29, 2015 at 17:05

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
    This topic has been closed for replies.

    1 reply

    AvaTar
    Senior III
    October 29, 2015
    Posted on October 29, 2015 at 17:17

    I need to use a software SPI in stm32f334 @ 72Mhz ;

     

    Really ?

    You can use a software-controlled slave-select signal (NSS) to attach several SPI slaves to your master, and accessing them alternatively.

    Bitbanging will eat most of your core cycles at these rates, and destroy any interrupt scheme.