[Voyage-linux] re: Alix 3C3 and LEDs

Joel Carter (spam-protected)
Fri Sep 19 05:08:39 HKT 2008


Hi Bart.

I just got my hands on another ALIX3C3 as I hadn't had a chance to try your
suggestion until now. I also have problems compiling your program on Voyage
itself and on Ubuntu. Not sure what packages I need for those C headers,
but I WAS able to compile it on my CentOS 4.5 box. I've attached that for
others. Here's my output from your program:

   iopl succeeded


   before                l_LOCK: [613C]        0
   execute                     : [613C]        0
   after                 l_LOCK: [613C]        0

   before                h_LOCK: [61BC]        0
   execute                     : [61BC]        0
   after                 h_LOCK: [61BC]        0

   before               l_INPUT: [6120]  F7AF085
   execute                     : [6120]   400000
   after                l_INPUT: [6120]  F7AF085

   before                l_AUX1: [6110] 3FFDC002
   execute                     : [6110]   400000
   after                 l_AUX1: [6110] 3FFDC002

   before                l_AUX2: [6114] FFFF0000
   execute                     : [6114]   400000
   after                 l_AUX2: [6114] FFFF0000

   before          l_OPEN_DRAIN: [6108] FFBF0040
   execute                     : [6108]       40
   after           l_OPEN_DRAIN: [6108] FFBF0040

   before              l_OUTPUT: [6104] 3FBDC042
   execute                     : [6104]       40
   after               l_OUTPUT: [6104] 3FBDC042

   before               h_INPUT: [61A0] EBFF1400
   execute                     : [61A0]  A000000
   after                h_INPUT: [61A0] EBFF1400

   before                h_AUX1: [6190] FEFF0100
   execute                     : [6190]  A000000
   after                 h_AUX1: [6190] FEFF0100

   before                h_AUX2: [6194] FFFF0000
   execute                     : [6194]  A000000
   after                 h_AUX2: [6194] FFFF0000

   before          h_OPEN_DRAIN: [6188] F5FF0A00
   execute                     : [6188]      A00
   after           h_OPEN_DRAIN: [6188] F5FF0A00

   before              h_OUTPUT: [6184] F4FF0B00
   execute                     : [6184]      A00
   after               h_OUTPUT: [6184] F4FF0B00
   Disable all leds

   before                l_PINS: [6100] FFBF0040
   execute                     : [6100]       40
   after                 l_PINS: [6100] FFBF0040

   before                h_PINS: [6180] FFFF0000
   execute                     : [6180]      A00
   after                 h_PINS: [6180] F5FF0A00
   Enable led 1

   before                l_PINS: [6100] FFBF0040
   execute                     : [6100]   400000
   after                 l_PINS: [6100] FFFF0000
   Enable led 2

   before                h_PINS: [6180] F5FF0A00
   execute                     : [6180]  2000000
   after                 h_PINS: [6180] F7FF0800
   Enable led 3

   before                h_PINS: [6180] F7FF0800
   execute                     : [6180]  8000000
   after                 h_PINS: [6180] FFFF0000

It sequences through the LED's a couple times and then leaves them all on.
I then try (as suggested in Voyage README):

To turn off LED:
             # echo 0 > /sys/class/leds/alix\:1/brightness

No response. Then:

To turn on LED on ALIX:
             # echo 1 > /sys/class/leds/alix\:1/brightness

The first LED turns OFF (opposite to expected).

So it seems like we're getting close - we can turn them all on and then off
but then your program needs to be run again to turn them on again.

This isn't a major priority for me anymore but just wanted to share my
experiences in case someone else was concerned with getting their LED's
operational.

Thanks again, Joel.
(See attached file: testled)
------------------------------------------------------------------------
Joel Carter
Internet Engineering Lab (IEL)
Group for Advanced Information Technology (GAIT)
British Columbia Institute of Technology
http://www.bcit.ca/appliedresearch
e jcarter at bcit.ca
p 604 451-6929
f 604 436-0286
------------------------------------------------------------------------



                                                                           
             Bart Jooris                                                   
             <Bart.Jooris at inte                                             
             c.ugent.be>                                                To 
                                       Joel Carter <Joel_Carter at bcit.ca>,  
             Aug 13, 2008              Sancho <sancho at sancho.sk>           
             07:07 AM                                                   cc 
                                       voyage-linux at voyage.hk              
                                                                   Subject 
                                       Re: [Voyage-linux] re: Alix 3C3 and 
                                       LEDs                                
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           




Hi Joel, Sancho,

Maybe you still have the led problem on the ALIX 3C3?
I Checked the CS5536 datasheet and seems that the chip is not rightly
configured to
use the leds-alix without any reconfig.

on my machines after boot (with still old bios (before July 2008))

led1 was not set as output
led2 was configured as input...
led3 was configured to aux1

see the testled output (check if "before" and "after" differ) on your
machine.

After running testled, leds-alix should work.

Cheers,

Bart Jooris
Researcher
IBBT-IBCN research group-Ghent University




Joel Carter wrote:

> Hi Sancho.
>
> I posed this question awhile ago to the list and never got a
> resolution for getting the LED's working on my 3c3. I have to agree
> that it must be something to do with the different BIOS since I also
> have a 3c1 and just tried it as suggested in the Voyage README and it
> worked perfectly:
>
> $modprobe leds-alix
> $echo 1 > /sys/class/leds/alix\:2/brightness
>
> Joel.
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Voyage-linux mailing list
>Voyage-linux at list.voyage.hk
>http://list.voyage.hk/mailman/listinfo/voyage-linux
>
>

/*
                               tab:4
* Copyright (c) 2008 Ghent University
* All rights reserved.
 *
 * @author Bart Jooris
 *
 * IBBT - IBCN research group - Ghent University
 * E-mail: Bart.Jooris  intec.UGent.be
 * Implementation testleds alix3c3.
 * After config of GPIO 6, 25 and 27 (see schematics of ALIX3C3)
 * all leds will be disabled
 * then every second a led will be enabled
 *
 * compile with: gcc testled.c -o testled
 **/


#define extern static
#include <asm/io.h>
#undef extern
#include <stdio.h>
#include <sys/ioctl.h>

#define CS5536_BASE 0x06100
#define CLEAR_BIT_6  (unsigned long) 0x00400000
#define SET_BIT_6    (unsigned long) 0x00000040
#define CLEAR_BIT_9  (unsigned long) 0x02000000
#define SET_BIT_9    (unsigned long) 0x00000200
#define CLEAR_BIT_11 (unsigned long) 0x08000000
#define SET_BIT_11   (unsigned long) 0x00000800

void wrapped_outl (char info[], long addr, long value) {
             printf("\n");
             printf("before  %20s: [%X] %8X\n", info, addr, inl_p(addr));
             printf("execute %20s: [%X] %8X\n", "", addr, value);
             outl_p(value,addr);
             printf("after   %20s: [%X] %8X\n", info, addr, inl_p(addr));
}

int main (int argc, char **argv) {
             if (iopl(3)==0) printf("iopl succeeded\n\n");

//-------Begin
config-----------------------------------------------------------

//See Registers of CS5536 @ datasheet p 480-

             //Check LOCK
             wrapped_outl ("l_LOCK",CS5536_BASE+0x03C,0);
             wrapped_outl ("h_LOCK",CS5536_BASE+0x0BC,0);

             //config LED 1 (GPIO 6)
             //Disable INPUT
             wrapped_outl("l_INPUT",CS5536_BASE+0x020,CLEAR_BIT_6);
             //Disable AUX 1
             wrapped_outl("l_AUX1",CS5536_BASE+0x010,CLEAR_BIT_6);
             //Disable AUX 2
             wrapped_outl("l_AUX2",CS5536_BASE+0x014,CLEAR_BIT_6);
             //Enable open drain
             wrapped_outl("l_OPEN_DRAIN",CS5536_BASE+0x008,SET_BIT_6);
             //Enable output
             wrapped_outl("l_OUTPUT",CS5536_BASE+0x004,SET_BIT_6);

             //config LED 2 and 3 (GPIO 25 and 27)
             //Disable INPUT
             wrapped_outl("h_INPUT",CS5536_BASE+0x0A0,CLEAR_BIT_9 |
CLEAR_BIT_11);
             //Disable AUX 1
             wrapped_outl("h_AUX1",CS5536_BASE+0x090,CLEAR_BIT_9 |
CLEAR_BIT_11);
             //Disable AUX 2
             wrapped_outl("h_AUX2",CS5536_BASE+0x094,CLEAR_BIT_9 |
CLEAR_BIT_11);
             //Enable open drain
             wrapped_outl("h_OPEN_DRAIN",CS5536_BASE+0x088,SET_BIT_9 |
SET_BIT_11);
             //Enable output
             wrapped_outl("h_OUTPUT",CS5536_BASE+0x084,SET_BIT_9 |
SET_BIT_11);

//-------End of
config-----------------------------------------------------------

             printf("Disable all leds\n");
             //Disable LED1
             wrapped_outl("l_PINS",CS5536_BASE+0x000, SET_BIT_6);
             //disable LED 2 and 3
             wrapped_outl("h_PINS",CS5536_BASE+0x080, SET_BIT_9 |
SET_BIT_11);

             sleep(1);
             printf("Enable led 1\n");
             //Enable LED1
             wrapped_outl("l_PINS",CS5536_BASE+0x000, CLEAR_BIT_6);

             sleep(1);
             printf("Enable led 2\n");
             //Enable LED2
             wrapped_outl("h_PINS",CS5536_BASE+0x080, CLEAR_BIT_9);

             sleep(1);
             printf("Enable led 3\n");
             //Enable LED3
             wrapped_outl("h_PINS",CS5536_BASE+0x080, CLEAR_BIT_11);
}

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.voyage.hk/pipermail/voyage-linux/attachments/20080918/a375d5d1/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: graycol.gif
Type: image/gif
Size: 105 bytes
Desc: not available
URL: <http://list.voyage.hk/pipermail/voyage-linux/attachments/20080918/a375d5d1/attachment.gif>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pic13052.gif
Type: image/gif
Size: 1255 bytes
Desc: not available
URL: <http://list.voyage.hk/pipermail/voyage-linux/attachments/20080918/a375d5d1/attachment-0001.gif>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ecblank.gif
Type: image/gif
Size: 45 bytes
Desc: not available
URL: <http://list.voyage.hk/pipermail/voyage-linux/attachments/20080918/a375d5d1/attachment-0002.gif>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: testled
Type: application/octet-stream
Size: 431205 bytes
Desc: not available
URL: <http://list.voyage.hk/pipermail/voyage-linux/attachments/20080918/a375d5d1/attachment.obj>


More information about the Voyage-linux mailing list