cancel
Showing results for 
Search instead for 
Did you mean: 

Connecting STM32H743ZITx to ADS127L11 using SPI - Will I fry the MCU if I do this?

CAdat.1
Associate II

Hello everyone!

 

After countless hours of self-grind, talking to different LLMs about it (and mostly failing), I may have started to get some faint idea about what I am doing. I am mostly writing this post for a sanity-check.

 

Currently, for a medical device, we are trying to connect an external (ADS127L11) ADC to our MCU. When we use our MCU’s internal ADC, everything works fine, but we want to explore other options, to hopefully lower the internal noise.

 

Project snapshot

  • MCU STM32H743ZITx (CubeIDE 1.14, FW_H7 1.12.1)

  • ADC ADS127L11 (24-bit ΔΣ, SPI Mode-1, push-pull DRDY)

  • Goal 100 k samples / s, minimal jitter → DMA ping-pong → USB CDC

Pin Configuration

PE11 = SPI4_NSS

PE12 = SPI4_SCK

PE13 = SPI4_MISO

PE14 = SPI4_MOSI

PE15 = DRDY

PB10 = START

PB11 = RESET

 

(Connection Config = Full Duplex, NSS Input / Output for some cases, see below)

 

Original Plan -> Failed due to DMAMUX setup

From what I understood thus far, there is this DRDY pin driven by the ADC. If it gets low, this means conversion is done, I need to collect the data somehow from ADC’s buffer. 

 

So my first plan was to set an EXTI interrupt on falling edge -> Connect to DMA -> Call CDC transfer on half / full callbacks for ping-pong buffer usage (this is more or less our current architecture, after the DMA part).

 

But I failed to set up the DMA_GENERATOR for the proper pin (EXTI15 to be exact). For some reason it only lets me select EXTI0. So connecting DRDY to an EXTI pin failed. I watched lots of youtube videos, tried lots of different stuff, talked to LLMs for hours, to no avail.

 

Ok…

 

Tweaked Plan -> Fry the board

 

Since no plan survives contact with the enemy (or everyone has a plan until they get punched in the face), the LLM suggested I can physically connect DRDY and SPI NSS pins - NSS configured as Input.

 

The idea being, when DRDY falls to low, NSS will also fall to low, which will generate a DMA call, then I can automatically gather the conversion sample via DMA and write it to a buffer somewhere in MCU code and after that it’s easy.

 

It tells me that there is no risk as long as I configure the NSS pin as Input, because both pins are driven by ADC itself. Now, if I configured the NSS as Output, that could cause a short-circuit…

 

Which is precisely what I plan doing next:

 

From what I understood - and I’m not sure there at all, in order to send configuration bytes to ADC, I need to configure the NSS as Output. LLM suggests I temporarily cut the physical connection between DRDY and NSS during this moment. This is easy enough, using a simple switch, and we can absolutely go for this route, from a design standpoint.

 

I want to use the DMA for sure, because I don’t want MCU’s main loop to burden itself with the conversions, etc (not because it can’t - the main loop is surprisingly light, super light in fact, but I want to make sure there is very little jitter / the data is real time, also from a best practice standpoint, I think DMA should be used in these sort of cases)

 

Questions or Road to Insanity

 

1) Do I seem like I know what I am doing? Is this the best practice, what I just described? Solid engineering? Or am I “winging it” like a noob? At this point I am close to what the japanese call “Karoshi” (Death from overwork)

 

2) Why do I fail to set up the DMAMUX / DMA Generator? Why won't CUBE IDE let me select anything except EXTI0? Should I be bothered by this? Or not waste my time (currently 12+ hours), just walk past it - like I am currently doing?

 

3) I do not actually have previous experience with the SPI transfer protocols. If I configure it as Full Duplex + NSS Input, will MCU generate an SPI DMA each time NSS has a falling edge, like the LLM suggested?

 

4) What about when I am sending configuration bits? This ADC does not have a permanent flash inside it, so I need to send configuration bytes each time I power up the device - this is not optional. Can I configure NSS as Output, cut physical connection between NSS and DRDY (with a transistor or a switch), configure the device, then turn it back for regular use?

 

Thanks in advance for the long read!

1 REPLY 1
TDK
Super User

The ADS127L11 is an SPI slave and therefore the STM32 must be the SPI master. Therefore, the NSS pin on the STM32 is an output, not an input. Connecting NSS to DRDY won't do anything useful.

 

The ADC behaves the same way each time. If data is ready at 48 ksps or more, you can probably blindly read it out at that rate and ignore the DRDY pin. Reading out one conversion can start the next. You should check this with a logic analyzer or verify timing against the datasheet. There is surely an operational mode where this is possible.

 

USB transmission speed is not guaranteed and is subject to random delays of 50ms or so. You'll need an internal buffer to survive these stalls gracefully without losing data.

If you feel a post has answered your question, please click "Accept as Solution".