Hello,
I am using stm32h7, and I am able to read 12 bit ADC values from ADS8661 IC through HAL_SPI_Receive() as shown in the code (per loop it is taking 13us), but when plotting and calculated the sampling rate, I am only able to read one sample at around 25us (I arrived at this conclusion because I turn ON the signal to be monitored after 20ms, so i take that as the reference)
running SPI_clock at 20Mhz.
SPI init for reference
I'm not sure where I go wrong. is there a way to optiimise it further to get 1msps?
for(int i=0;i<3000;i++) { //__HAL_TIM_SET_COUNTER(&htim4,0); while(!(GPIOI->IDR &(1<<5))); //monitoring RVS Pin GPIOI->ODR &= ~(1<<0); // CS pin Low HAL_SPI_Receive(&hspi2, data_rcv ,2,1); // reading 2 bytes at a time GPIOI->ODR |= 1<<0; //CS pin high temp[temp_cnt]=((data_rcv[0]<<8)|data_rcv[1])>>4; temp_cnt=temp_cnt+1; // counterCount=TIM4->CNT; }