ts-7000
[Top] [All Lists]

[ts-7000] DIO output TS-7260

To:
Subject: [ts-7000] DIO output TS-7260
From: "Rekcut_Nod" <>
Date: Fri, 01 Jul 2011 16:46:42 -0000
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/

<Prev in Thread] Current Thread [Next in Thread>
Admin

Disclaimer: Neither Andrew Taylor nor the University of NSW School of Computer and Engineering take any responsibility for the contents of this archive. It is purely a compilation of material sent by many people to the birding-aus mailing list. It has not been checked for accuracy nor its content verified in any way. If you wish to get material removed from the archive or have other queries about the archive e-mail Andrew Taylor at this address: andrewt@cse.unsw.EDU.AU