How do I use the sc_xscope_support-master directory?

Technical discussions around xCORE processors (e.g. General Purpose (L/G), xCORE-USB, xCORE-Analog, xCORE-XA).
User avatar
asid61
Active Member
Posts: 36
Joined: Sat May 31, 2014 6:39 am

How do I use the sc_xscope_support-master directory?

Postby asid61 » Wed Sep 10, 2014 6:53 am

I downloaded the directory. At first I tried using cygwin's "make" command on the makefiles, but neither did anything. Then I moved the directory to my project and tried to compile, but I got a ton of errors.
What exactly should I do get this thing working?
User avatar
sethu_jangala
XCore Expert
Posts: 589
Joined: Wed Feb 29, 2012 10:03 am

Postby sethu_jangala » Wed Sep 10, 2014 7:12 am

The repository sc_xscope_support contains API definitions for transmitting and receiving xSCOPE data between the host and the device. This repository will not build as it is and this needs to be included in the host application. The example usage of the host application is available in the following link:

https://github.com/xcore/sw_startkit_ex ... _control.c

In the above file, hook_data_received function receives all the data (Except print messages) that is sent by xSCOPE and stores in the data buffer. If you want to send data from the host to the device, you need to use xscope_ep_request_upload function.

On the device side, sample usage is available in the following link:
https://github.com/xcore/sw_startkit_ex ... control.xc

xscope_data_from_host receives data from the host.

From the below file:
https://github.com/xcore/sw_startkit_ex ... src/dsp.xc

You can see function xscope_int to send data from the device to the host.

Hope this helps.
User avatar
asid61
Active Member
Posts: 36
Joined: Sat May 31, 2014 6:39 am

Postby asid61 » Thu Sep 11, 2014 1:42 am

sethu_jangala wrote:The repository sc_xscope_support contains API definitions for transmitting and receiving xSCOPE data between the host and the device. This repository will not build as it is and this needs to be included in the host application. The example usage of the host application is available in the following link:

https://github.com/xcore/sw_startkit_ex ... _control.c

In the above file, hook_data_received function receives all the data (Except print messages) that is sent by xSCOPE and stores in the data buffer. If you want to send data from the host to the device, you need to use xscope_ep_request_upload function.

On the device side, sample usage is available in the following link:
https://github.com/xcore/sw_startkit_ex ... control.xc

xscope_data_from_host receives data from the host.

From the below file:
https://github.com/xcore/sw_startkit_ex ... src/dsp.xc

You can see function xscope_int to send data from the device to the host.

Hope this helps.
Thank you.
So essentially I use xscope functions normally on the XMOS, then run a program on the computer which will redirect xscope messages to somewhere else?
User avatar
sethu_jangala
XCore Expert
Posts: 589
Joined: Wed Feb 29, 2012 10:03 am

Postby sethu_jangala » Thu Sep 11, 2014 4:40 am

asid61 wrote: So essentially I use xscope functions normally on the XMOS, then run a program on the computer which will redirect xscope messages to somewhere else?
Yes, you can direct the xscope messages to the program running on the host. Also, you can send some information from the program running on the host to the XMOS device.
User avatar
asid61
Active Member
Posts: 36
Joined: Sat May 31, 2014 6:39 am

Postby asid61 » Fri Sep 12, 2014 4:07 am

Okay, I follewed your advice and got it to make using cygwin! And I made a simple application to connect to the xmos!
However, I need to find the port number of my xmos so I can connect to it. How do I find the port number? And for ip address, can I just use the computer's ip address?

On the xmos, how should I set up xscope? Normally I use the command
xscope_config_io(XSCOPE_IO_BASIC);
but should I use something like
xscope_start(1);
instead?
User avatar
sethu_jangala
XCore Expert
Posts: 589
Joined: Wed Feb 29, 2012 10:03 am

Postby sethu_jangala » Fri Sep 12, 2014 4:39 am

You need to run the application using realtime scope:

Example:

Code: Select all

xrun --xscope-realtime --xscope-port 127.0.0.1:12346 <bin>.xe
For the example, which I have mentioned earlier on host side should run using the following command:

Code: Select all

./packet_analyser -s 127.0.0.1 -p 12346
Exampleto configure xscope:

Code: Select all

void xscope_user_init(void) 
{
    xscope_register(2,
        XSCOPE_CONTINUOUS, "Sample_1",  XSCOPE_INT, "n",
        XSCOPE_CONTINUOUS, "Sample_2", XSCOPE_INT, "n"
        ); // xscope_register
    xscope_config_io(XSCOPE_IO_BASIC); 
}
User avatar
asid61
Active Member
Posts: 36
Joined: Sat May 31, 2014 6:39 am

Postby asid61 » Thu Sep 18, 2014 7:11 am

sethu_jangala wrote:You need to run the application using realtime scope:

Example:

Code: Select all

xrun --xscope-realtime --xscope-port 127.0.0.1:12346 <bin>.xe
For the example, which I have mentioned earlier on host side should run using the following command:

Code: Select all

./packet_analyser -s 127.0.0.1 -p 12346
Exampleto configure xscope:

Code: Select all

void xscope_user_init(void) 
{
    xscope_register(2,
        XSCOPE_CONTINUOUS, "Sample_1",  XSCOPE_INT, "n",
        XSCOPE_CONTINUOUS, "Sample_2", XSCOPE_INT, "n"
        ); // xscope_register
    xscope_config_io(XSCOPE_IO_BASIC); 
}
Thank you for the example and xrun configuration (seriously, the command line flags are tricky for me).
I think I've almost got it working, but I'm getting this error:
ERROR: socket bind.(0)
ERROR: socket listen.(0)
ERROR: socket accept.(0)

Regardless of whether I run it from the command line or from the Composer, this error pops up. Have you seen this happen before?

The realtime server does work though. If I run just the "--xscope-realtime" without "--xscope-port", then it says that a xscope server is created.
User avatar
sethu_jangala
XCore Expert
Posts: 589
Joined: Wed Feb 29, 2012 10:03 am

Postby sethu_jangala » Thu Sep 18, 2014 7:22 am

Can you attach your workspace so that I can try finding out what's causing issue in your case?

Sethu.
User avatar
asid61
Active Member
Posts: 36
Joined: Sat May 31, 2014 6:39 am

Postby asid61 » Thu Sep 18, 2014 7:47 am

sethu_jangala wrote:Can you attach your workspace so that I can try finding out what's causing issue in your case?

Sethu.
The forum uploader is glitching up, so I uploaded it to Google Drive here:

https://drive.google.com/file/d/0BzU34P ... sp=sharing

Inside is my workspace folder.
Inside I have my xmos programs (some other are stored in another folder) and my C programs. The latter is stored in the subdirectory called "Cprograms". "Cprograms" contains the host side applications. Everything is else is xmos programs.

The program on the xmos I'm having touble with is the "Nervewalk_main" program.
User avatar
sethu_jangala
XCore Expert
Posts: 589
Joined: Wed Feb 29, 2012 10:03 am

Postby sethu_jangala » Thu Sep 18, 2014 9:35 am

For testing the application, I just did a small change to the code:

Code: Select all

int main() {
    xscope_user_init();
    unsigned sample=1;
    while (1) {
        sample++;
        xscope_int(0, sample);
    }
    return 0;
}
build the code using xmake from the command line and run the binary using the following command:
xrun --xscope-realtime --xscope-port 127.0.0.1:12346 Socket_test.xe
Host side, change the hook_data_receive function as shown below:

Code: Select all

void hook_data_received(int sockfd, int xscope_probe, void *data, int data_len)
{
  // Do nothing
int * a= (int *) data;
 printf("%d", *(a));
}
Run the host application using the following command:
./dsp_control -s 127.0.0.1 -p 12346
Note:First run the host application and then run the binary on the device.

After running both the application you see the host receiving the data that is being sent by the device.
Hope this helps.

Sethu.

Who is online

Users browsing this forum: No registered users and 3 guests