一区二区三区三上|欧美在线视频五区|国产午夜无码在线观看视频|亚洲国产裸体网站|无码成年人影视|亚洲AV亚洲AV|成人开心激情五月|欧美性爱内射视频|超碰人人干人人上|一区二区无码三区亚洲人区久久精品

0
  • 聊天消息
  • 系統(tǒng)消息
  • 評(píng)論與回復(fù)
登錄后你可以
  • 下載海量資料
  • 學(xué)習(xí)在線課程
  • 觀看技術(shù)視頻
  • 寫(xiě)文章/發(fā)帖/加入社區(qū)
會(huì)員中心
創(chuàng)作中心

完善資料讓更多小伙伴認(rèn)識(shí)你,還能領(lǐng)取20積分哦,立即完善>

3天內(nèi)不再提示

如何制作一個(gè)簡(jiǎn)易的Sigma Delta ADC?

電子森林 ? 來(lái)源:電子森林 ? 作者:電子森林 ? 2021-04-01 10:27 ? 次閱讀
加入交流群
微信小助手二維碼

掃碼添加小助手

加入工程師交流群

本文為備戰(zhàn)電賽的案例之一,涉及到的知識(shí)技能:

FPGA的使用

ADC的原理及構(gòu)成

PWM的產(chǎn)生

比較器的應(yīng)用

數(shù)字濾波器的使用

使用的平臺(tái):

多數(shù)FPGA芯片上沒(méi)有ADC的功能,而一些應(yīng)用則需要用到ADC對(duì)一些模擬信號(hào),比如直流電壓等進(jìn)行量化,有沒(méi)有特別簡(jiǎn)單、低成本的實(shí)現(xiàn)方法呢?

在要求轉(zhuǎn)換速率不高的情況下,完全可以借助一顆高速比較器(成本只有幾毛錢)來(lái)實(shí)現(xiàn)對(duì)模擬信號(hào)的量化,Lattice的官網(wǎng)上一篇文章就介紹了如何制作一個(gè)簡(jiǎn)易的Sigma Delta ADC,如果FPGA能夠提供LVDS的接口,連外部的高速比較器都可以省掉。由于我們的小腳丫FPGA核心模塊在設(shè)計(jì)的時(shí)候沒(méi)有考慮到LVDS的應(yīng)用場(chǎng)景,所以還是需要搭配一個(gè)高速的比較器來(lái)實(shí)現(xiàn)Lattice官網(wǎng)上推薦的簡(jiǎn)易Sigma Delta ADC的功能。

讓小腳丫FPGA通過(guò)鎖相環(huán)PLL運(yùn)行于120MHz的主時(shí)鐘(還可以更高,提速到240MHz、360MHz都應(yīng)該沒(méi)有問(wèn)題),測(cè)試1KHz以內(nèi)的模擬信號(hào)是沒(méi)有問(wèn)題的。

Lattice的官網(wǎng)上就可以下載到簡(jiǎn)易Sigma Delta ADC的Verilog源代碼,可以非常方便地用在其它品牌、其它系列的FPGA上。

下面的截圖就是采用120MHz的主時(shí)鐘實(shí)現(xiàn)的對(duì)1KHz模擬信號(hào)的采樣,并通過(guò)DDS/DAC輸出,口袋儀器M2000采集并顯示的模擬信號(hào)波形。

b31525ca-9245-11eb-8b86-12bb97331649.png

M2000口袋儀器顯示的1KHz的波形

工作原理

詳細(xì)的工作原理介紹可以參考項(xiàng)目https://www.eetree.cn/project/detail/255 及項(xiàng)目頁(yè)面中的參考資料,在這里以幾幅圖片來(lái)示例一下。

b32101f6-9245-11eb-8b86-12bb97331649.png

簡(jiǎn)易Sigma Delta ADC的工作原理

b3503caa-9245-11eb-8b86-12bb97331649.png

直接連接 - 被測(cè)模擬信號(hào)的幅度范圍為0-3.3V

b35b174c-9245-11eb-8b86-12bb97331649.png

通過(guò)電阻分壓網(wǎng)絡(luò)輸入,并在比較器+端提供參考電壓,則被采集模擬信號(hào)的電壓變化范圍可以擴(kuò)展

b36482a0-9245-11eb-8b86-12bb97331649.png

簡(jiǎn)易Sigma Delta ADC的性能與邏輯電路的工作頻率

b36d37f6-9245-11eb-8b86-12bb97331649.png

在不同的FPGA平臺(tái)上消耗的邏輯資源

以下就是我們的電賽綜合訓(xùn)練板上簡(jiǎn)易Sigma Delta ADC部分的電路連接

b379f7e8-9245-11eb-8b86-12bb97331649.png

核心代碼:

頂層調(diào)用代碼:

wire [7:0] sd_adc_out; // sigma delta adc data output

wire sample_rdy; // flag for adc conversion

ADC_top my_adc(.clk_in(clk_hs),.rstn(1‘b1),.digital_out(sd_adc_out), .analog_cmp(comp_in),.analog_out(ad_pwm),.sample_rdy(sample_rdy));

assign dac_data = sd_adc_out;assign dac_clk = clk_hs; //120MHz generated by PLL

Sigma Delta ADC頂層程序

//*********************************************************************//// ADC Top Level Module////*********************************************************************

module ADC_top ( clk_in, rstn, digital_out, analog_cmp, analog_out, sample_rdy);

parameter ADC_WIDTH = 8, // ADC Convertor Bit PrecisionACCUM_BITS = 10, // 2^ACCUM_BITS is decimation rate of accumulatorLPF_DEPTH_BITS = 3, // 2^LPF_DEPTH_BITS is decimation rate of averagerINPUT_TOPOLOGY = 1; // 0: DIRECT: Analog input directly connected to + input of comparitor // 1: NETWORK:Analog input connected through R divider to - input of comp.

//input portsinput clk_in; // 62.5Mhz on Control Demo boardinput rstn; input analog_cmp; // from LVDS buffer or external comparitor

//output portsoutput analog_out; // feedback to RC networkoutput sample_rdy;output [7:0] digital_out; // connected to LED field on control demo bd.

//**********************************************************************//// Internal Wire & Reg Signals////**********************************************************************wire clk;wire analog_out_i;wire sample_rdy_i;wire [ADC_WIDTH-1:0] digital_out_i;wire [ADC_WIDTH-1:0] digital_out_abs;

assign clk = clk_in;

//***********************************************************************//// SSD ADC using onboard LVDS buffer or external comparitor////***********************************************************************sigmadelta_adc #( .ADC_WIDTH(ADC_WIDTH), .ACCUM_BITS(ACCUM_BITS), .LPF_DEPTH_BITS(LPF_DEPTH_BITS) )SSD_ADC( .clk(clk), .rstn(rstn), .analog_cmp(analog_cmp), .digital_out(digital_out_i), .analog_out(analog_out_i), .sample_rdy(sample_rdy_i) );

assign digital_out_abs = INPUT_TOPOLOGY ? ~digital_out_i : digital_out_i;

//***********************************************************************//// output assignments////***********************************************************************

assign digital_out = ~digital_out_abs; // invert bits for LED display assign analog_out = analog_out_i;assign sample_rdy = sample_rdy_i;

endmodule

Sigma Delta ADC主程序

//*********************************************************************//// SSD Top Level Module////*********************************************************************

module sigmadelta_adc ( clk, rstn, digital_out, analog_cmp, analog_out, sample_rdy);

parameter ADC_WIDTH = 8, // ADC Convertor Bit PrecisionACCUM_BITS = 10, // 2^ACCUM_BITS is decimation rate of accumulatorLPF_DEPTH_BITS = 3; // 2^LPF_DEPTH_BITS is decimation rate of averager

//input portsinput clk; // sample rate clockinput rstn; // async reset, asserted lowinput analog_cmp ; // input from LVDS buffer (comparitor)

//output portsoutput analog_out; // feedback to comparitor input RC circuitoutput sample_rdy; // digital_out is readyoutput [ADC_WIDTH-1:0] digital_out; // digital output word of ADC

//**********************************************************************//// Internal Wire & Reg Signals////**********************************************************************reg delta; // captured comparitor outputreg [ACCUM_BITS-1:0] sigma; // running accumulator valuereg [ADC_WIDTH-1:0] accum; // latched accumulator valuereg [ACCUM_BITS-1:0] counter; // decimation counter for accumulatorreg rollover; // decimation counter terminal countreg accum_rdy; // latched accumulator value ’ready‘

//***********************************************************************//// SSD ’Analog‘ Input - PWM//// External Comparator Generates High/Low Value////***********************************************************************

always @ (posedge clk)begin delta 《= analog_cmp; // capture comparitor outputend

assign analog_out = delta; // feedback to comparitor LPF

//***********************************************************************//// Accumulator Stage//// Adds PWM positive pulses over accumulator period////***********************************************************************

always @ (posedge clk or negedge rstn)begin if( ~rstn ) begin sigma 《= 0; accum 《= 0; accum_rdy 《= 0; end else begin if (rollover) begin // latch top ADC_WIDTH bits of sigma accumulator (drop LSBs) accum 《= sigma[ACCUM_BITS-1:ACCUM_BITS-ADC_WIDTH]; sigma 《= delta; // reset accumulator, prime with current delta value end else begin if (&sigma != 1’b1) // if not saturated sigma 《= sigma + delta; // accumulate end accum_rdy 《= rollover; // latch ‘rdy’ (to align with accum) endend

//***********************************************************************//// Box filter Average//// Acts as simple decimating Low-Pass Filter////***********************************************************************

box_ave #( .ADC_WIDTH(ADC_WIDTH), .LPF_DEPTH_BITS(LPF_DEPTH_BITS))box_ave ( .clk(clk), .rstn(rstn), .sample(accum_rdy), .raw_data_in(accum), .ave_data_out(digital_out), .data_out_valid(sample_rdy));

//************************************************************************//// Sample Control - Accumulator Timing// //************************************************************************

always @(posedge clk or negedge rstn)begin if( ~rstn ) begin counter 《= 0; rollover 《= 0; end else begin counter 《= counter + 1; // running count rollover 《= &counter; // assert ‘rollover’ when counter is all 1‘s endendendmodule

數(shù)字低通濾波器模塊,做平滑濾波

//*********************************************************************//// ’Box‘ Average //// Standard Mean Average Calculation// Can be modeled as FIR Low-Pass Filter where // all coefficients are equal to ’1‘。////*********************************************************************

module box_ave ( clk, rstn, sample, raw_data_in, ave_data_out, data_out_valid);

parameter ADC_WIDTH = 8, // ADC Convertor Bit PrecisionLPF_DEPTH_BITS = 4; // 2^LPF_DEPTH_BITS is decimation rate of averager

//input portsinput clk; // sample rate clockinput rstn; // async reset, asserted lowinput sample; // raw_data_in is good on rising edge, input [ADC_WIDTH-1:0] raw_data_in; // raw_data input

//output portsoutput [ADC_WIDTH-1:0] ave_data_out; // ave data outputoutput data_out_valid; // ave_data_out is valid, single pulse

reg [ADC_WIDTH-1:0] ave_data_out; //**********************************************************************//// Internal Wire & Reg Signals////**********************************************************************reg [ADC_WIDTH+LPF_DEPTH_BITS-1:0] accum; // accumulatorreg [LPF_DEPTH_BITS-1:0] count; // decimation countreg [ADC_WIDTH-1:0] raw_data_d1; // pipeline register

reg sample_d1, sample_d2; // pipeline registersreg result_valid; // accumulator result ’valid‘wire accumulate; // sample rising edge detectedwire latch_result; // latch accumulator result

//***********************************************************************//// Rising Edge Detection and data alignment pipelines////***********************************************************************always @(posedge clk or negedge rstn)begin if( ~rstn ) begin sample_d1 《= 0; sample_d2 《= 0; raw_data_d1 《= 0; result_valid 《= 0; end else begin sample_d1 《= sample; // capture ’sample‘ input sample_d2 《= sample_d1; // delay for edge detection raw_data_d1 《= raw_data_in; // pipeline result_valid 《= latch_result; // pipeline for alignment with result endend

assign accumulate = sample_d1 && !sample_d2; // ’sample‘ rising_edge detectassign latch_result = accumulate && (count == 0); // latch accum. per decimation count

//***********************************************************************//// Accumulator Depth counter////***********************************************************************always @(posedge clk or negedge rstn)begin if( ~rstn ) begin count 《= 0; end else begin if (accumulate) count 《= count + 1; // incr. count per each sample endend

//***********************************************************************//// Accumulator////***********************************************************************always @(posedge clk or negedge rstn)begin if( ~rstn ) begin accum 《= 0; end else begin if (accumulate) if(count == 0) // reset accumulator accum 《= raw_data_d1; // prime with first value else accum 《= accum + raw_data_d1; // accumulate end end //***********************************************************************//// Latch Result//// ave = (summation of ’n‘ samples)/’n‘ is right shift when ’n‘ is power of two////***********************************************************************always @(posedge clk or negedge rstn)begin if( ~rstn ) begin ave_data_out 《= 0; end else if (latch_result) begin // at end of decimation period.。. ave_data_out 《= accum 》》 LPF_DEPTH_BITS; // 。.. save accumulator/n result endend

assign data_out_valid = result_valid; // output assignment

endmodule

原文標(biāo)題:如何在FPGA上用一個(gè)比較器實(shí)現(xiàn)ADC的功能?

文章出處:【微信公眾號(hào):FPGA入門(mén)到精通】歡迎添加關(guān)注!文章轉(zhuǎn)載請(qǐng)注明出處。

責(zé)任編輯:haq

聲明:本文內(nèi)容及配圖由入駐作者撰寫(xiě)或者入駐合作網(wǎng)站授權(quán)轉(zhuǎn)載。文章觀點(diǎn)僅代表作者本人,不代表電子發(fā)燒友網(wǎng)立場(chǎng)。文章及其配圖僅供工程師學(xué)習(xí)之用,如有內(nèi)容侵權(quán)或者其他違規(guī)問(wèn)題,請(qǐng)聯(lián)系本站處理。 舉報(bào)投訴
  • FPGA
    +關(guān)注

    關(guān)注

    1645

    文章

    22050

    瀏覽量

    618474
  • adc
    adc
    +關(guān)注

    關(guān)注

    99

    文章

    6709

    瀏覽量

    549224

原文標(biāo)題:如何在FPGA上用一個(gè)比較器實(shí)現(xiàn)ADC的功能?

文章出處:【微信號(hào):xiaojiaoyafpga,微信公眾號(hào):電子森林】歡迎添加關(guān)注!文章轉(zhuǎn)載請(qǐng)注明出處。

收藏 人收藏
加入交流群
微信小助手二維碼

掃碼添加小助手

加入工程師交流群

    評(píng)論

    相關(guān)推薦
    熱點(diǎn)推薦

    笙泉高精度24位ADC (MAD2402)新上市,賦能精準(zhǔn)量測(cè)

    逼近型(SAR)、Delta-Sigma、流水線型 (Pipelined)和雙斜率型 (Dual-slope)…等。這當(dāng)中SAR ADC是屬于高速且相較低分辨率,Delta-Sigma ADC
    發(fā)表于 07-04 13:28

    如何判斷ADC芯片的類型?

    1:如何判斷ADC芯片的類型?SAR ADC,流水線ADC,Sigma-Delta(ΣΔ)ADC,不同類型的
    發(fā)表于 04-15 06:19

    有沒(méi)有采用sigma-delta原理的AD芯片推薦

    Other Parts Discussed in Thread: ADS1204請(qǐng)大家推薦款采用sigma-delta原理的AD芯片,我已有ADS1204這款芯片,但是后面的數(shù)字濾波處理起來(lái)總是出問(wèn)題。決心找款已經(jīng)把數(shù)字濾
    發(fā)表于 01-20 07:42

    請(qǐng)問(wèn)ADS1118 Delta-sigma類的ADC輸入端的RC濾波器參數(shù)如何計(jì)算?

    最近在使用ADS1118,想要在ADC的輸入端加個(gè)跟隨器以減小輸入阻抗,再在二者之間加入個(gè)RC濾波器,濾波器的參數(shù)不知道如何計(jì)算?請(qǐng)問(wèn)
    發(fā)表于 01-14 08:02

    有幾個(gè)關(guān)于ADC電路layout的疑問(wèn)求解

    我有幾個(gè)關(guān)于ADC電路layout的疑問(wèn)。 很多工程師建議delta-sigma類型的AD芯片的數(shù)字地引腳和模擬地引腳都接到模擬地,通信接口用數(shù)字隔離器隔離。 這意思就是說(shuō)AD芯片要放在模擬地平
    發(fā)表于 01-10 07:04

    使用ADS1278做一個(gè)更新率10Khz的數(shù)據(jù)采集卡,群延遲的參數(shù)很大怎么處理?

    ,忽略傳輸延遲,ADC的輸出的每一個(gè)數(shù)據(jù)點(diǎn)都至少延遲了38/fdata = 0.38ms。這樣的延遲對(duì)我的應(yīng)用來(lái)說(shuō),是不可以接受的。 我的理解正確嗎? 我需要實(shí)時(shí)性強(qiáng)的ADC,是不是sigm
    發(fā)表于 01-02 08:31

    對(duì)于1位量化的Sigma-delta調(diào)制器來(lái)說(shuō),As和SNR和DR分別是什么關(guān)系?

    公式不太樣,只知道DR應(yīng)該是最大SNR,舉例子比如是3階調(diào)制器,OSR=256,這3個(gè)值如何計(jì)算? 2.對(duì)于MASH結(jié)構(gòu),SNR如何計(jì)算? 3. 不同階的Sigma-delta框圖中有的帶有延時(shí)
    發(fā)表于 01-02 08:04

    想做一個(gè)采集設(shè)備,請(qǐng)問(wèn)選用什么樣的ADC和DAC合適?

    想做一個(gè)采集設(shè)備,采集信號(hào)為4-20mA,1到5V DC ,0-10VDC ,三種信號(hào),要求精度不低于0.1%,刷新率為 25ms。在做一個(gè)輸出 4-20mA,1到5V DC ,0-10VDC ,請(qǐng)問(wèn)選用什么樣的ADC 和DA
    發(fā)表于 12-17 08:16

    請(qǐng)問(wèn)為ADC選Driver主要要看哪幾項(xiàng)技術(shù)指標(biāo)呢?

    我的項(xiàng)目中需要為ADC款驅(qū)動(dòng)器,目前我的ADC準(zhǔn)備采用ADS1259,看到有款差分放大器THS4551,其中的Applications中有24-Bit,
    發(fā)表于 12-16 06:00

    請(qǐng)問(wèn)采樣率大于4MHz,同步通道數(shù)量不少于4個(gè),適合于脈沖信號(hào)的采集,Delta-Sigma型是不是不太適合?

    您好,請(qǐng)問(wèn)采樣率大于4MHz,同步通道數(shù)量不少于4個(gè),適合于脈沖信號(hào)的采集,Delta-Sigma型是不是不太適合?,非常感謝!
    發(fā)表于 11-28 06:42

    是什么原因?qū)е翧DS1262在數(shù)據(jù)吞吐率提高時(shí)會(huì)增加它的噪聲?

    時(shí)的噪聲也能和100Hz時(shí)噪聲相當(dāng),有沒(méi)有些有效的濾波手段可以削弱噪聲? 2、有沒(méi)有些關(guān)于sigma-delta adc的資料我也研究下噪聲的來(lái)源,看看有沒(méi)有方法即提高數(shù)據(jù)輸出速率
    發(fā)表于 11-26 07:27

    【「從算法到電路—數(shù)字芯片算法的電路實(shí)現(xiàn)」閱讀體驗(yàn)】+第九章sigma delta adc閱讀與分享

    本章介紹了sigma delta adc的硬件實(shí)現(xiàn),ADC是嵌入式開(kāi)發(fā)中絕對(duì)很基礎(chǔ)重要的個(gè)模塊
    發(fā)表于 11-20 13:58

    關(guān)于使用Delta-Sigma ADS1278遇到的疑問(wèn)求解答

    關(guān)于Delta-Sigma ADS1278使用,目前遇到些問(wèn)題。簡(jiǎn)述如下: 項(xiàng)目背景是:由于傳感器迭代,之前的單端輸出改為差分輸出。新傳感器型號(hào)是MS1010LA。具體規(guī)格書(shū)見(jiàn)附件
    發(fā)表于 11-15 07:45

    delta-sigma DAC的過(guò)采樣率是如何確定的?

    最近因?yàn)橐O(shè)計(jì)音頻相關(guān)的軟件,處理DSD問(wèn)題,發(fā)現(xiàn)個(gè)問(wèn)題: sigma-delta ADC 中,bit流產(chǎn)生來(lái)自于模擬的sigma-delta
    發(fā)表于 10-28 06:30

    使用精密Delta-Sigma ADC進(jìn)行RTD斷線檢測(cè)

    電子發(fā)燒友網(wǎng)站提供《使用精密Delta-Sigma ADC進(jìn)行RTD斷線檢測(cè).pdf》資料免費(fèi)下載
    發(fā)表于 09-23 11:23 ?3次下載
    使用精密<b class='flag-5'>Delta-Sigma</b> <b class='flag-5'>ADC</b>進(jìn)行RTD斷線檢測(cè)