Pages: [1]   Go Down
Author Topic: Bootloader for Leonardo Boards  (Read 737 times)
0 Members and 1 Guest are viewing this topic.
Germany
Offline Offline
Full Member
***
Karma: 10
Posts: 230
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

I have an Leonardo compatile Board for my breadboard, unworthily it has the RX and TX LED connected to GND not to Vcc.

Original Leonardo

Pin -----[Resistor]---|<|------->Vcc

Clone Board

Pin -----[Resistor]---|>|-------|GND

So the RX and TX LED are always on, I don't like that and I'm aware about sunburn  smiley-wink

My idea is changing on the caterina.h the following lines.

      #define CPU_PRESCALE(n)   (CLKPR = 0x80, CLKPR = (n))
      //#define LED_SETUP()      DDRC |= (1<<7); DDRB |= (1<<0); DDRD |= (1<<5);
68      #define LED_SETUP()      DDRC |= (1<<7); DDRB &= ~(1<<0); DDRD &= ~(1<<5);
      #define L_LED_OFF()      PORTC &= ~(1<<7)
      #define L_LED_ON()      PORTC |= (1<<7)
      #define L_LED_TOGGLE()   PORTC ^= (1<<7)
      //Definition changed!!!!
72      #define TX_LED_OFF()           PORTD &= ~(1<<5)
73      #define TX_LED_ON()      PORTD |= (1<<5)
74      #define RX_LED_OFF()           PORTB &= ~(1<<0)
75      #define RX_LED_ON()      PORTB |= (1<<0)

so that "ON" would be "OFF" and "OFF" would "ON"  and inverted the LED_SETUP(). On my small mind I think that would be all that need to be changed to let the board work like the original one, and now the complicate (only if I think right about the changes) part I'm not able build the alternative Caterina-Bootloader.

So can someone build it? Would be very helpfully
Logged

Canada
Offline Offline
Jr. Member
**
Karma: 1
Posts: 81
Frequently Befuddled
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The bootloader is only doing its thing for a few seconds, when resetting or loading a new sketch.

You could ignore it completely and make those changes in the pins_arduino.h header file and that will (should) handle things while your sketch is running.

It's in the hardware/arduino/variants/leonardo folder.

Then (I am pretty sure) you'll see the TX and RX leds working 'inverted' only when the bootloader is running, but the rest of the time they will work as intended.

Cheers!
Logged

Germany
Offline Offline
Full Member
***
Karma: 10
Posts: 230
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The bootloader is only doing its thing for a few seconds, when resetting or loading a new sketch.

You could ignore it completely and make those changes in the pins_arduino.h header file and that will (should) handle things while your sketch is running.

It's in the hardware/arduino/variants/leonardo folder.

Then (I am pretty sure) you'll see the TX and RX leds working 'inverted' only when the bootloader is running, but the rest of the time they will work as intended.

Cheers!
My fool you are right, for the 3 seconds of bootloader work it would not be relevant I changed it on the pins_arduino.h and make an new variant for it with adding a new board with the variant linked on the boards.txt.

I will test it later.

Thanks
Steph
Logged

Germany
Offline Offline
Full Member
***
Karma: 10
Posts: 230
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Test it, works!
Logged

Pages: [1]   Go Up
Jump to: