Page 1 of 2
XSMB-L1 Works !
Posted: Mon Aug 08, 2011 7:29 pm
by ale500
Hallo,
if you haven't seen my XSMB project here is the page
https://www.xcore.com/projects/xsmb-l1
Today I was able to finally connect it together with the XTAG to the computer and it was recognized ! :)... Not bad !. I hope everything I put in there works as well !. Here are the pics...
Re: XSMB-L1 Works !
Posted: Mon Aug 08, 2011 7:29 pm
by ale500
And here the panel (Only 3 attachments per post...)
Edit: I re-uploaded the design files, the old ones were incomplete. Please re-download if you have the old ones. The panel-xm.brd contains a panelized version of two MB and two stamps. YOu have to cut them yourself because the sizes do not fit for a V-grooved version :(... there is always room for improvement!
Re: XSMB-L1 Works !
Posted: Mon Aug 08, 2011 7:41 pm
by Bianco
So is the VGA tied to the XMOS or FPGA?
Re: XSMB-L1 Works !
Posted: Mon Aug 08, 2011 7:47 pm
by ale500
The VGA Port is tied to the FPGA, the FPGA has extra 512k SRAM and 4 pins (2 bit Xlink) to the L1. There is on the left size a connector for a TFT like the one on the picture (powered by a XC-1 so far but the software should run on the L1 without changes... ).
The display has a 6 bit interface (24 bits but cut down for memory reasons) and needs vsync and hsync besides, clock (10 MHz in this case) and display on/of, data enable and backlight. I'm using text mode because I wanted to use the external SRAM in the L1 for the display... time for more soldering ! I can post the code, it is very straightforward, clocked/buffered ports, clock output and a bit of magic ;-)
Re: XSMB-L1 Works !
Posted: Mon Aug 08, 2011 7:57 pm
by ale500
I have written several drivers for VGA output for the G4... they were available on the old xlinkers site... I can re-post them, both graphics and text based (there was a circuit too)...
Re: XSMB-L1 Works !
Posted: Mon Aug 08, 2011 8:14 pm
by ale500
Here is the TFT code so far...
Code: Select all
/*
* tftmain.xc
*
* Created on: 06.01.2011
* Author: pacito
*/
#include <xs1.h>
#include <platform.h>
#define YLINES (272/8)
#define XCHARS (480/8)
on stdcore[0]: out port pDON = XS1_PORT_1O; // X0D38
on stdcore[0]: out port pVSYNC = XS1_PORT_1N; // X0D37
on stdcore[0]: out port pHSYNC = XS1_PORT_1M; // X0D36
on stdcore[0]: out port pBL = XS1_PORT_1P; // X0D39
on stdcore[0]: out port pPCLK = XS1_PORT_1D; // X0D11
on stdcore[0]: out buffered port:32 pRGB = XS1_PORT_8C;
on stdcore[0]: clock clk = XS1_CLKBLK_1;
on stdcore[0]: unsigned char textbuffer[XCHARS*YLINES*2] =
{ 0x41, 9, 0x42, 9, 0x43, 5, 0x44, 5 };
extern unsigned char font[]; // 8x8 font
extern unsigned int translate[]; // nibble to word translation table
#pragma unsafe arrays
void TFTRefresh( void )
{
unsigned int x, y, time = 0, yptr;
unsigned int c, rgb;
unsigned int textptr, fontptr, ones = 0x01010101;
unsigned char color;
set_clock_div(clk, 5); // div 5*2 = 10 MHz
configure_out_port_no_ready(pHSYNC, clk, 0);
configure_out_port_no_ready(pVSYNC, clk, 0);
configure_out_port_no_ready(pRGB, clk, 0);
configure_port_clock_output(pPCLK, clk);
start_clock(clk);
pBL <: 1;
pVSYNC <: 1;
pHSYNC <: 1;
pDON <: 0;
pRGB <: 0;
// clock
while (1) {
// veritcal back porch, four empty lines
for (y = 0; y < 4; y++) {
time += 490; pHSYNC @ time <: 0;
time += 4; pHSYNC @ time <: 1;
}
textptr = 0;
// visible
yptr = 0;
for (y = 0; y < 272; y++) {
// we need to wait 8 clocks for back porch
time += 4; pRGB @ time <: 0; // 8 clocks passed already
fontptr = textbuffer[textptr++] << 3; // pointer to the font
color = textbuffer[textptr++]; // foreground color
for (x = 0; x < XCHARS; x++) {
rgb = ones * color;
c = font[fontptr+yptr];
pRGB <: (unsigned int) (translate[c>>4] & rgb) | ones;
fontptr = textbuffer[textptr++] << 3; // pointer to the font
color = textbuffer[textptr++]; // foreground color
pRGB <: (unsigned int) (translate[c&15] & rgb) | ones;
}
yptr += 1;
if (yptr == 8)
{
textptr -= 2;
yptr = 0;
}
else
textptr -= 2*XCHARS+2;
pRGB <: 0;
time += 486; pHSYNC @ time <: 0;
time += 4; pHSYNC @ time <: 1;
}
// front porch
for (y = 0; y < 8; y++) {
time += 490; pHSYNC @ time <: 0;
time += 4; pHSYNC @ time <: 1;
}
pVSYNC <: 0; // VSYNC
for (y = 0; y < 8; y++) {
time += 490; pHSYNC @ time <: 0;
time += 4; pHSYNC @ time <: 1;
}
pVSYNC <: 1;
pDON <: 1;
}
}
int main(void)
{
par {
on stdcore[0]: TFTRefresh();
}
return 0;
}
The translate table is:
unsigned int translate[] = {
0x00000000,
0xff000000,
0x00ff0000,
0xffff0000,
0x0000ff00,
0xff00ff00,
0x00ffff00,
0xffffff00,
0x000000ff,
0xff0000ff,
0x00ff00ff,
0xffff00ff,
0x0000ffff,
0xff00ffff,
0x00ffffff,
0xffffffff
};
Re: XSMB-L1 Works !
Posted: Mon Aug 08, 2011 8:21 pm
by Bianco
ale500 wrote:I have written several drivers for VGA output for the G4... they were available on the old xlinkers site... I can re-post them, both graphics and text based (there was a circuit too)...
Yeah i'm interested in using VGA in the future, what resolution could you get on a G4?
Re: XSMB-L1 Works !
Posted: Mon Aug 08, 2011 8:25 pm
by ale500
I did 320x200, 320x240, 640x400 & 640x480. It may be possible to get 800x600 (I tried 400x300)... the thing is the number of colors you will get...
Re: XSMB-L1 Works !
Posted: Mon Aug 08, 2011 9:20 pm
by ale500
Here are the sources for 320x240 4bpp. I probably should update it because this used to be compiled with the version 8 of the tools...
I have somewhere more advanced drivers...
Re: XSMB-L1 Works !
Posted: Tue Aug 09, 2011 10:47 am
by phalt
Wow this is great. I wasn't working with XMOS when you posted the project - did you design the entire board yourself?
What are you planning to do with it?
Don't forget to update your project with the new images!