Page 1 of 1

How to send data from matlab to startKit via USB

Posted: Thu Dec 22, 2016 9:57 am
by quyenhuynh
I would like to send a matrix (which calculated) from Matlab to startKit board then use it in my programming. I have referred some the ways as using Xscope bi-directional endpoint, but I confused about the way use as well as it's characteristics. Therefore I would like to ask:
1/ I using startKit board so wether I must buy a XTAG2 transfer buffer to connect with USB on board for the data sending/receiving between startKIT and Matlab or I only need a usb cable to connect between them?
2/ Please give me the way to connect between them if Xscope can do this (like how set up localhost, port for Matlab to startKit identify)
thanks all
Best,
Quyen

Re: How to send data from matlab to startKit via USB

Posted: Thu Dec 22, 2016 12:32 pm
by mon2
Hi Quyen.

1) The StartKit is a standalone solution with XTAG built inside the XMOS CPU. Only an external USB cable is required to power and communicate with the StartKit via this USB cable.

2) Please review this article which should be suitable for your project (example code is also posted on this webpage):

https://www.xmos.com/support/appnotes/AN00152

3) Another idea is to upload USB CDC code to the StartKit which will then allow for the StartKit to appear like a standard serial port to the host computer. Using this serial port (CDC example code), you should be able to follow this example:

http://www.xcore.com/forum/viewtopic.php?f=47&t=4020

CDC Code example:
https://www.xmos.com/support/appnotes/AN00124

Use the most current xTimeComposer tool for your project.

If you do proceed with the CDC example, test against your box with the supplied device driver inside the code download. If the driver does not install, then consider to alter the USB IDs to allow for another driver package to install on all current operating systems.

Read this thread:
https://www.xcore.com/forum/viewtopic.php?f=8&t=3191

Summary: CDC code is a very commonly supported method to send and receive data across assorted operating systems. To install on Windows, you will require a signed device driver package which will then require the use of compatible USB IDs.

Re: How to send data from matlab to startKit via USB

Posted: Thu Dec 22, 2016 1:51 pm
by infiniteimprobability
Another idea is to upload USB CDC code to the StartKit
The USB port on the start kit is dedicated to debug - it's not a user port. So xscope is probably the way to go in this case.

Another option (if you don't need real time) is to load a file at startup. This will go over JTAG. Slow, but works and is very simple..

Code: Select all

    #include <stdio.h>
    FILE            * movable InFile;
    InFile = fopen("lovely_data.dat", "rt")) == NULL) 
etc.

Re: How to send data from matlab to startKit via USB

Posted: Sat Dec 24, 2016 4:13 am
by quyenhuynh
Thanks @mon2 and @infiniteimprobability very much. Because I would like send data from matlab to startKit in the real time so I think Xscope will be more suitable than another or not?I have read the document about it but I not know how to establish with matlab as localhost and port, I must use what protocol in matlab to interface with startKit?(USB, UDP, TCP/IP or another..). Please help me