cancel
Showing results for 
Search instead for 
Did you mean: 

How to receive data from external high-speed ADC using quadspi?

charlescho64
Associate II

Hello, 

I am currently developing an MCU based radar. I tried to implement 4-channel ADC Sampling 1MSPS based on STM32H743, but the results were not good. There are many problems, but the biggest problem is the sampling rate, so to solve this, we plan to use an external high-speed ADC chip (AD7383-4). As you all know, the STM32H7 series supports QuadSPI. Of course, there are mainly examples related to Memory. Some engineers say that you can set it to indirect mode and do it. (https://stackoverflow.com/questions/73855861/qspi-connection-on-stm32-microcontrollers-with-other-pe...). Another engineer said that STM32 Quad SPI is difficult to use because it is for memory and data is loaded alternately on the Quad SPI data line. This part seems to be somewhat limited to memory.

Do you know if there is a way to simultaneously receive 4 channel ADC data at 4MSPS using quad SPI on STM32H7?

13 REPLIES 13
jiangfan
ST Employee

It is not so difficult to use QuadSPI in STM32H743. It should be easier to use indirect mode to interface with AD7383-4 (datasheet: AD7383-4/AD7384-4 (Rev. 0) (analog.com))

S0: indirect write to trigger ADC conversion, no instruction/address/Alt./Data phase, 1-cycle dummy may be tried.

S1~S16: indirect read to read back ADC conversion results, 16-bit resolution assumed, no instruction/address/Alt./Dummy phase, 1-byte data to be used for each cycle but only one nibble to use. re-assemble is needed to recover 4-channel data.

jiangfan_1-1696918483288.png

 

As mentioned by others, no need to use STM32 HAL library, but just access directly the QuadSPI register, or perhaps use the LL library.

Thank you for your kind reply.

If you have an example of how to implement this in the STM32CubeIDE environment, please share. In this environment, it is not possible to easily do what you described because it is only a memory interface setting. Since I mainly set it up and use it in an IDE environment, I am not familiar with the details of the chip, so please provide an example.

charlescho64
Associate II

I uploaded the site project you mentioned to the STM32H743 Nucleo-144 board, but it does not work.

There is not even a clock signal. I would like to ask if there is a guide to make it simpler.

Please take care that the example project I shared is for STM32H743I-EVAL, instead of STM32H743 Nucleo-144 board. so, it is reasonable that it does not work.

Unfortunately, there is SPI example (shared below) for STM32H743 Nucleo-144 only, there is not QSPI example for STM32H743 Nucleo-144.

STM32CubeH7/Projects/NUCLEO-H743ZI/Examples_LL/SPI/SPI_FullDuplex_ComIT at master · STMicroelectronics/STM32CubeH7 · GitHub

S1~S16: indirect read to read back ADC conversion results, 16-bit resolution assumed, no instruction/address/Alt./Dummy phase, 1-byte data to be used for each cycle but only one nibble to use.

Besides, better to use DDR mode instead of SDR, for each cycle, so as to save time and improve efficiency.

charlescho64
Associate II

Another similar issue is using multiple SPIs. However, we cannot use SPI because we are using it on another device. I need to use QSPI, but I couldn't find an example to solve this. I'm not sure how to apply the example you gave to a high-speed ADC.

https://community.st.com/t5/stm32-mcus-products/interface-with-external-adc-via-spi-at-1ms-s/m-p/74331

charlescho64
Associate II

Hello, jiangfan 

I am currently still unable to solve this problem. One important fact is that the process of initializing AD7383-4 was confirmed. I have not yet been able to confirm it on STM32H743, but only confirmed the process on ADI github non-OS.

First, let's activate QSPI on the STM32H743 and try to communicate using it. But none of the signal lines in QSPI move. I checked QSPI_CLK with an oscilloscope, but it doesn't move at all.

To summarize the code I used:

1. Initialization was done as follows.

MX_QUADSPI_Init();

hqspi.Instance = QUADSPI;

HAL_QSPI_DeInit(&hqspi);

hqspi.Init.ClockPrescaler     = 10;

hqspi.Init.FifoThreshold      = 4;

hqspi.Init.SampleShifting     = QSPI_SAMPLE_SHIFTING_HALFCYCLE;

hqspi.Init.FlashSize          = 1;

hqspi.Init.ChipSelectHighTime = QSPI_CS_HIGH_TIME_1_CYCLE;

hqspi.Init.ClockMode          = QSPI_CLOCK_MODE_0;

hqspi.Init.FlashID            = QSPI_FLASH_ID_1;

hqspi.Init.DualFlash          = QSPI_DUALFLASH_DISABLE;

if (HAL_QSPI_Init(&hqspi) != HAL_OK){

    Error_Handler();

  }

  2. To check the QSPI Clock signal, the following data was continuously written in the while function.

    /* AD7383-4  Reset "Address: 0x2, WRITE Mode, Reset: 0x0000, Name: CONFIGURATION2" */

uint8_t RW, ADDR, SDO, RESET, REFSEL;

uint8_t TxData[2];

RW = 1;

ADDR = 0x2;

RESET = 0xFF;

TxData[0] = 0xFF & RESET;

TxData[1] = 0xFF & ((RW<<7) | (ADDR<<4));

for(int i = 0; i < 1000; i++){

      HAL_QSPI_Transmit(&hqspi, TxData, HAL_QPSI_TIMEOUT_DEFAULT_VALUE);

   }

I uploaded the firmware to the nucleo-144 board like this, but there is no signal on the QSPI_clock line. This experiment was conducted without the AD7283 board connected. What's wrong with my code to check?