Parsing .xmt files from XSCOPE?

Technical questions regarding the XTC tools and programming with XMOS.
Post Reply
User avatar
stephencwelch
Member++
Posts: 18
Joined: Sat Feb 02, 2013 4:59 am

Parsing .xmt files from XSCOPE?

Post by stephencwelch »

It would be very helpful to my workflow to capture streams from XMOS directly to my computer (in a .txt or whatever). XSCOPE seems like a slick way to do this, so I wrote a quick python script to parse .xmt files from the scope. A typical Record line from the .xmt file looks like this:

<Record Type="2" Color="2" Start="5159086270000" End="5159086270000" User="4294959873"/>

It looks like the "User" field is the signal value, and Start and Stop are timestamps (I think in picoseconds..)

Anyway, this approach seems to make sense until I plot the data from the "User" filed over time:
figure_1.png
(39.28 KiB) Not downloaded yet
figure_1.png
(39.28 KiB) Not downloaded yet
These are four audio signals that I'm scoping, and for some reason these big trend lines are showing up, although, the signal itself looks generally ok. Is anyone aware a better way to stream values to a .txt file or the correct way to interpret or parse these .xmt files?

Thanks!


User avatar
XMatt
XCore Addict
Posts: 147
Joined: Tue Feb 23, 2010 6:55 pm

Post by XMatt »

Your interpretation of the data values is correct picosecond start and end timestamps and the data from your device probe appears in the user field. It would be worth loading the file up in the xSCOPE offline viewer within the tools to check that matches up with what you are seeing.
User avatar
stephencwelch
Member++
Posts: 18
Joined: Sat Feb 02, 2013 4:59 am

Post by stephencwelch »

Thank Matt. I'm actually seeing the same behavior in xtimecomposer, but only in the Offline Scope. I've attached to shots of the same signal, one in real time, one offline. Any ideas here? I'm using xtimecomposer v13.
Attachments
xscopeNonRealTime.png
(33.73 KiB) Not downloaded yet
xscopeNonRealTime.png
(33.73 KiB) Not downloaded yet
realTimeScope.png
(75.02 KiB) Not downloaded yet
realTimeScope.png
(75.02 KiB) Not downloaded yet
User avatar
XMatt
XCore Addict
Posts: 147
Joined: Tue Feb 23, 2010 6:55 pm

Post by XMatt »

Could you post the code for the xscope_register() call you are using and the probe calls with the type of the variable being probed. I can have a look at trying to reproduce what is going on here as I would expect the real time and offline versions to look identical.

Thanks.
User avatar
stephencwelch
Member++
Posts: 18
Joined: Sat Feb 02, 2013 4:59 am

Post by stephencwelch »

In my header:

Code: Select all

#include <xscope.h>
void xscope_user_init(void);
in my .xc file:

Code: Select all

#include "feedbackDestroyer.h"
void xscope_user_init(void){
	xscope_register(4, XSCOPE_CONTINUOUS , " Channel 0 " , XSCOPE_UINT , " mV ", XSCOPE_CONTINUOUS , " Channel 1 " , XSCOPE_UINT , " mV ", XSCOPE_CONTINUOUS , " Channel 2 " , XSCOPE_UINT , " mV ", XSCOPE_CONTINUOUS , " Channel 3 " , XSCOPE_UINT , " mV ");
	xscope_config_io(XSCOPE_IO_BASIC);
}
and my call to the scope:

Code: Select all

xscope_int(0, inpSamps[0]);
xscope_int(1, inpSamps[1]);
xscope_int(2, inpSamps[2]);
xscope_int(3, inpSamps[3]);
Data type is "S32_T", defined as: typedef signed int S32_T

Thanks!
User avatar
stephencwelch
Member++
Posts: 18
Joined: Sat Feb 02, 2013 4:59 am

Post by stephencwelch »

Quick update: I just tested with a different, non-audio signal from my code, and the offline scope works great, seems to be something unique to the audio signals I'm streaming in.
User avatar
XMatt
XCore Addict
Posts: 147
Joined: Tue Feb 23, 2010 6:55 pm

Post by XMatt »

Could you try changing the xscope_register data types you are using from XSCOPE_UINT to XSCOPE_INT and re-run your audio code.

Matt
User avatar
stephencwelch
Member++
Posts: 18
Joined: Sat Feb 02, 2013 4:59 am

Post by stephencwelch »

Perfect, changing this in xscope_register fixed the issue. Thanks Matt!

Now that this is working I have a questions about sampling rate (Sampling rate for my code is 48000, but Xscope only seems to be getting samples at half this rate), I'll start a new thread for this.
User avatar
stephencwelch
Member++
Posts: 18
Joined: Sat Feb 02, 2013 4:59 am

Post by stephencwelch »

Update: sampling rate looks good now, it was an issue in my parsing script. Thanks again for the help Matt, and I'm happy to post my xmt parsing script if it would be helpful to anyone, although it's pretty slow (about 2 min for 1 million lines).
Post Reply