简体   繁体   English

使用STM32F3读取非传统ADC

[英]Read non conventional ADC with STM32F3

I'm attempting to interface an STM32F303 Nucleo with an AD7748-4 ADC. 我正在尝试将STM32F303 Nucleo与AD7748-4 ADC连接。 Datasheet for the ADC: ADC的数据表:

https://www.analog.com/media/en/technical-documentation/data-sheets/ad7768-7768-4.pdf https://www.analog.com/media/en/technical-documentation/data-sheets/ad7768-7768-4.pdf

The issue is, the ADC DOES NOT output the converted value through the SPI port, but rather employs a Data Ready Signal (DRDY), a Data Clock (DCLK), and a combination of 4 Data Outputs (DOUT0-DOUT3). 问题是,ADC不通过SPI端口输出转换后的值,而是使用数据就绪信号(DRDY),数据时钟(DCLK)和4个数据输出(DOUT0-DOUT3)的组合。 The output streams 96 bits serially through one wire if I set it up that way, but timing is critical in my application and I need to clock the data in using DOUT0 to DOUT2, which would each output 32 bits. 如果我按照这种方式设置输出,则输出通过一条线串行96位,但是在我的应用中时序是至关重要的,我需要使用DOUT0到DOUT2来计时数据,每个输出32位。 If I were serially streaming the data, I could trick the SPI port into reading it, but I'm not. 如果我连续流式传输数据,我可以欺骗SPI端口读取它,但我不是。 The ADC is running at 20MHz, so DCLK will be operating at the same frequency. ADC工作在20MHz,因此DCLK将以相同的频率工作。 The Nucleo runs at a maximum of 72MHz, but when the DAM is utilized, it sets the clock to 64MHz. Nucleo最高运行72MHz,但是当使用DAM时,它将时钟设置为64MHz。

In the STM manual, it describes a "GPIO port input data register (GPIOx_IDR) (x = A..H)" as being a read only register - my understanding is that the lower 16 bits can store an inputted value up to 16 bits (most likely for memory data R/W) - so the question is, how can I configure the GPIO to read in the data? 在STM手册中,它将“GPIO端口输入数据寄存器(GPIOx_IDR)(x = A..H)”描述为只读寄存器 - 我的理解是低16位可以存储最多16位的输入值(最有可能是内存数据R / W) - 问题是,如何配置GPIO读入数据? I'm at a slight impass here. 我在这里有点意外。 My instinct tells me that the Nucleo may not be fast enough to read the data coming from the ADC... Any ideas? 我的直觉告诉我,Nucleo可能不够快,无法读取来自ADC的数据......有什么想法吗? All being written in C/C++ basically bare metal... I'm new to the Nucleo, haven't written code in 4 years - pardon any lapse in knowledge... 所有用C / C ++编写的基本上都是裸机...我是Nucleo的新手,4年内没有编写代码 - 请原谅任何知识失误......

If DCLK works at 20Mhz, the uC is obviously not fast enough (you have about 3 instructions between each cycle, so even assembly language would be difficult to implement...). 如果DCLK工作在20Mhz,那么uC显然不够快(每个周期之间你有大约3个指令,所以即使汇编语言也很难实现......)。 As I am not familiar with the stm architecture, I can only suggest a trick that will maybe spark some ideas in your head. 由于我不熟悉stm架构,我只能提出一个技巧,可能会激发你头脑中的一些想法。 Rather than using a crystal for the ADC, use a timer from the STM that is connected to an output pin, and clock the ADC using that pin (MCLK). 不是使用晶体用于ADC,而是使用STM中连接到输出引脚的定时器,并使用该引脚(MCLK)为ADC提供时钟。 When configuring the ADC using spi, idle mode, etc. you can leave this clock signal at 20Mhz. 使用spi,空闲模式等配置ADC时,可以将此时钟信号保持在20Mhz。 But when you need a sample from the ADC, stop the STM timer and clock the ADC "manually". 但是当您需要来自ADC的样本时,请停止STM定时器并“手动”为ADC提供时钟。 (you practically control the DCLK signal). (实际控制DCLK信号)。 After your conversion routine is over, restart the timer at 20Mhz. 转换例程结束后,以20Mhz重新启动计时器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM