0 Members and 1 Guest are viewing this topic.
Pages have to be aligned to their size. What's with the random 0xfed7ee21 address?
I'm currently testing GPIOs with ndless. The binary (input) value of all ports toggles randomly between 0x59d00bf and 0x5bdoobf.
(Could also be periodically, sample rate is highest possible)What is GPIO 21(0x020000)?Also, the output value (0x80132d) doesn't vary at all. Isn't the touchpad connected to GPIOs 1 + 3?
Edit: Can I use GPIOs both as input and output? Example:GPIO1 configured as output=HIGH, connected to ground through resistor.Can I read input=LOW?
Edit2: With linux the gpio input still toggles randomly.
Should I implement an irq_chip for this? Directly setting, getting and changing direction are working. (At least the right values in the registers change)
Edit3: Could someone please test GPIOs? I don't know how.http://dl.dropbox.com/u/105478372/zImagetest.tnsWith useless i2c-gpio:http://dl.dropbox.com/u/105478372/zImagetesti2c.tns
I'm trying to make sense of all this, is there a build released for touchpad models yet or not?
That's probably to be expected. The pins are probably not connected to anything so it's floating.
The output shouldn't vary at all unless you change it.
I know you can do this with AVRs (people did this to make a cheap touch sensor - i.e. bring pin high and measure how long it actually takes to go high). Not sure with Nspires though.
Again, as expected from floating voltages.
Best test for GPIO is the touchpad :-P
Speaking of which, should the touchpad driver be a kernel driver or a userspace daemon (pulling strings with i2c and userspace uevents)?
Well, of course i2c isn't still running in the background OS: You completely replaced it. Nothing is running in the background except what Linux knows to do
Is there a driver for the i2c protocol implemented yet?
Maybe we'll get lucky and find out the touchpad itself is already supported, and just the adapter needed a driver.
No, im reading the GPIO registers with a C program started with ndless.
for (irq = 0; irq < controller->chip.ngpio; irq += 8) { /* Sticky interrupt status */ writew(0xFF, NSPIRE_GPIO(irq, INT_STICKY)); /* Reset interrupt status */ writew(0xFF, NSPIRE_GPIO(irq, INT_STATUS)); /* Disable interrupts */ writew(0xFF, NSPIRE_GPIO(irq, INT_DISABLE));}
But the touchpad doesn't, have to investigate that further, but it's hard without any hardware-debugging like scope..
Then how can I see how the OS is changing the GPIOs? Only in nspire_emu, if I compile it with custom debugging?Simply re-enable interrupts?Edit: As GPIOs generate only one interrupt (7) I have to use an irq_domain. But there are only 32 irq's available on the device.Are there some kind of virtual interrupts?
irq = request_irq(controller->irq, nspire_gpio_irq, 0, "gpio", controller);static irqreturn_t nspire_gpio_irq(int irq, void *data){ uint8_t pin, port; uint16_t status_val; uint16_t __iomem *status = NSPIRE_GPIO(0, INT_MASKED_STATUS); for (port = 0; port < controller->chip.ngpio; port += 8) { status_val = readw(status); /* Ack interrupt */ writew(0xFF, status + (NSPIRE_GPIO_INT_STATUS_OFFSET - NSPIRE_GPIO_INT_MASKED_STATUS_OFFSET)); status += NSPIRE_GPIO_SECTION_SIZE; //if(!status_val) continue; //Rest cut out } return IRQ_HANDLED;}