3

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?

  • Examine the schematic and determine if they are wired to supplies, or to I/O pins. If supplies, desolder the associated resistors. If I/O pins, modify the bootloader and USB core to leave them off, or try issuing raw ATmega I/O access to turn them off if the are simply left on after the bootloader and not being constantly re-driven by USB traffic. – Chris Stratton Jul 24 '14 at 18:24
  • @ChrisStratton why not just desolder them in the first place? I don't know why it'd be bad to desolder the LED in the first place... – Anonymous Penguin Jul 24 '14 at 23:19
  • Just put a piece of tape over them... – DeveloperACE Jul 25 '14 at 0:07
  • 5
    Software modifications are cheaper and easier to reverse. Tape doesn't save power. – Chris Stratton Jul 25 '14 at 1:52
  • How they are driven currently? The straight-forward way using digitalWrite(pin, LOW) does not work. pinMode(pin, INPUT) doesn't work either. – Thomas S. Jul 25 '14 at 6:18
3

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 arduino/hardware/arduino/variants/leonardo/pins_arduino.h


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

  • 1
    Switching the IDE to upload to "Micro" instead of "Leonardo" really solved the LED problem. – Thomas S. Jul 25 '14 at 16:10
  • See my new answer for more elaborate explanation and a maybe better solution. – user2973 Jul 25 '14 at 16:19
  • Alternatively: the pin mapping in the Arduino world is D17 for RX and D30 for TX, so instead of TXLED1 you can also use digitalWrite(30, HIGH). – volzo Jun 13 '17 at 18:51
6

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.

  • I've tried both values on TXLED and RXLED - one did not work. Only selecting the "Micro" board worked. – Thomas S. Jul 29 '14 at 9:58
1

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);
  • The Olimexino-32u4 connect the LEDs to GND, but as written in my comment, this approach does not work. – Thomas S. Jul 25 '14 at 15:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.