Page 1 of 1

DSerial Edge GPIO pins 2.2-2.7

Posted: Wed Oct 21, 2009 4:50 pm
by Agilo
On DSerial Edge, is there a reason that when I set P2.2-P2.7 to OUTPUT, I can't use them as GPIO's?
Setting them high/low doesn't do anything (I have a LED attached to test them which works on 0.4-0.7 and 1.0-1.7).

In thinking maybe the enabled Uart might have something to do with it (restricting general i/o access to those pins), I tried disabling it by applying several dseSetModes() combinations (at first I thought uncommenting it would be sufficient to not use UART/Servo and just use them as GPIO pins) and I also tried to disable Uart completely by setting UartEnabled[0] (in dserial.c) to false, all no to avail.. maybe (and this is most likely) I'm just not understanding something?
Am I missing something?

Example code:

Code: Select all

        // dseSetModes(ENABLE_RS232 /* | ENABLE_SERVO */);

        dsePinMode(2, 2, OUTPUT);
        dsePinMode(2, 3, OUTPUT);

        while(1) {

                {...}

                if(keysDown() & KEY_A) {
                        dsePinWrite(2, 2, false);
                        dsePinWrite(2, 3, false);
                } else if(keysDown() & KEY_B) {
                        dsePinWrite(2, 2, true);
                        dsePinWrite(2, 3, true);
                }
        }

Re: DSerial Edge GPIO pins 2.2-2.7

Posted: Wed Oct 21, 2009 10:07 pm
by natrium42
You should be able to use 2.2 - 2.5 without problems. Could you check if they are maybe shorted to GND or VCC?

2.6 and 2.7 are used for the second UART. But it can be disabled with a custom firmware, if you want to use those pins for IO.

Re: DSerial Edge GPIO pins 2.2-2.7

Posted: Wed Oct 21, 2009 10:47 pm
by Agilo
They don't seem to be shorted (as per the readouts on my crappy multimeter)..

Good to know about 2.6 and 2.7 though, I'll have a look at those in the firmware. Thanks!

Also, while on the subject of GPIO pins: I really wonder why you chose to disable P2.0 and P2.1 completely, instead of just wiring them to the MCU (to be used as GPIO pins)? For backwards compatibility (somehow)?

Re: DSerial Edge GPIO pins 2.2-2.7

Posted: Fri Oct 23, 2009 7:39 pm
by Agilo
Nice! After enabling all the pins:

Code: Select all

P2SKIP    = 0xFF;
and disabling UART:

Code: Select all

        if(*((code unsigned char *) 0x83) == 0x02) { // DSerial Edge 
                //uart1Init();
Pins 2.2-2.7 all work as GPIO pins. :D

Pins 0.4 (TX0) and 0.5 (RX0) don't work, though.. but I'll figure that out.

Also, another question: what are XBR{0,1,2} for?