Post Go back to editing

ADE9000 - Streaming Waveform Buffer in Fixed Rate Mode

Hi,

I am trying to stream back 1024 samples from the ade9000 using the continuous mode. I can read the resampled data just fine, and also the fixed data fine as long as it is in "Stop when Buffer is Full Mode". I am using a raspberry pi 4 connected via spi. When I stream back continuous samples the data appears disjoint. I have tried just using the burst read to read 1024 samples worth (all channels). this is the out put.

 

I have also tried  setting WFB_PG_IRQEN to 0x8000 in order to indicate that the page 15 has been filled. I then set the CS pin low and poll STATUS0 until bit 17 is set. I reset STATUS0 bit 17 then finish by putting CS High. I start a burst read of the buffer for all of its points. Then loop back to polling the STATUS0 and repeat until I have 4 buffers worth. I get similar looking data. I am not sure what I am doing wrong here but I know this is possible with the tabview code. Could anyone explain how this is meant to be done with sudo code?

  • I setup 


    ADE_SPI_WRITE(ADDR_WFB_PG_IRQEN,0x8080,0x2); //set irq for half full and full
    ADE_SPI_WRITE(ADDR_MASK0,0x20000,0x4); //enable wfb_pg_irq
    ADE_SPI_WRITE(ADDR_WFB_CFG,0x03F0,0x2); //set dready to 8khz after pf continuous fill fixed samples no neutral

    void IRQ0_irq(){

    ADE_SPI_WRITE(ADDR_STATUS0,ADE_SPI_READ(ADDR_STATUS0,0x04),0x4); // clr page irq in stats0

    //determine if 1st half or second half is to be read.

    // make sure you can get all data out before next IRQ 


    if (ADE_SPI_READ(ADDR_WFB_TRG_STAT,0x04) && 0xf000000 == 0x70000000)
    get_1st_half_buffer();  // 0x800 to 0xBFF


    if (ADE_SPI_READ(ADDR_WFB_TRG_STAT,0x04) && 0xf000000 == 0xf0000000){
    get_2nd_half_buffer(); //0xC00 to 0xFFF

    }

  • Ok so I think this works for me. What I changed is minor but thanks a bunch.

    void read_continuous(int samples)
    {
    SPI_Write_16(ADDR_WFB_PG_IRQEN, 0x8080); //set irq for half full and full
    SPI_Write_32(ADDR_MASK0, 0x20000); //enable wfb_pg_irq
    SPI_Write_16(ADDR_WFB_CFG, 0x03F0); //set dready to 8khz after pf continuous fill fixed samples no neutral
    SPI_Write_32(ADDR_STATUS0, SPI_Read_32(ADDR_STATUS0));
    While (points_read < samples)
    {
    if ((SPI_Read_16(ADDR_WFB_TRG_STAT) & 0xf000) == 0x7000)
    {get_1st_half_buffer();  // burst read 0x800 to 0xBFF}
    if ((SPI_Read_16(ADDR_WFB_TRG_STAT) & 0xf000) == 0xf000)
    {get_2nd_half_buffer();  // burst read 0xC00 to 0xFFF}
    }
    }
  • I have been getting what looks like repeat data doing this method. Is this because I cannot read the buffer fast enough?

    When you do the half buffer read do you do something like this?

    if ((SPI_Read_16(ADDR_WFB_TRG_STAT) & 0xf000) == 0x7000)
    {
                    //get first half buffer
                    // 0x800 to 0xBFF
                    // burst read the data upto Read_Length
                    SPI_.transfer16(((0x800 << 4) & 0xFFF0) + 8, false);
                    //std::cout << "1st ADDRESS SENT\n";

                    for (int i = 0; i < Read_Element_Length && points_read < samples; i++)
                    {
                        data.IA.push_back(SPI_.transfer32(0, false));
                        data.VA.push_back(SPI_.transfer32(0, false));
                        data.IB.push_back(SPI_.transfer32(0, false));
                        data.VB.push_back(SPI_.transfer32(0, false));
                        data.IC.push_back(SPI_.transfer32(0, false));
                        bool stop = (i-1==Read_Element_Length)||(points_read-1==samples);
                        data.VC.push_back(SPI_.transfer32(0, stop));

                        points_read++;
                    }
    }
    I use my spi method: SPI_.transfer(value, cs_change)
    where the value is transfered and if cs_change is true i bring the cs pin high during the transaction and return it to low after. if its false i do not return the cs to the low position.
  • Hello mr. dave.smith

    would you please explain what causes the discontinuity in the waveform from the Fixed waveform configuration. I followed example 1 which Rev. 0 | Page 41 of 86
    Example 1: Fixed Data Rate Data, Seven Channel Samples but still I face the same issue. 

  • 1st you need to make sure you are reading the right buffer either the first half or last half.  You also need to read them fast enough to get all the data out before it gets over written.

    2nd  I think I recall that the spare locations do exist in memory but are skipped in the busts mode. the samples are streamed IA,VA,IB,VB,IC,VC,IN(if enabled) then IA,VA......

    try parsing your data based on this and see if it helps. 

    Dave