Electronics > Microcontrollers

EXTI trigger of DMA receive from SPI (STM32U5)

(1/2) > >>

davegravy:
I am trying to interface the LTC2512-24 precision ADC with STM32U5. The ADC uses standard unidirectional SPI and requires that communication happen within a fairly tight time window during its the conversion<->acquisition cycle. The ADC outputs a pulse on the Data Ready Line (DRL) and I need to read 24 or 32 bits from it within about 700ns after the DRL falling edge. Outside of this risks causing analog noise interference. I've tested using interrupts based on DRL and the response time is too slow.

I'm fairly new at uC programming and a number of older posts I've found complain that you can't trigger DMA xfers using GPIO inputs on STM32. The uC I'm using is newer (u5 series) and combing through the TRM I found that there's a register called SPI_AUTOCR for configuring Autonomous Mode which contains TRIGSEL[3:0] and the ability to select EXTI4 or EXTI9 (among other sources) as a trigger.

There's also GPDMA.CxTR2_TRIGSEL[5:0] for GPDMA which seems to allow EXTI sources to trigger DMA.

I'm not sure which of these I should be exploring, or if there's something better for my use case. Any words of wisdom?

SiliconWizard:

--- Quote from: davegravy on January 28, 2022, 02:25:51 pm ---I am trying to interface the LTC2512-24 precision ADC with STM32U5. The ADC uses standard unidirectional SPI and requires that communication happen within a fairly tight time window during its the conversion<->acquisition cycle. The ADC outputs a pulse on the Data Ready Line (DRL) and I need to read 24 or 32 bits from it within about 700us after the DRL falling edge. Outside of this risks causing analog noise interference. I've tested using interrupts based on DRL and the response time is too slow.

--- End quote ---

Are you sure about your numbers here?
700us is an enormous amount of time for such an MCU. How could interrupts on a STMR32U5 have a latency higher than this?

davegravy:

--- Quote from: SiliconWizard on January 28, 2022, 06:02:26 pm ---
--- Quote from: davegravy on January 28, 2022, 02:25:51 pm ---I am trying to interface the LTC2512-24 precision ADC with STM32U5. The ADC uses standard unidirectional SPI and requires that communication happen within a fairly tight time window during its the conversion<->acquisition cycle. The ADC outputs a pulse on the Data Ready Line (DRL) and I need to read 24 or 32 bits from it within about 700us after the DRL falling edge. Outside of this risks causing analog noise interference. I've tested using interrupts based on DRL and the response time is too slow.

--- End quote ---

Are you sure about your numbers here?
700us is an enormous amount of time for such an MCU. How could interrupts on a STMR32U5 have a latency higher than this?

--- End quote ---

I was only three orders of magnitude off. I meant nano-seconds, sorry. Edited.

uer166:

--- Quote from: davegravy on January 28, 2022, 02:25:51 pm ---I am trying to interface the LTC2512-24 precision ADC with STM32U5. The ADC uses standard unidirectional SPI and requires that communication happen within a fairly tight time window during its the conversion<->acquisition cycle. The ADC outputs a pulse on the Data Ready Line (DRL) and I need to read 24 or 32 bits from it within about 700ns after the DRL falling edge. Outside of this risks causing analog noise interference. I've tested using interrupts based on DRL and the response time is too slow.

--- End quote ---

To read 32 bits you'd need a SPI clock rate of ~45MHz, assuming zero latency on the interrupt/DMA which is quite fast for normal SPI. Never-mind, I see the ADC supports up to 100MHz SPI bus. Considering the STM32U5 runs at 160MHz tops, it would seem it's a hard target to beat. No specific advice, but I've had success with chaining and connecting timers to all kinds of peripherals, and I bet you can provide the DRL to a TIM input capture, and generate a DMA request using a timer. Would be quite interested in the solution you come up with.

davegravy:

--- Quote from: uer166 on January 28, 2022, 07:17:44 pm ---
--- Quote from: davegravy on January 28, 2022, 02:25:51 pm ---I am trying to interface the LTC2512-24 precision ADC with STM32U5. The ADC uses standard unidirectional SPI and requires that communication happen within a fairly tight time window during its the conversion<->acquisition cycle. The ADC outputs a pulse on the Data Ready Line (DRL) and I need to read 24 or 32 bits from it within about 700ns after the DRL falling edge. Outside of this risks causing analog noise interference. I've tested using interrupts based on DRL and the response time is too slow.

--- End quote ---

To read 32 bits you'd need a SPI clock rate of ~45MHz, assuming zero latency on the interrupt/DMA which is quite fast for normal SPI. Never-mind, I see the ADC supports up to 100MHz SPI bus. Considering the STM32U5 runs at 160MHz tops, it would seem it's a hard target to beat. No specific advice, but I've had success with chaining and connecting timers to all kinds of peripherals, and I bet you can provide the DRL to a TIM input capture, and generate a DMA request using a timer. Would be quite interested in the solution you come up with.

--- End quote ---

Thanks.  Are you mentioning a TIM-based solution because there's something about using EXTI-triggered DMA (without software involvement) that's likely to not work? Or just because TIM is what's worked for you in the past?

Navigation

[0] Message Index

[#] Next page

There was an error while thanking
Thanking...
Go to full version