ts-7000
[Top] [All Lists]

[ts-7000] Re: Problem with DIO1 on TS7300

To:
Subject: [ts-7000] Re: Problem with DIO1 on TS7300
From: "Alvaro Aguirre" <>
Date: Tue, 14 Nov 2006 19:59:07 -0300
I solved it... I'm not so sure what's the difference but I paste the code if anyone in the future has the same problem. I get the answer on http://www.simtec.co.uk/appnotes/AN0014/ .

#include <sys/mman.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>

void button_init(void){
    void *PBDR, *PFDR, *PBDDR, *PFDDR;
    void *start;
  int fd;
   
    //Abrimos el dev/mem
    fd=open("/dev/mem", O_RDWR | O_SYNC);

    //Obtenemos el puntero a la memoria   
    start=mmap(0, getpagesize(), PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0x80840000);
   
    //Asignamos los punteros a los registros necesarios
    PBDR=        (start + 0x04);     // port b;
    PBDDR=    (start + 0x14);     // port b ddr;
    PFDR=        (start + 0x30);     // port f;
    PFDDR=    (start + 0x34);     // port f ddr;
   
    //seteamos los ddr y debouncing
    *(volatile unsigned char *)PBDDR &= 0x04;
    *(volatile unsigned char *)PFDDR &= 0xfd;
   
    while(1){
        printf("%x,%x\n",*(volatile unsigned char *)PBDR,*(volatile unsigned char *)PFDR);
        usleep(100000);
    }
}

On 11/14/06, Alvaro Aguirre <> wrote:
I check the memory and when i put a signal on the pin5 i get it mapped on 0x20 (bit 1) which is Port E bit 1!?
Please help me!


On 11/14/06, Alvaro Aguirre <> wrote:
I wrote a very simple function to get readings from the pin 1,3,5,7,9 and 11 from DIO1 on my TS7300 but the results are confusing.
The value of *PFDR changes when pin 1,3,7,9 and 11 are grounded and *PBDR doesn't change at all.
Reading the TS7300 manual *PBDR must change when signals come from pin 1,3,7,9 and 11 and *PFDR on pin 5. What i'm doing wrong? i'm using a kernel builded by my self (with a fix only on the framebuffer)... please help!

#include <sys/mman.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>

void button_init(void){
    volatile unsigned int *PBDR, *PFDR;
    volatile unsigned int *PBDDR, *PFDDR, *GPIOBDB, *GPIOFDB;
    int *offset;
  int fd;
  
    //Abrimos el dev/mem
    fd=open("/dev/mem", O_RDWR | O_SYNC);

    //Obtenemos el puntero a la memoria    
    offset=mmap(0, getpagesize(), PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0x80840000);
    
    //Asignamos los punteros a los registros necesarios
    PBDR=        (unsigned int *)(offset + 0x04);     // port b;
    PBDDR=    (unsigned int *)(offset + 0x14);     // port b ddr;
    PFDR=        (unsigned int *)(offset + 0x30);     // port f;
    PFDDR=    (unsigned int *)(offset + 0x34);     // port f ddr;
    GPIOBDB=(unsigned int *)(offset + 0xc4);     // port b debouncing;
    GPIOFDB=(unsigned int *)(offset + 0x64);     // port f debouncing;
    
    //seteamos los ddr y debouncing
    *PBDDR &= 0x04;        //Todos entradas menos el DIO_2
    *PFDDR &= 0xfd;        //Solo entrada el DIO_8
    *GPIOBDB |= 0xfb;    //debounce en todos los bits menos DIO_2
    *GPIOFDB |= 0x02;    //debounce en el DIO_8
    
    while(1){
        printf("%x,%x\n",*PBDR,*PFDR);
        usleep(100000);
    }
}


__._,_.___


SPONSORED LINKS
Single board computer Hardware Computer running slow
Linux os Single board

Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: =Email Delivery: Digest | m("yahoogroups.com?subject","ts-7000-fullfeatured");=Change Delivery Format: Fully Featured">Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | =Unsubscribe

__,_._,___
<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