Quantcast
Channel: Data converters
Viewing all articles
Browse latest Browse all 28120

Forum Post: ADS131E08: custome sample rate contains zeros in the data

$
0
0
Part Number: ADS131E08 Hi, I wanted to capture data from this ADC with a custom sample rate, so I have set my STM32 timer to fire for example 12800 samples per second, and I have tied it's output to the start pin signal. Also I have connected the DRDY signal to one of external Pins of my MCU configured as an Interrupt on falling edges, when the interrupt fires, I just use the RDATA command to read the ADC data value, but the problem with this approach is that in some samples my data is zero, here is a screen shot of the captured data with matlab, This is my main loop code //Reset ADC HAL_GPIO_WritePin(GPIOA,ADC_RST_Pin,GPIO_PIN_RESET); HAL_Delay(1); HAL_GPIO_WritePin(GPIOA,ADC_RST_Pin,GPIO_PIN_SET); //Start ADC in continuous mode HAL_GPIO_WritePin(GPIOA,ADC_START_Pin,GPIO_PIN_SET); //Send SDATAC tx[0]=0x11; ADC_sendCommand(tx,rx,1); tx[0]=0x43;//Wrtie config3 Reg tx[1]=0x00;//Number of regs to write = 1 tx[2]=0xcc;//the value to be written ADC_sendCommand(tx,rx,3); //wait for internal Ref to power up for(i=0;i ARR=77; TIM1->CCR1 = 39; HAL_GPIO_WritePin(GPIOA,ADC_START_Pin,GPIO_PIN_RESET); // Start = 0 HAL_GPIO_WritePin(GPIOA,ADC_CS_Pin,GPIO_PIN_RESET);//CS = 0 ADC_ready=0; Start_capture=0; while (1) { if(Start_capture) { Start_capture=0; HAL_GPIO_WritePin(GPIOA,ADC_START_Pin,GPIO_PIN_SET); // Start = 1 } if(ADC_ready){ ADC_ready=0; tx[0]=0x12; //RDATA Command for(int g=1;g<28;g++) { tx[g]=0; } HAL_SPI_TransmitReceive(&hspi1,tx,rx,28,100); HAL_GPIO_WritePin(GPIOA,ADC_START_Pin,GPIO_PIN_RESET); // Start = 0 adcBuf[i]=(rx[7] << 24) | (rx[8] << 16) | (rx[9]<<8) | 0x00; adcBuf[i] /= 256; } } Ans this is my External interrupt code void EXTI3_IRQHandler(void) { /* USER CODE BEGIN EXTI3_IRQn 0 */ /* USER CODE END EXTI3_IRQn 0 */ HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_3); /* USER CODE BEGIN EXTI3_IRQn 1 */ ADC_ready=1; /* USER CODE END EXTI3_IRQn 1 */ } and here is my timer interrupt code void TIM1_UP_TIM10_IRQHandler(void) { /* USER CODE BEGIN TIM1_UP_TIM10_IRQn 0 */ /* USER CODE END TIM1_UP_TIM10_IRQn 0 */ HAL_TIM_IRQHandler(&htim1); /* USER CODE BEGIN TIM1_UP_TIM10_IRQn 1 */ if(ADC_ready == 0) { Start_capture = 1; } /* USER CODE END TIM1_UP_TIM10_IRQn 1 */ } So what's missing or am doing it wrong?

Viewing all articles
Browse latest Browse all 28120

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>