This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

ADS131M08: Some error happen at condition that spi+dma ADS131m08 32KSPS

Part Number: ADS131M08

Tool/software:

I had some problems reading the ADS131m08, my engineering design and configuration was this: I used the STM32H743 as the master. The SPI clock is set to 20M and the ADS131mM08 clock is set to 8.192M. The sample rate is set to 32KSPS. Set to SPI+DMA mode to communicate with ADS131M08, the DRDY line of ADS131M08 triggers interrupt to inform STM32H743 to read data, enables DMA transmission in the interrupt function of STM32H743, and enables DMA interrupt. Each time 27 bytes of data are read (each word length is 24bits, a total of 8 words), and each time when DMA transmission data is enabled, it determines whether the last DMA has been transmitted. A flag is set to false when DMA is enabled to transfer data, and then the flag is set to true in the DMA interrupt function, indicating that the current data is read. Now my problem is that DMA transfers data out of order with DRDY external interrupts probabilistic sending disorder. This means that sometimes the data transfer is synchronized with the DRDY interrupt, as shown in Figure 1 below. Where the red line is DRDY and the yellow line is SPI CLK, it can be seen that the period of DRDY is 32k. I recorded The Times of DRDY interrupt and DMA interrupt completion in the program, and found that the two counts are about 32K in 1 second, and the two counts are equal. Sometimes there are problems with data transmission, as shown in Figure 2 below. DRDY is the red line, so why is there a pulse bump in the middle of a drdy cycle? And this pulse may cause a STM32H43 external interrupt, because the two counts mentioned above are no longer equal, the number of drdy interrupts in 1 second is about 40K, while the DMA transfer completion interrupt is about 31K. What is the cause of this problem and how to solve or avoid it? thank you.

Figure 1:

Figure 2:

  • Hi user4637774,

    Can you confirm how many clocks you actually sent to the ADC and how many data are read in words in each frame? You mentioned "Each time 27 bytes of data are read (each word length is 24bits, a total of 8 words)," but it led to a confusion because 8 24-bit words does not match 27 bytes.

    The phenomenon occurred because not all data were read by your microcontroller, in other words some data were missed. You can find more details in the section 8.5.1.9.1 in the ADS131M08 datasheet. You can check or share your timing in the previous frame where the first narrow pulse of /DRDY was observed.

    BR,

    Dale

  • As for the clock of the ADC chip, we input the 23rd pin of the chip through the external clock source, and the clock size is 8.192M, which is also mentioned above.
    Regarding the frame length, the reason why it is 27bytes is that we think, first I set the word length to 24-bits, the first three bytes of 27bytes is the response, since there is no CRC, so the next 24 bytes are 8 channels of data. That adds up to 27 bytes. Is that OK?
    In fact, I also refer to section 8.5.1.9.1, for example, in my program, when the number of drdy interrupts is much larger than the number of DMA interrupts, it will trigger a sync/reset low pulse, but it does not have any effect.
    In addition, I found that if I use a lower sampling rate, there is no problem, only at 32KSPS.

  • Hi user4637774,

    The clocks I asked is SPI clock, not the master clock. Thank you for your clarification. 

    Your setting of 27 bytes (9 words) in one frame is correct.

    The ADC can not output different behavior according to the data rate, it might be something else which caused it. The following thread should be helpful for you to check the software in your microcontroller.

    ADS131M08: ADS131M08 strange behavior of DRDY

    In the meantime, it will e helpful if you could share the following information.

    • Capture and share the timing in the previous and current frame where the first narrow pulse of /DRDY was observed.
    • Your layout and schematic so I can see if something is not proper or if it is possible to get an interference.

    BR,

    Dale

  • I reworked the project today and found that it works fine to use DMA1_stream0 and DMA1_stream1 as SPI Rx and Tx requests respectively, instead of DMA1_stream4 and DMA1_stream5, DMA2_stream4 and DMA2_stream5. We want you to see if there is a problem with the clock waveform we gave to the ADC.

  • Hi user4637774,

    Thank you for your update. I'm glad to see you have fixed the issue by changing your software in your microcontroller.

    If you could read/write registers correctly and also read data correctly, you design would be good. Your clock shows a little bit overshooting which may be caused by your PCB layout, do you have any resistors in series with your clock and SPI digital signal?

    BR,

    Dale