AnsweredAssumed Answered

1549 SPI data capture

Question asked by Eddie Mallon on Apr 4, 2019
Latest reply on Apr 5, 2019 by Aldo Gutierrez

Hi

I am using a LPC159 using the SPI to receive data fro a AD7193, a 24bit ADC. What is happening is that after 24 clks, is the first 8 clks do not load anything, the next 8 clks load the hi bits and the last 8 clks load the mid bits. The lo bits are never read. If I add an additional 8 clks all 24 bits are read. This is not what the datasheet states. The bit of code for SPI capture is below and is essentially the same as the examples in the user manual. Also attached is an oscilloscope image.

 

Anyone have any idea?

 

Thanks

Eddie Mallon

 

 while(~LPC_SPI1->STAT & SPI_STAT_TXRDY);
 LPC_SPI1->TXDATCTL = SPI_TXDATCTL_LEN(7) | SPI_TXDATCTL_ASSERT_SSEL0;  
 while(~LPC_SPI1->STAT & SPI_STAT_RXRDY); 
 AD7193_rx_data_high  = LPC_SPI1->RXDAT;
 
 while(~LPC_SPI1->STAT & SPI_STAT_TXRDY);
 LPC_SPI1->TXDATCTL = SPI_TXDATCTL_LEN(7);  
 while(~LPC_SPI1->STAT & SPI_STAT_RXRDY); 
 AD7193_rx_data_mid  = LPC_SPI1->RXDAT; 

 

 while(~LPC_SPI1->STAT & SPI_STAT_TXRDY); 
 LPC_SPI1->TXDATCTL = SPI_TXDATCTL_LEN(7) |SPI_TXDATCTL_EOT;
 while(~LPC_SPI1->STAT & SPI_STAT_RXRDY);
 AD7193_rx_data_low = LPC_SPI1->RXDAT ;
 
 AD7193_rx_data = ((AD7193_rx_data_high <<(16) | (AD7193_rx_data_mid <<(8)))| AD7193_rx_data_low );
 AD7193_rx_data = AD7193_rx_data & 0x00ffffff;

 

Outcomes