user3237: I have the (more or less) Leonardo-compatible board Olimexino-32u4. Both, the TX- and RX-LED are permanently on. To reduce power-consumption, I want to disable them by software. What is the reliable way to do it?

user2881: The TXled is connected to physical pin 22, or PD5. RXled is connected to pin 8, or PB0. They are connected to the cathode of the led, so they have to be HIGH to turn off the leds.
To turn them HIGH use:
PORTD |= (1<<PORTD5);
PORTB |= (1<<PORTB0);

Not sure what the firmware does, and if it sets the leds back to low every once and a while. So in addition I would suggest also setting those pins to inputs. 
DDRD &= ~(1<<DDD5);
DDRB &= ~(1<<DDB0);


user2973: Try adding this to your setup routine:
TXLED0;
RXLED0;

These macros (and their cousins TXLED1, RXLED1) are used to control the TX an RX LED's on Leonardo. They are defined in https://github.com/arduino/ArduinoCore-avr/blob/9f8d27f09f3bbd1da1374b5549a82bda55d45d44/variants/leonardo/pins_arduino.h#L95-L98

If that doesn't work you can try the solutions suggested here: http://forum.arduino.cc/index.php?topic=145262.0

user2973: Reading the answer from Gerben I realised the core of the issue: The TX/RX LED's on the Leonardo are wired PIN-LED-5V(common anode), whereas on the Olimexino-32U4 they are wired PIN-LED-GND(common cathode). So the two boards will need inverse signals for the same visual output.
Compare:
http://arduino.cc/en/uploads/Main/arduino-leonardo-schematic_3b.pdf
https://www.olimex.com/Products/Duino/AVR/OLIMEXINO-32U4/resources/OLIMEXINO-32U4_rev_A3.pdf

The most elegant solution will be to add a new board type (the code below is for IDE 1.0.x):

In your sketchbook create a folder 'hardware' and inside that 'olimexino'. In the olimexino folder create a file boards.txt with this content:
olimexino32u4.name=Olimexino-32U4
olimexino32u4.upload.protocol=avr109
olimexino32u4.upload.maximum_size=28672
olimexino32u4.upload.speed=57600
olimexino32u4.upload.disable_flushing=true
olimexino32u4.bootloader.low_fuses=0xff
olimexino32u4.bootloader.high_fuses=0xd8
olimexino32u4.bootloader.extended_fuses=0xcb
olimexino32u4.bootloader.path=caterina
olimexino32u4.bootloader.file=Caterina-Leonardo.hex
olimexino32u4.bootloader.unlock_bits=0x3F
olimexino32u4.bootloader.lock_bits=0x2F
olimexino32u4.build.mcu=atmega32u4
olimexino32u4.build.f_cpu=16000000L
olimexino32u4.build.vid=0x2341
olimexino32u4.build.pid=0x8036
olimexino32u4.build.core=arduino:arduino
olimexino32u4.build.variant=olimexino32u4

Create another folder 'variants' inside the olimexino folder.
Inside that, create the folder 'olimexino32u4'.
Now copy 'arduino/hardware/arduino/variants/leonardo/pins_arduino.h' to that folder
Open the copy for editing - the path should be 'sketchbook/hardware/olimexino/variants/olimexino32u4/pins_arduino.h'.
Change the section that deals with TXLED and RXLED by swapping the macros that end in 1 with those that end in 0. It should look like this:
#define TX_RX_LED_INIT  DDRD |= (1<<5), DDRB |= (1<<0)
#define TXLED1          PORTD |= (1<<5)
#define TXLED0          PORTD &= ~(1<<5)
#define RXLED1          PORTB |= (1<<0)
#define RXLED0          PORTB &= ~(1<<0)


I don't own the board so I can't test the solution. I hope that it solves your problem - just choose 'Olimexino-32U4' from the Tools->Board menu.

3237: <p>I have the (more or less) Leonardo-compatible board Olimexino-32u4. Both, the TX- and RX-LED are permanently on. To reduce power-consumption, I want to disable them <strong>by software</strong>. What is the reliable way to do it?</p>
 2881: <p>The TXled is connected to physical pin 22, or PD5. RXled is connected to pin 8, or PB0. They are connected to the cathode of the led, so they have to be HIGH to turn <strong>off</strong> the leds.</p>

<p>To turn them HIGH use:</p>

<pre><code>PORTD |= (1&lt;&lt;PORTD5);
PORTB |= (1&lt;&lt;PORTB0);
</code></pre>

<p>Not sure what the firmware does, and if it sets the leds back to low every once and a while. So in addition I would suggest also setting those pins to inputs. </p>

<pre><code>DDRD &amp;= ~(1&lt;&lt;DDD5);
DDRB &amp;= ~(1&lt;&lt;DDB0);
</code></pre>
 2973: <p>Try adding this to your setup routine:</p>
<pre><code>TXLED0;
RXLED0;
</code></pre>
<p>These macros (and their cousins TXLED1, RXLED1) are used to control the TX an RX LED's on Leonardo. They are defined in <a href="https://github.com/arduino/ArduinoCore-avr/blob/9f8d27f09f3bbd1da1374b5549a82bda55d45d44/variants/leonardo/pins_arduino.h#L95-L98" rel="nofollow noreferrer">https://github.com/arduino/ArduinoCore-avr/blob/9f8d27f09f3bbd1da1374b5549a82bda55d45d44/variants/leonardo/pins_arduino.h#L95-L98</a></p>
<hr />
<p>If that doesn't work you can try the solutions suggested here: <a href="http://forum.arduino.cc/index.php?topic=145262.0" rel="nofollow noreferrer">http://forum.arduino.cc/index.php?topic=145262.0</a></p>
 2973: <p>Reading the answer from Gerben I realised the core of the issue: The TX/RX LED's on the Leonardo are wired PIN-LED-5V(common anode), whereas on the Olimexino-32U4 they are wired PIN-LED-GND(common cathode). So the two boards will need inverse signals for the same visual output.</p>

<p>Compare:<br>
<a href="http://arduino.cc/en/uploads/Main/arduino-leonardo-schematic_3b.pdf" rel="noreferrer">http://arduino.cc/en/uploads/Main/arduino-leonardo-schematic_3b.pdf</a><br>
<a href="https://www.olimex.com/Products/Duino/AVR/OLIMEXINO-32U4/resources/OLIMEXINO-32U4_rev_A3.pdf" rel="noreferrer">https://www.olimex.com/Products/Duino/AVR/OLIMEXINO-32U4/resources/OLIMEXINO-32U4_rev_A3.pdf</a></p>

<hr>

<p>The most elegant solution will be to add a new board type (the code below is for IDE 1.0.x):</p>

<ul>
<li><p>In your sketchbook create a folder 'hardware' and inside that 'olimexino'. In the olimexino folder create a file boards.txt with this content:</p>

<pre><code>olimexino32u4.name=Olimexino-32U4
olimexino32u4.upload.protocol=avr109
olimexino32u4.upload.maximum_size=28672
olimexino32u4.upload.speed=57600
olimexino32u4.upload.disable_flushing=true
olimexino32u4.bootloader.low_fuses=0xff
olimexino32u4.bootloader.high_fuses=0xd8
olimexino32u4.bootloader.extended_fuses=0xcb
olimexino32u4.bootloader.path=caterina
olimexino32u4.bootloader.file=Caterina-Leonardo.hex
olimexino32u4.bootloader.unlock_bits=0x3F
olimexino32u4.bootloader.lock_bits=0x2F
olimexino32u4.build.mcu=atmega32u4
olimexino32u4.build.f_cpu=16000000L
olimexino32u4.build.vid=0x2341
olimexino32u4.build.pid=0x8036
olimexino32u4.build.core=arduino:arduino
olimexino32u4.build.variant=olimexino32u4
</code></pre></li>
<li><p>Create another folder 'variants' inside the olimexino folder.</p></li>
<li>Inside that, create the folder 'olimexino32u4'.</li>
<li>Now copy 'arduino/hardware/arduino/variants/leonardo/pins_arduino.h' to that folder</li>
<li>Open the copy for editing - the path should be 'sketchbook/hardware/olimexino/variants/olimexino32u4/pins_arduino.h'.</li>
<li><p>Change the section that deals with TXLED and RXLED by swapping the macros that end in 1 with those that end in 0. It should look like this:</p>

<pre><code>#define TX_RX_LED_INIT  DDRD |= (1&lt;&lt;5), DDRB |= (1&lt;&lt;0)
#define TXLED1          PORTD |= (1&lt;&lt;5)
#define TXLED0          PORTD &amp;= ~(1&lt;&lt;5)
#define RXLED1          PORTB |= (1&lt;&lt;0)
#define RXLED0          PORTB &amp;= ~(1&lt;&lt;0)
</code></pre></li>
</ul>

<p>I don't own the board so I can't test the solution. I hope that it solves your problem - just choose 'Olimexino-32U4' from the Tools->Board menu.</p>
