cancel
Showing results for 
Search instead for 
Did you mean: 

how to reduce data capturing delay between stm32f103RC and ADS1248 temperature sensor

nischalgowda33
Associate II
Posted on December 07, 2015 at 09:50

Hello, 

Myself nischal, i'm using stm32f103RC controller to get data from ADS1248 temperature IC using SPI as a communication medium.  The problem i'm facing is, when controller request data from ads1248 through SPI i'm getting response for every 250ms instead of 16ms. So i request anybody to resolve the issue ASAP. Thank you in advance.

Nischal      
9 REPLIES 9
Posted on December 07, 2015 at 14:45

Do you need to clock the interface faster? How fast are you clocking it now?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
nischalgowda33
Associate II
Posted on December 08, 2015 at 06:30

hello clive ,

     i'm clocking at 281250bps

raptorhal2
Lead
Posted on December 08, 2015 at 20:31

Perhaps a wrong command is going to the ADS1248 external ADC. But that is difficult to pinpoint without seeing the code.

Edit: The default sampling rate for the ADS1248 is 5/sec. Is that what you are observing?

Cheers, Hal

nischalgowda33
Associate II
Posted on December 09, 2015 at 11:28

hello baird,

   i'm facing problem in ADS1248 when SPI send request for response ads1248 sends two garbage values  one after the other and there 2 sec delay as initialized so there the problem occurring can you help me to show

raptorhal2
Lead
Posted on December 09, 2015 at 19:55

Describe how you are coordinating the ADS1248 Start pin timing relative to the commands sent on SPI.

Cheers, Hal

nischalgowda33
Associate II
Posted on December 10, 2015 at 06:49

hello baird.hal,

 i'm forwarding code,

   float Read_IC1_REF0(void)

{

volatile float tot_adc_val = 0.0;

volatile unsigned short int fl_k = 0;

volatile unsigned short int fl_index = 0;

volatile unsigned char SPI1_Rx_buffer[3]={0};

volatile unsigned int ADC_Converted_Data = 0;

/****** Configuration for MUX1 Register ******/

IC1_VREFCON_Int_ON // Internal Reference is always ON

IC1_REFSELT_Onboard_Ref // Onboard Reference selected

IC1_MUXCAL_Ext_Ref0 // External REF0 is selected as system monitor

sar_Write_2_Register(IC1_MUX1_Address,IC1_MUX1_Data);  

/****** Delay ******/

Delay_Flag_16ms = 0;

while(Delay_Flag_16ms == 0); // 16 ms Delay

MB1_process();

/****** Read Data Once ******/

_2_sec_Delay_Flag = 0;

do

{

while(!(GPIOC->IDR & 0x0001))

{

_2_sec_Delay_Flag = 1;

delay_2s_count = 0;

}

} while(_2_sec_Delay_Flag == 0);

// while(GPIOC->IDR & 0x0001); // -->IC1   Wait till Data Conversion Cpmplete (i.e DRDY != 1). If it goes to Zero, indicates Data Conversion is Complete

while((GPIOC->IDR & 0x0001)==0);

while(SPI2_BUSY_FLAG); // Wait for Busy flag reset to send next data byte

SPI2->DR =0x12; // Read Once Cmd is 12 or 13.

  while(SPI2_BUSY_FLAG); // Wait for Busy flag reset to send next data byte

SPI2_Rx_dummy_buffer = SPI2->DR; // receive 1st byte which is a dummy data

/* here communication delay occurring and receiving dummy byte */

 

_2_sec_Delay_Flag = 0;

do

{

while(!(GPIOC->IDR & 0x0001))

{

_2_sec_Delay_Flag = 1;

delay_2s_count = 0;

}

} while(_2_sec_Delay_Flag == 0);

// while(GPIOC->IDR & 0x0001);

while((GPIOC->IDR & 0x0001)==0);

while(SPI2_BUSY_FLAG); // Wait for Busy flag reset to send next data byte

SPI2->DR =0x12; // Read Once Cmd is 12 or 13.

  while(SPI2_BUSY_FLAG); // Wait for Busy flag reset to send next data byte

SPI2_Rx_dummy_buffer = SPI2->DR; // receive 1st byte which is a dummy data

/* here communication delay occurring and second time  receiving dummy byte,this major thing and delay has more */

for(fl_k=0;fl_k<3;fl_k++)

{

while(SPI2_BUSY_FLAG); // Wait for Busy flag reset to send next data byte

SPI2->DR =0xff;    // NOP Cmd

while(SPI2_BUSY_FLAG); // Wait for Busy flag reset to send next data byte

SPI1_Rx_buffer[fl_index++]=SPI2->DR;

raptorhal2
Lead
Posted on December 11, 2015 at 16:53

Read the (not)DRDY description on Sheet 36 of the ADS1248 data sheet. It indicates that a delay is needed between (not)DRDY and the first SCLK pulse.

TI also provides programming examples for the ADS1248 that can be compared with your code to find omissions in setup and communication.

Cheers, Hal

nischalgowda33
Associate II
Posted on December 17, 2015 at 11:01

hello everyone,

can any buddy suggest me how to work the SPI in parallel ..? 

AvaTar
Lead
Posted on December 17, 2015 at 12:46

How do you mean that ?

You have the options to use separate SPI peripherals in parallel, or control NSS via software (i.e. in your code) and have separate NSS lines, one to each slave.