ts-7000
[Top] [All Lists]

[ts-7000] Re: [ts7400] program crash when writing GPIO data register

To:
Subject: [ts-7000] Re: [ts7400] program crash when writing GPIO data register
From: "yuezhu92" <>
Date: Fri, 07 May 2010 10:26:37 -0000
Thanks Phil,

I added the check into my code.
and I've figured out the problem.

I have conflict in GPIO register settings:
I have DIO13 IRQ-pin enabled in control register, and at the same time DIO13 
configured as output in direction register -> and i have outputed an 1 on DIO13.

Since i haven't registered an interrupt handler. (This interrupt (number 33) is 
shared with UART and SD driver), outputing an '1' may have triggered an 
interrupt,and then have caused a kernel panic.

----------------------------------------------------------------
And now fortunately i got a second problem, which is maybe too trivial for the 
forum. (still put it here)

I'm trying to drive the GPIO interface of TS-7400 with GPBUS variant referring 
to the "ts-7400-manual.pdf" page 32-33 with user-space code.

I've configured the registers identically to the recommendation on page 32-33. 
But apparently it didn't work properly.

When I wrote GPBUS data register at 0x60c0_0000, the bus cycle should have 
started automatically, but it didn't ? WR, RD, ALE not toggled, what I've 
observed with logic analyzer was that the content of GPBUS address register 
0x62c0_0002 was set on the 8 multiplexed GPBUS wire (correct), but content of 
data register didn't come afterwards and RD, WR, ALE are alway '1'. And i 
haven't observed the 14.7456MHz clock output either. 

The relavant code:
//mmap .... initialization of the address points....i've tested the //pointer 
allocations with normal GPIO, and they are correct

*GPIO_CONTROL = CLOCK_MSK; //0x1200_0000, allow 14.7456MHz clock on DIO13
*GPIO_DIR_0_7   = 0xff; //0x12c0_0000, set the multiplexed bus to all output, 
user manual page 32
*GPIO_DIR_8_15  = 0xe7;  //0x12c0_0001, DIO15, DIO14, DIO13-clock output; 
DIO12-DRQ, DIO11-IRQ, input; DIO10-WR, DIO9-RD, DIO8-ALE output
*GPIO_DATA_8_15 = 0x07; //0x12c0_0003, set default polarity of stobes (0x07: 
rd,wr low active, ale high active) user manual page 32

//1st write data w/o auto incr
*GPBUS_ADDR     = 0x57;  //0x62c0_0002, any addr
*GPBUS_DATA     = 0xA1;  //0x60c0_0000, any data  - SHOULD START A GPBUS WRITE 
CYCLE AUTOMATICALLY REFERRING TO MANUAL, BUT NOT HAPPENED

I could be the case that i misunderstood the manual
Maybe someone has also once tried GPBUS?

Thanks,

Yue




--- In  "mccarl1978" <> wrote:
>
>
>
> --- In  "yuezhu92" <rhinesee@> wrote:
> > int fd = open("/dev/mem", O_RDWR|O_SYNC);
> >
> > char* page1   = (char *)mmap(0, 4096, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 
> > 0x12c00000);
> >
> > page1[3] = 0xff; //error! program crash
> >
>
> You should add some error checking code to check the return values of the 
> 'open' and 'mmap' calls, to see which one is failing. And then you can check 
> the value of a variable called 'errno' to get more information on why a call 
> is failing. You can use 'perror' for this. For example:
>
>
> int fd = open("/dev/mem", O_RDWR|O_SYNC);
> if(fd == -1)
> {
>     perror("MyFunction (open)");
>     return; //exit(-1);
> }
>
> char* page1   = (char *)mmap(0, 4096, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 
> 0x12c00000);
> if(page1 == (char *) MAP_FAILED)
> {
>     perror("MyFunction (mmap)");
>     return; //exit(-1);
> }
>
> page1[3] = 0xff; //error! program crash
>
>
>
>
> Cheers
> Phil
>




------------------------------------

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