Monitor Buffer problem

Altair Forum User
Altair Forum User
Altair Employee
edited November 2020 in Community Q&A

Submitted by ThomasV on Tue, 07/28/2015 - 19:12 

 

I want to use the Monitor Buffer blocks to gather encoder data (position output of eQEP block when I'm controlling a motor) and write this to a file. Then I will analyze the results in Matlab, so I want no data to be missing.

How can I set up the Monitor Buffer blocks in order to do this? I have tried to start from scratch and just try to write the data of a simulated ramp signal, but the buffer is updated way too slowly. I have attached the diagrams (MonitorBufferTest.vsm) I used. The input to the Buffer Write 0 block is a ramp that goes from 0 to 25 in 25 seconds, the sampling rate is 10 kHz and the buffer size is 1000. As trigger I feed a pulse train with frequency of 10 Hz. The way I see it, this should result in the buffer being rewritten 10 times per second, and there should be 10000 samples in 1 second of data gathering.

Now, when I try to run this in the debug diagram, the buffer is being read at a much lower frequency (I compare that frequency to the pulse train of 10 Hz in the plot on the right side, picture 'BufferTrig.png' is attached).

I assume this means that the MCU doesn't write data to the buffer at 10 kHz, so it takes a longer time to fill the 1000 samples in the buffer. What is the cause of this? Should I configure these blocks in a different way?

Note that my starting point was the 'MonitorBufferTriggerAndTimeCheck.vsm' provided by VisSim, but even then I couldn't get the buffers to work correctly.

Also, if there is a better method for gathering measurement data and writing this to a file without losing some parts, I'd be glad to hear it.

<?xml version="1.0" encoding="UTF-8"?>BufferTrig.PNG

Unable to find an attachment - read this blog

Tagged:

Answers

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited June 2016

    Submitted by pete on Sat, 08/01/2015 - 04:19.

    The problem is the buffer is not rewritten until the PC reads it completely. The buffer must traverse the 200Hz JTAG link, so there will be some delay between buffer writes as you are writing to the buffer at 15 kHz. If you don't need the full 15 kHz sample rate, you can put the monitor buffer write inside a compound clocked at 500 Hz or so and get 30x more time covered per buffer. Pete