Forum: Open Source & Homebrew Jailbreak - If you are looking for news and helpful information on PS3 topics like open source and homebrew jailbreak solutions then PSX-Scene should be your first stop. You can stay up to date on topics such as PSGroove and PSFreedom plus much more.


The above video goes away if you are a member and logged in, so log in now!




 
Would you like to get all the new info from
PSX-Scene in your email each day?




Want to learn more about the team keeping you up to date with the latest scene news?

Read about them now!

Check out our Developer bios, too!

 


User Tag List

Thread: The LED Thread
  

Page 1 of 8 1 2 3 ... LastLast
Results 1 to 10 of 74
  1. #1 The LED Thread 
    DJLO's Avatar
    DJLO is offline All Your Hex Are Belong To Me
    Join Date
    Aug 2010
    Posts
    1,347
    Downloads
    0
    Uploads
    0
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Likes Given
    0
    Likes Received
    0
    There is information scattered all over the place on how to get your LEDs working when you compile new source files. It took me a while to sort through it all and thanks to many people (sniffynose, ac1d, vma and all the rest i can't remember) that have submitted files and tips that have helped me get things working once and for all.

    Keep checking this thread as i will try and update it with as much information as possible. Please feel free to add anything that i don't have here.

    I have uploaded the led.h file for some of the popular boards.

    All of these with the exception of the JMDBU2 use at90usb162 as the mcu and TEENSY as the board. All you have to do is copy the led.h for the board you wish to use to

    folderofyourcode/lufa-lib/trunk/LUFA/Drivers/Board/TEENSY

    if you have a different board, you put the file in the folder of that board name

    If you have a chip with a atmega32u2, you can compile using at90usb162 as they are compatible, just make sure to change the f_cpu to whatever your board has

    If you are compiling for different boards, replace the led.h and repeat the make clean, make process.
    Attached Files
    Last edited by DJLO; 10-23-2010 at 10:16 AM.
    Reply With Quote  

  2. #2  
    DJLO's Avatar
    DJLO is offline All Your Hex Are Belong To Me
    Join Date
    Aug 2010
    Posts
    1,347
    Downloads
    0
    Uploads
    0
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Likes Given
    0
    Likes Received
    0
    Here is another really nice piece i found. If you are an owner of the Maximus (1 or 2) or a Minimus (1 or 2), there is a way you can have the LED shut off after a certain amount of time. Some people like this and find it useful.

    You need to edit the psgroove.c and make the following changes:

    under the enum section near the top of the file, add this:

    Code:
    done,
    	blinky,
    } state = init;
    Next do a search for "// done" without the quotes. For the Maximus board add the following:
    Code:
    // done
    		if (state == done)
    		{
    			
    			LED(GREEN);
    			_delay_ms(9999);
    			state = blinky;
    		}
    
    		// lights out binary 0b11000000 portb 7,6
    		if (state == blinky)
    		{
    			PORTB = 0xc0;
    		}
    
    	}
    }
    For the Minimus board, add this:

    Code:
    // done
    		if (state == done)
    		{
    			
    			LED(GREEN);
    			_delay_ms(9999);
    			state = blinky;
    		}
    
    		// lights out binary 0b01100000 portd 6,5
    		if (state == blinky)
    		{
    			PORTD = 0x60;
    		}
    
    	}
    }
    There is a maximum of 9999ms (10 seconds) in LUFA. If you wish to increase it to say 30 seconds, do something like this:

    Code:
    // done
    		if (state == done)
    		{
    			
    			LED(GREEN);
    			_delay_ms(9999);
    			state = blinky;
    			LED(GREEN);
    			_delay_ms(9999);
    			state = blinky;
    			LED(GREEN);
    			_delay_ms(9999);
    			state = blinky;
    		}
    
    		// lights out binary 0b01100000 portd 6,5
    		if (state == blinky)
    		{
    			PORTD = 0x60;
    		}
    
    	}
    }
    Note: I am not sure how this was done but i would love to find out so we can add this to other boards. The coding part is my achilles heel, if anyone is willing to dig in and try some other boards and post back, that would be awesome !

    Here are the compiled files for both with 30 second delay
    Last edited by DJLO; 10-15-2010 at 07:19 PM.
    Reply With Quote  

  3. #3  
    splinter182 is offline Registered User
    Join Date
    Sep 2010
    Posts
    28
    Downloads
    0
    Uploads
    0
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Likes Given
    0
    Likes Received
    0
    Quote Originally Posted by DJLO View Post
    Here is another really nice piece i found. If you are an owner of the Maximus (1 or 2) or a Minimus (1 or 2), there is a way you can have the LED shut off after a certain amount of time. Some people like this and find it useful.

    You need to edit the psgroove.c and make the following changes:

    under the enum section near the top of the file, add this:

    Code:
    done,
    	blinky,
    } state = init;
    Next do a search for "// done" without the quotes. For the Maximus board add the following:
    Code:
    // done
    		if (state == done)
    		{
    			
    			LED(GREEN);
    			_delay_ms(9999);
    			state = blinky;
    		}
    
    		// lights out binary 0b11000000 portb 7,6
    		if (state == blinky)
    		{
    			PORTB = 0xc0;
    		}
    
    	}
    }
    For the Minimus board, add this:

    Code:
    // done
    		if (state == done)
    		{
    			
    			LED(GREEN);
    			_delay_ms(9999);
    			state = blinky;
    		}
    
    		// lights out binary 0b01100000 portd 6,5
    		if (state == blinky)
    		{
    			PORTD = 0x60;
    		}
    
    	}
    }
    There is a maximum of 9999ms (10 seconds) in LUFA. If you wish to increase it to say 30 seconds, do something like this:

    Code:
    // done
    		if (state == done)
    		{
    			
    			LED(GREEN);
    			_delay_ms(9999);
    			state = blinky;
    			LED(GREEN);
    			_delay_ms(9999);
    			state = blinky;
    			LED(GREEN);
    			_delay_ms(9999);
    			state = blinky;
    		}
    
    		// lights out binary 0b01100000 portd 6,5
    		if (state == blinky)
    		{
    			PORTD = 0x60;
    		}
    
    	}
    }
    Note: I am not sure how this was done but i would love to find out so we can add this to other boards. The coding part is my achilles heel, if anyone is willing to dig in and try some other boards and post back, that would be awesome !

    Here are the compiled files for both with 30 second delay
    this is actually very interesting, i know enough coding to figure out how its done but never really written code for hardware before.

    If you study the code, the if statement check for the value of state, maybe an integer with values that specify the state of the execution of the code. done is most likely a defined value.

    Then you can see LED(GREEN); is a function, probably defined somewhere else in the code or in another .c file, maybe led.c, the GREEN parameter inside the parenthesis is a define value, usually intialized at the beginning of a .c file, again probably led.c, kinda like an alias for a specific numeric value. after the function is executed (turns on the led by setting its "port" or pin on the chip to a 1) Edit:Actually i don't know how the leds are being turn on, one would have to take a look at the LED() function to really figure that out. there is a delay, pauses the execution of code for the length of time specified

    After that state is set to blinky
    Then state is checked again, and if state is blinky, turns off the led by setting port 5 and 6 to 1s. that would be 1s at the 5th and 6th position of a 8 bit address, bits are numbered starting with 0 from right to left thus 01100000 or 60 in hex.
    PS3 Slim 120GB - firmware 3.50
    PS3 Slim 360GB - firmware 3.41 - Maximus AVR
    PS2 SCPH-500001/N Network Bundle - Sony 40GB HDD FFXI - FMCB
    PS1 SCPH-7501 - Purchased with a modchip in some mall in Hong Kong back '98
    PSP-1001 M33 CR5400 8GBx2
    Reply With Quote  

  4. #4  
    h0bbit's Avatar
    h0bbit is offline Member
    Join Date
    Oct 2010
    Location
    Norcal
    Posts
    146
    Downloads
    1
    Uploads
    0
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Likes Given
    0
    Likes Received
    0
    love to see a Teensy2.0 atmega32u4/16 LEDs.h. I still can't get mine to work.

    as to the post above me, LED(GREEN) is defined in psgroove.c, not sure if its elsewhere.

    Code:
    #define RED	(LEDS_LED1)
    #define GREEN	(LEDS_LED2)
    Reply With Quote  

  5. #5  
    matchung is offline Registered User
    Join Date
    Oct 2010
    Posts
    25
    Downloads
    0
    Uploads
    0
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Likes Given
    0
    Likes Received
    0
    i saw about PL3 code about flashing led during exploiting, i made changes for my PS3Yes dongle, quite funny..

    led definition found in /lufa-lib/trunk/LUFA/Drivers/Board/xxxx/LEDs.h (something like that)
    Reply With Quote  

  6. #6  
    ChokeD is offline Member
    Join Date
    Sep 2010
    Posts
    192
    Downloads
    1
    Uploads
    0
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Likes Given
    30
    Likes Received
    27
    Quote Originally Posted by h0bbit View Post
    love to see a Teensy2.0 atmega32u4/16 LEDs.h. I still can't get mine to work.
    I second that, I have the same board but cant figure out how to get the blinky code working. I'm not so sure it has to do with a LED.h though because I delete my LED.h out of my source and the light still works. Don't ask me. Without looking to confirm, I believe my psgroove.c file has values set for the led's. I'm also wanting to add some led's to my board. I'll be looking more in to this tomorrow.

    This thread was needed SO bad, thanks DJLO. This, as I'm sure you know, is going to be a huge task but once done will be a great help. Thanks for all your hard work here and everywhere else.
    Reply With Quote  

  7. #7  
    subcon959's Avatar
    subcon959 is offline Member
    Join Date
    Oct 2010
    Posts
    696
    Downloads
    0
    Uploads
    0
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Likes Given
    0
    Likes Received
    16
    Quote Originally Posted by DJLO View Post
    Here are the compiled files for both with 30 second delay
    Thanks for that matey, any chance you could do them for kakaroto v3 instead of hermes?
    Cheers

    EDIT: Well I had a go at doing it myself. It was surprisingly easy to setup the git/winavr stuff. I managed to get a working hex out of it but the green led stays on so I must've done something wrong inserting the above code.
    Last edited by subcon959; 10-16-2010 at 12:04 PM.
    Reply With Quote  

  8. #8  
    JonahUK is offline Old Man on the Block
    Join Date
    Sep 2010
    Location
    Manchester, UK
    Posts
    632
    Downloads
    2
    Uploads
    0
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Likes Given
    45
    Likes Received
    10
    DJ,

    Once people have got leds working for their boards (those that are not already available), it might be an idea to pass to evilsperm to includes in his github (which kakaroto is now including in his git).

    That way, we can simply checkout the git and flash with working leds.

    And it will also build up a nice repo of boards etc.
    Reply With Quote  

  9. #9  
    IP1
    IP1 is offline Registered User
    Join Date
    Sep 2010
    Posts
    6
    Downloads
    0
    Uploads
    0
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Likes Given
    0
    Likes Received
    0
    Quote Originally Posted by DJLO View Post
    I have uploaded the led.h file for some of the popular boards.
    I suspect my query to you yesterday requesting the LEDs.h for Blackcat USB prompted you to create this thread? If so, that's great -- you even went several major steps further.

    Great contribution, DJLO.
    Reply With Quote  

  10. #10  
    splinter182 is offline Registered User
    Join Date
    Sep 2010
    Posts
    28
    Downloads
    0
    Uploads
    0
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Likes Given
    0
    Likes Received
    0
    Quote Originally Posted by h0bbit View Post
    love to see a Teensy2.0 atmega32u4/16 LEDs.h. I still can't get mine to work.

    as to the post above me, LED(GREEN) is defined in psgroove.c, not sure if its elsewhere.

    Code:
    #define RED	(LEDS_LED1)
    #define GREEN	(LEDS_LED2)
    You found the value of GREEN which is LEDS_LED2 which is another alias to another value. im guessing all these aliases is to make this code less hardware depended and more portable between chips.
    Code:
    #define Var (someValue)
    is a way to define static values to a variable for later use

    the LED() function should look like this:
    Code:
    LED(int led){
    <code>
    }
    or something similar to it

    also the led.h is a header file which can contain defines, aliases and function prototypes. function prototypes look like the first line of a func but end in a ";" it tells the code that incuded the header what functions are available
    PS3 Slim 120GB - firmware 3.50
    PS3 Slim 360GB - firmware 3.41 - Maximus AVR
    PS2 SCPH-500001/N Network Bundle - Sony 40GB HDD FFXI - FMCB
    PS1 SCPH-7501 - Purchased with a modchip in some mall in Hong Kong back '98
    PSP-1001 M33 CR5400 8GBx2
    Reply With Quote  

Page 1 of 8 1 2 3 ... LastLast
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •