I'm attempting to run the TS sample from:
ftp://ftp.embeddedarm.com/ts-arm-sbc/ts-7260-linux/samples/button.c
modified slightly to toggle output on the DIO1 header, rather than the on-board
LEDs. I'm monitoring DIO1 pin 9 (DIO_4) with a volt meter across a resister to
ground, and it reads a constant 5.6mV, even when the program enters into the
toggle loop.
Can anyone tell me what I need to do differently?
Don
int main(int argc, char **argv)
{
volatile unsigned int *PBDR, *PBDDR, *GPIOBDB;
int i;
unsigned char state;
unsigned char *start;
int fd = open("/dev/mem", O_RDWR|O_SYNC);
start = mmap(0, getpagesize(), PROT_READ|PROT_WRITE, MAP_SHARED, fd,
0x80840000);
PBDR = (unsigned int *)(start + 0x04); // port b
PBDDR = (unsigned int *)(start + 0x14); // port b direction register
GPIOBDB = (unsigned int *)(start + 0xC4); // debounce on port b
*PBDDR = 0xf0; // upper nibble output, lower
nibble input
*GPIOBDB = 0x01; // enable debounce on bit 0
state = *PBDR; // read initial state
while (state & 0x01) { // wait until button goes low
state = *PBDR; // remember bit 0 is pulled up
with 4.7k ohm
}
// blink 5 times, sleep 1 second so it's visible
for (i = 0; i < 5; i++) {
*PBDR = 0xf0;
sleep(1);
*PBDR = 0x00;
sleep(1);
}
close(fd);
return 0;
}
------------------------------------
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/ts-7000/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/ts-7000/join
(Yahoo! ID required)
<*> To change settings via email:
<*> To unsubscribe from this group, send an email to:
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|