Group Abstract Group Abstract

Message Boards Message Boards

Using Redpitaya board with Mathematica ?

Posted 11 years ago
POSTED BY: Christian Neel
7 Replies

Dear @Christian Neel could you pease make a new post completely dedicated to that material on this forum (cross-post)?

We have a special Mathematica Add-Ons group for package introductions.

You can also attach files to the post if needed.

Thanks!

POSTED BY: Vitaliy Kaurov

Ok will do. Thanks

POSTED BY: Christian Neel

Done. See : here

POSTED BY: Christian Neel

Hi Ian,

Thanks for the feedback! You are right, at the present time my next move will be to learn more about calling external programs with Mathematica, then accessing the board via the various API's that are provided by Red Pitaya.

Christian

POSTED BY: Christian Neel

Hi Christian,

At the moment, the only supported ARM board to run Mathematica natively on is the Raspberry Pi with Debian. If you wish to run Mathematica, you can either try and sign up for the prerelease program by sending an email to prerelease@wolfram.com, or you can simply wait for the generalized Linux-ARM kernel, but we do not have any kind of time estimate for when that will be released.

At this point, you are probably best suited to doing as you have found and reading the data off the device's serial port into another computer running Mathematica. I'm not too familiar with this device, nor it's tools like acquire that you use, but that is probably your best bet for interfacing with the device at the moment.

Ian

POSTED BY: Ian Johnson

I finally succeeded to get some data to and from the board by a very clumsy method but it is a beginning. The best would be to have direct access to the SCPI served that is provided on the Red Pitaya and sending string command, or better go thru MathLink but I am not a that level yet. Anyway I just got that, by connecting the ADC to the DAC:

enter image description here

I attach the notebook I just used for this (code summary below). It is emulating the input in a console, sending line command at high level with the commands "acquire" and "generate" provided by the board.

Christian


Open device

pitaya = DeviceOpen[ "Serial", {"COM5", "BaudRate" -> 115200, "ReadBufferSize" -> 16384, "StopBits" -> 1, "Parity" -> None}]

Note that the serial port can be used as a console like with Hypeterminal or PuTTy in Serial Mode.

Generate signal on chanel 1 DAC device

DeviceWrite[pitaya, "generate 1 1 750000 sine" <> "\n"];
Pause[1];
DeviceReadBuffer[pitaya] // FromCharacterCode

Record signal on chanel 1 ADC device (connected to chanel 1 DAC)

AbsoluteTiming[n = 500;(*want n samples*)
DeviceWrite[pitaya, "acquire " <> ToString[n] <> "\n"];
 (*the high level "acquire" function that wortks either under SSH terminal or Serial terminal from USB FTDI"*)
 s = Table[DeviceReadBuffer[pitaya, "ReadTerminator" -> "\r"], {n + 1}];
 DeviceReadBuffer[pitaya]; (*flush the rest*)
  s = Cases[s // FromCharacterCode // StringSplit // ToExpression, {_Integer, _Integer}];]

ListPlot[s // Transpose, Joined -> True, PlotRange -> All]
Attachments:
POSTED BY: Christian Neel
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard