2015-10-29 09:05 AM
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
2015-10-29 09:17 AM
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.