cancel
Showing results for 
Search instead for 
Did you mean: 

stm3f334 with software spi

ASSAAD.ASSAAD
Associate II
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
1 REPLY 1
AvaTar
Lead
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.