Quickest Comm

Technical discussions related to any XMOS development kit or reference design. Eg XK-1A, sliceKIT, etc.
kster59
XCore Addict
Posts: 162
Joined: Thu Dec 31, 2009 8:51 am

Post by kster59 »

1/84ns=12 mhz

It seems unnecessary pain to get a beagleboard when atom pcs are low power, small and cheap now.

Cortex A8 is an ARM processor and you're stuck with WinCE or embedded Linux instead of my preference of full Windows. Intel IPP makes it a lot faster than other options and you can scale up to a core2duo if you need more processing power.

Again the question is why read a video feed then send it over usb/ethernet when they make USB and ethernet and wifi cameras?


User avatar
rp181
Respected Member
Posts: 395
Joined: Tue May 18, 2010 12:25 am
Contact:

Post by rp181 »

I already had this camera sitting around for awhile, so I started trying to get it to work. Cameras that already stream are very expensive, as I want to match distance with the wireless transmitter (40 miles, LOS). Linux is perfectly fine for me. This is in the long-term. For now, Image streaming is just an auxillary view for the GCS (much easier to control).
User avatar
lilltroll
XCore Expert
Posts: 956
Joined: Fri Dec 11, 2009 3:53 am
Location: Sweden, Eskilstuna

Post by lilltroll »

rp181 wrote:I'le be honest, I have no idea what your talking about. I have never worked with binary numbers directly nor bitwise shifting (ile look into it more).

When you say:

Code: Select all

Double_nibble = ((Byte1>>4)<<4) + (Byte2 >>4);
Does this mean you combine 2 4-bit values (byte1, byte2) to get the resultant bit (8 bits?), and then take 4 of these and store it?

What is the LSRI instruction?

What exactly does "masking" do, and which is preferable?

What is "disasm"? Does this just mean extracting the original values form the combined result?
You can read about all the instructions in this manual: http://www.xmos.com/system/files/xs1_en.pdf , use search in the pdf and it will help you find it.
The manual shows all available instruction.

To check what the C compiler translate the code to, you have the tool in the XDE to check the result.
Check out http://en.wikipedia.org/wiki/Disassembler thats the disasm

As you earlier said, it's about rounding: In MATLAB on a PC or another hi level tool we could have written
round(Byte1/256) to reduce the value to 4 bit's. Doing that operation would have taking many operations to calculate on any machine.
In this embedded world we need to think about doing things fast. Instead of dividing something with 2^n, we shift the bits by n steps. (The rounding mode will be similar to round to - Infinity)

To make thing even faster we try to use the Immediate instruction when possible.
Compare ADD and ADDI for an example in the xs1_en.pdf

XMOS have even more tricks. It's possible to read an port and manipulate data in the same instruction.

Check out the XS1 Hardware routines (xs1.h)
{Your local disk}\XMOS\DesktopTools\10.4\doc\libs\html\index.html

Check out:
void set_port_shift_count (void port p, unsigned n)
Sets the shift count for a port.

unsigned partin (void port p, unsigned n)
Performs an input of the specified width on a buffered port.

void partout (void port p, unsigned n, unsigned val)
Performs an output of the specified width on a buffered port.

Is it a 8 bit parallel communication line from the camera ? Do you have a clock available e.g. sync. communication ?
I do not have the overview here, but the smart way is maybe to change to a 4 bit port (Just in XC) for the most significant bits instead of using a 8 bit port. Use port doublebuffering to collect 8 pieces of 4 bit's data without using any instruction during the time.

PS. You will probably find out during the road that you will have to rewrite parts of you code to make it X times more efficient. Regarding reading/writing to ports there is many tricks to collect 32bit´s of data without bothering the CPU. DS.
Probably not the most confused programmer anymore on the XCORE forum.
User avatar
rp181
Respected Member
Posts: 395
Joined: Tue May 18, 2010 12:25 am
Contact:

Post by rp181 »

Thanks for the document, never found that before.

Yes, the data port is a 8-bit parallel port. The data is synced with PCLK, VSYNC, and HREF. You wait for VSYNC to toggle, wait for HREF to go High, and while high, read everytime PCLK goes high. HREF going low and high signifies a new line of pixels, and VSYNC signifies the start and termination of a frame.
User avatar
lilltroll
XCore Expert
Posts: 956
Joined: Fri Dec 11, 2009 3:53 am
Location: Sweden, Eskilstuna

Post by lilltroll »

rp181 wrote:Thanks for the document, never found that before.

Yes, the data port is a 8-bit parallel port. The data is synced with PCLK, VSYNC, and HREF. You wait for VSYNC to toggle, wait for HREF to go High, and while high, read everytime PCLK goes high. HREF going low and high signifies a new line of pixels, and VSYNC signifies the start and termination of a frame.
Ahha, I'm been playing with a 320*240 18 bit colour LCD during the week. I guess our tasks are very similair, but on the different direction.

Code: Select all

void lcd_init(linebuffer &frame,streaming chanend c_render, out port HSYNC_port, out port DCLK_port, out port DTMG_port, out port RGB_port) {
    timer t;
    unsigned time;
    unsigned lineCount;
    int rowCount;
    int x,buff;


    set_clock_off(clk);
    set_clock_on(clk);

    set_clock_div(clk, LCD_CLKDIV);

    set_port_use_off(HSYNC_port);
    set_port_use_on(HSYNC_port);
    HSYNC_port <: 0;

    set_port_use_off(DTMG_port);
    set_port_use_on(DTMG_port);
    DTMG_port <: 0;

    set_port_use_off(DCLK_port);
    set_port_use_on(DCLK_port);
    // Don't output on DCLK here
    // It will go to output mode

    set_port_inv(DCLK_port);

    set_port_clock(HSYNC_port, clk);
    set_port_clock(DCLK_port, clk);
    set_port_clock(DTMG_port, clk);
    set_port_clock(RGB_port, clk);

    set_port_mode_clock(DCLK_port);      // Outclock
//    led[0] <: 0; // First LED ON = INIT OK
    start_clock(clk);
    c_render <: 0; //Request to render first line
    c_render <: 1;//Request to render second line

    while(1) {
        t :> time;
        t when timerafter(time+T_VBP) :> time;
        c_render <: 0; //Send new frame signal
        for(lineCount = 0; lineCount < LCD_HEIGHT_PX; lineCount++) {
        	t when timerafter(time + T_WH) :> time;
            HSYNC_port <: 1;
            t when timerafter(time+T_HBP) :> time;
            DTMG_port <: 1;

            for(rowCount = 0; rowCount < LCD_WIDTH_PX; rowCount++)
                RGB_port <: frame.data[lineCount%2][rowCount];  //Draw column

            c_render <: lineCount+2; //Request to start render 2 lines ahead
            DTMG_port <: 0;
            t :> time;
            t when timerafter( time + T_HFP) :> time;
            HSYNC_port <:0;
        }
      //  led[2] <: 0; //Passes one frame
    }

}
Check out http://www.xmos.com/system/files/portXS1.pdf Chapter 3.1.1
and use a 4-bit ports: 32bits (8 elements). FIFO, e.g. fill the buffer with eight 4-bit pixel samples (if possible).
Probably not the most confused programmer anymore on the XCORE forum.
User avatar
rp181
Respected Member
Posts: 395
Joined: Tue May 18, 2010 12:25 am
Contact:

Post by rp181 »

Thanks for that. Going to be awhile before i can try, traveling
Post Reply