How do I use the sc_xscope_support-master directory?

Technical discussions around xCORE processors (e.g. xcore-200 & xcore.ai).
User avatar
asid61
Active Member
Posts: 36
Joined: Sat May 31, 2014 6:39 am
Contact:

How do I use the sc_xscope_support-master directory?

Post by asid61 »

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

Post by sethu_jangala »

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
Contact:

Post by asid61 »

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

Post by sethu_jangala »

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
Contact:

Post by asid61 »

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

Post by sethu_jangala »

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
Contact:

Post by asid61 »

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

Post by sethu_jangala »

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
Contact:

Post by asid61 »

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:



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

Post by sethu_jangala »

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.
Post Reply