[PATCH] Coffee Cooker (GPIO) on SmartXX
#1
For people who have a SmartXX v3 and (not tested) LT OPX, I have made a patch which enables you to use the general I/O (GPIO, known as Coffee Cooker).

The ticket number is 4870.
I've also posted a demonstration video (switching LEDS) on YouTube.

You can activate an output with the following command:
System.CoffeeCooker( port, value )
Where port is 0..3 for the port number.
and value is 0 or 1 to switch it off or on.

Direct commands:
(http):http://xbox/xbmcCmds/xbmcHttp?command=Ex...ooker(3,1)
(ftp):site System.CoffeeCooker(3,1)
(python):xbmc.executebuiltin( 'System.CoffeeCooker(3,1)' )

Also in Python, you can use xbmc.getGPIOState(3) to read the current port state, which you can use to highlight a button.

The hardware is simple: it's similar to the PWMControl hardware pins, so if you connect LEDs, you must add a resistor.
The four switches available all switch to ground, which means you have to supply a positive voltage.
In the video I used +5v with 220 ohm resistors on each green LED connected to a rj45 (network) socket, so I can abuse plain network cables Smile

Cheers,
Tinux
using an XBMC rev30380 with updated LCD code
Reply
#2
Thanks for the patch. It will be reviewed following the atlantis release.
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#3
Thanks for the quick respond.
Note that the patch includes some comments.

I hoped there was a way to let general purpose commands return a value, but I noticed that this would include a callback system. Therefore, I commented the 'else' case out, and made an extra python call.

Also I'm not aware of API calling conventions, so both commands may be subject to change if someone has better names for them.

Cheers,

Tinux
using an XBMC rev30380 with updated LCD code
Reply
#4
err.. it was late again last night: "general purpose commands" means "built-in commands"

more..coffeecooker Wink
using an XBMC rev30380 with updated LCD code
Reply
#5
cool, this also sounds interesting, if you want to build a "stereo-ambilight" (needs to utilize a external microcontroller for pwm) Wink
will try it out soon...
Reply
#6
Hi Tinux,

you got it working!

I'll merge this into my working copy tonight (hopefully) and try it out.

I read your comments in the code, and i also had problems when i was playing with the I/O ports, so i emailed Franz Lehner (and anyone else i could track down from the smartxx team), he sent some replies saying he had data, and code etc, but in the end this was all i got:

Quote:Look, we have released almost everything.
All ports, everything can be found in the datasheet.
Ports have never changed from beginning to end.
All smartxx uses same ports
The development cycle of the logic was: "smartxx V1/V2" -> SmartxX OPX ->
smartxx V3

The IR thing was never relased to a test-sheet, and I know, I have somewhere
a test-programm
But I do not know where this code is stored, it is not in my CVS archive.

Sorry
And it will not change, when writing emails again and again.
And writing to other guys will not help either.

I can give you some things, but this is already released.

But you can start tryting the portnumber up to f709 --- you will see things
:-)
IR is just a simple Outbit.

The good thing is , that you can not kill anything.

Be aware, that IR led will melt if > 10ms peak, so best attach a voltmeter
instead.


We have eg. Done in the LCD thing some funny things.

Like
SetNewPWMContrast
()
You see that it is the same IO address as setting the Background
SetNewPWMBackground(), the only difference is the tempvalue |= 0x80;
:-)

franz


Code:
void modchip_SetNewPWMContrast(unsigned int value) {
       // V3 ONLY !
       if (XBOX_HARDWARE_INFO->ModchipType == MODCHIP_SMARTXX_V3) {
               unsigned int tempvalue=value;
               tempvalue &= 0x7f;
               tempvalue |= 0x80;      // set upper bit for "contrast"
IoOutputByte(0xf701, tempvalue);
       }
}

void modchip_SetNewPWMBackground(unsigned int value) {

       unsigned int tempvalue=value;

       switch (XBOX_HARDWARE_INFO->ModchipType) {

               case MODCHIP_SMARTXX_V3:
                       tempvalue &= 0x7f;
                       break;
               case MODCHIP_SMARTXX_FLIP:
                       tempvalue &= 0x7f;
                       break;
               case MODCHIP_SMARTXX_BIG:
                       tempvalue &= 0x3f;
                       break;
       }

       // PWM Fix ..
       if (XBOX_HARDWARE_INFO->ModchipVersion==1) {
               if (tempvalue>30) tempvalue++;
               if (tempvalue>63) tempvalue=63;
       }

       IoOutputByte(0xf701, tempvalue);
}

From my own experiments i had a good idea of how the registers were arrange and how they were applying bit masking techniques, i will see if i can find my notes from last year.

BOB.SMITH
Reply

Logout Mark Read Team Forum Stats Members Help
[PATCH] Coffee Cooker (GPIO) on SmartXX0