Page 40
GP2X User Guide –
www.emuholic.com
The following must be performed each time you wish to use the USB Serial cable. Following the same
procedure as above, switch on the GP2X with the USB connected to both the GP2X and PC and once booted run
the
bash.gpe
f
i
l
e
.
T
h
e
G
P
2
X
w
i
l
l
d
i
s
p
l
a
y
a
b
l
a
c
k
s
c
r
e
e
n
a
s
b
e
f
o
r
e
;
t
h
i
s
i
s
n
o
r
m
a
l
a
n
d
w
o
n
’
t
d
i
s
p
l
a
y
a
n
y
t
h
i
n
g
e
l
s
e
until you execute a program using your PC. The PC will now be ready to receive data from your GP2X with a
suitable program as explained in the following section.
Using the Serial cable
Windows users can use the HyperTerminal program which is located in the Accessories > Communications
folder. Once loaded, create a new connection with the following settings:
Bits per second: 115200
Data bits: 8
Parity: None
Stop bits: 1
Flow control: Xon / Xoff
To find your COM port for the connection, check Device Manager > Ports (COM & LPT) and locate the Gadget
Serial device and use the COM Port it shows.
O
n
c
e
c
o
n
n
e
c
t
e
d
,
y
o
u
w
i
l
l
s
e
e
a
‘
c
o
m
m
a
n
d
p
r
o
m
p
t
’
i
n
t
h
e
H
y
p
e
r
T
e
r
m
i
n
a
l
w
i
n
d
o
w
.
I
n
t
h
i
s
e
x
a
m
p
l
e
w
e
w
i
l
l
u
s
e
the SDL Test Program which is set up to output debug information. On the HyperTerminal screen type
./sdltest.gpe
and press Return.
After a few seconds the GP2X will load the program and display the options screen as normal. Confirmation
text will have also appeared on the HyperTerminal window to show that the Serial Cable is working correctly.
Running the individual tests will output text to HyperTerminal to show the start and end of each test. Once you
are finished choose the
Quit
option to return to the GP2X Main Menu and close the HyperTerminal Program.
To use the debugging features simply use the
printf
function in your code, the below example will output text if
the SDL_SetVideoMode function returns false:
screen = SDL_SetVideoMode( 320, 240, 32, SDL_SWSURFACE);
if(!screen)
{
printf("SDL_SetVideoMode screen not initialised.\n");
}
You can use printf for a variety of tasks such as displaying variables or checking other code.