Back to the main page.

Bug 2872 - implement support for Jinga-Hi JAGA16 system

Reported 2015-03-28 09:17:00 +0100
Modified 2019-08-10 12:41:35 +0200
Product: FieldTrip
Component: realtime
Version: unspecified
Hardware: PC
Operating System: Mac OS
Importance: P5 enhancement
Assigned to: Robert Oostenveld
Depends on:
See also:

Robert Oostenveld - 2015-03-28 09:17:17 +0100

Robert Oostenveld - 2015-03-28 09:18:41 +0100

There are a number of things to be implemented, but I'll start with the file format.

Robert Oostenveld - 2015-03-28 09:22:24 +0100

first version of file reading has been implemented. mac011> svn commit Sending ft_read_data.m Sending ft_read_header.m Adding private/jaga16_packet.m Transmitting file data ... Committed revision 10282.

Robert Oostenveld - 2015-03-28 10:07:07 +0100

mac011> svn commit Sending ft_filetype.m Sending ft_read_data.m Sending ft_read_header.m Transmitting file data ... Committed revision 10283. it now works for the regular files and for the raw UDP stream (without timestamps, useful with netcat debugging). File format is also auto detected. try this: hdr = ft_read_header(filename); dat = ft_read_data(filename);

Robert Oostenveld - 2015-03-28 12:14:41 +0100

mac011> svn commit fileio/ realtime/example/ Sending fileio/private/jaga16_packet.m Sending realtime/example/ft_realtime_signalproxy.m Adding realtime/example/private/jaga16_packet.m Transmitting file data . Committed revision 10285. mac011> svn commit Adding ft_realtime_jaga16proxy.m Transmitting file data . Committed revision 10286. I made a first implementation to copy data from the jaga16 to the fieldtrip buffer using native MATLAB (and a relatively standard mex file for tcp/udp support). So this does not use any code from jinga-hi. You can test it with on the command line in one terminal: cd fieldtrip/realtime/bin/maci64 ./buffer on the command line in another terminal: cd fieldtrip/realtime/bin/maci64 ./bufferViewer in MATLAB: addpath fieldtrip/realtime/example cfg = []; ft_realtime_jaga16proxy(cfg); and then click "connect" in the bufferViewer. The bufferViewer is not so fast in display and there is too much polling going on, so the computer gets a bit clogged up. These are things that need to be improved. If you do cfg = []; = 1:2; cfg.decimate = 2; ft_realtime_jaga16proxy(cfg); the demonstration runs smoother. Note that the decimation is a kludge.

Robert Oostenveld - 2015-03-28 14:43:03 +0100

I just made a start with an plain C implementation of a very basic jaga2ft executable. The aim is to have it compile as command-line application on all platforms (linux, windows, osx). The code is contained in fieldtrip/realtime/src/acquisition/jaga, see also and mac011> svn commit Adding jaga Adding jaga/Makefile Adding jaga/jaga2ft.c Transmitting file data .. Committed revision 10289. Note that at the moment my focus is only on getting some bytes from UDP.

Robert Oostenveld - 2015-03-29 11:07:32 +0200

I completed the C implementation of jaga2ft, which is a command line application that copies data from UDB 55000 to the fieldtrip buffer. As expected, it runs with much less CPU and system load than the ft_realtime_jaga16proxy MATLAB function. I also did some cleanups of some header files (a.o. converting tabs to spaces and added some comments). mac011> svn commit Sending fileio/private/jaga16_packet.m Adding (bin) realtime/bin/maci64/jaga2ft Sending realtime/online_eeg/ft_realtime_ouunpod.m Sending realtime/src/acquisition/README Sending realtime/src/acquisition/jaga/jaga2ft.c Sending realtime/src/buffer/src/buffer.h Sending realtime/src/buffer/src/cleanup.c Sending realtime/src/buffer/src/compiler.h Sending realtime/src/buffer/src/message.h Sending realtime/src/buffer/src/platform_includes.h Sending realtime/src/buffer/src/rdadefs.h Sending realtime/src/buffer/src/rdaserver.c Sending realtime/src/buffer/src/rdaserver.h Sending realtime/src/buffer/src/socketserver.h Sending realtime/src/buffer/src/swapbytes.h Sending realtime/src/buffer/src/tcprequest.c Transmitting file data ................ Committed revision 10294.

Robert Oostenveld - 2015-03-29 12:34:13 +0200

I just updated the documentation on The description with the optional hostname and port still needs to be implemented.

Robert Oostenveld - 2015-03-29 13:55:21 +0200

(In reply to Robert Oostenveld from comment #7) The hostname and port arguments are now optional. Default is to start a local buffer. See help for details. mac011> svn commit src/acquisition/brainproducts/rda2ft.c src/acquisition/jaga/jaga2ft.c bin/maci64/jaga2ft bin/maci64/rda2ft Sending bin/maci64/jaga2ft Sending bin/maci64/rda2ft Sending src/acquisition/brainproducts/rda2ft.c Sending src/acquisition/jaga/jaga2ft.c Transmitting file data .... Committed revision 10297.

Robert Oostenveld - 2015-03-29 19:44:09 +0200

Some small code cleanups were needed for compilation on linux. roboos@mentat002> svn commit Adding (bin) realtime/bin/glnxa64/jaga2ft Sending realtime/src/acquisition/jaga/jaga2ft.c Transmitting file data .. Committed revision 10302. mac011> svn commit Sending realtime/bin/maci64/jaga2ft Transmitting file data . Committed revision 10303.

Robert Oostenveld - 2015-04-04 17:07:18 +0200

I just compiled the jaga2ft realtime application on my Raspberry Pi (which has raspbian on it). It compiles out of the box, which is nice since it has a big-endian CPU and compatibility is not trivial! I connected the RPi over wifi to my home network and over wired ethernet to the router, and it works just fine: data is received from UDP and I can read and process data by connecting over wifi. Note that wifi is not needed, it is just that I don't have a screen or keyboard attached to the RPi and hence prefer connecting from another computer. Local processing of the data should not be a problem at all. robert@thuis ~/realtime $ svn commit Adding (bin) bin/raspberrypi/jaga2ft Sending bin/raspberrypi/modeeg2ft Sending bin/raspberrypi/modeeg2ft_2chn Sending bin/raspberrypi/playback Sending bin/raspberrypi/recording Sending bin/raspberrypi/serial_event Sending src/ Transmitting file data ....... Committed revision 10321.

Robert Oostenveld - 2015-06-21 06:47:22 +0200

I implemented the sample adjustment for incoming events. They are now not jittered any more with the blocksize of the data. The timing of the previous data block is used to compute the approximate sample number. mac011> svn commit Sending bin/maci64/buffer Sending bin/maci64/buffer_rda Sending bin/maci64/playback Sending bin/maci64/recording Sending bin/maci64/sine2ft Sending src/buffer/src/Makefile Adding src/buffer/src/clock_gettime.c Sending src/buffer/src/dmarequest.c Adding src/buffer/src/gettimeofday.c Adding src/buffer/src/osx Adding src/buffer/src/osx/clock_gettime.h Sending src/buffer/src/platform_includes.h Sending src/buffer/src/tcpsocket.c Sending src/buffer/src/util.c Adding src/buffer/src/win32/gettimeofday.h Deleting src/buffer/src/win32/poll.c Transmitting file data .............. Committed revision 10463.

Robert Oostenveld - 2017-04-07 09:12:37 +0200

the jaga16 has been supported for some time now. Time to close this issue.

Robert Oostenveld - 2019-08-10 12:35:22 +0200

This closes a whole series of bugs that have been resolved (either FIXED/WONTFIX/INVALID) for quite some time. If you disagree, please file a new issue on

Robert Oostenveld - 2019-08-10 12:41:35 +0200

This closes a whole series of bugs that have been resolved (either FIXED/WONTFIX/INVALID) for quite some time. If you disagree, please file a new issue on