How to send data from matlab to startKit via USB

All technical discussions and projects around startKIT
quyenhuynh
Member
Posts: 12
Joined: Thu Dec 22, 2016 9:36 am

How to send data from matlab to startKit via USB

Postby quyenhuynh » Thu Dec 22, 2016 9:57 am

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
User avatar
mon2
XCore Expert
Posts: 820
Joined: Thu Jun 10, 2010 11:43 am
Contact:

Postby mon2 » Thu Dec 22, 2016 12:32 pm

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:

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.
User avatar
infiniteimprobability
XCore Expert
Posts: 910
Joined: Thu May 27, 2010 10:08 am
Contact:

Postby infiniteimprobability » Thu Dec 22, 2016 1:51 pm

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.
quyenhuynh
Member
Posts: 12
Joined: Thu Dec 22, 2016 9:36 am

Postby quyenhuynh » Sat Dec 24, 2016 4:13 am

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

Return to “startKIT”

Who is online

Users browsing this forum: No registered users and 5 guests