Go Down

Topic: Purpose of RX and TX LEDs? (Read 21588 times) previous topic - next topic

wholder

Unlike on the AVR-based boards, these LEDs do not seem to flash when uploading code, nor do they flash when using Serial1, for I/O.

Wayne

Dirk67

not flashing when uploading code via the "Arduino Zero (Programming Port)" or via the "Arduino Zero (Native USB Port)" ?
arduino powered car relais / car "micro PLC" / with USB --> http://goo.gl/ofWFW3

wholder

not flashing when uploading code via the "Arduino Zero (Programming Port)" or via the "Arduino Zero (Native USB Port)" ?
The LEDs don't flash for either port.  As far as I can see, the LEDs are just are just mapped to two I/O pins.

Wayne

Dirk67

#3
Jun 18, 2015, 08:40 am Last Edit: Jun 18, 2015, 08:49 am by Dirk67
yeah, you are right,
I would have expected, that at least the SAM-BA bootloader on the SAMD21 would use these LED's (mapped to two I/O pins) when uploading code via the "Arduino Zero (Native USB Port)" ...  (?)
arduino powered car relais / car "micro PLC" / with USB --> http://goo.gl/ofWFW3

cmaglie

Yes RX/TX led are not implemented yet.

I've opened an issue for that:

https://github.com/arduino/ArduinoCore-samd/issues/6
C.

Isaac96

What pins are the LEDs on? You could probably use them for whatever you want.
Do not PM me for help. I will delete immediately.
CONNECT THE GROUNDS!

After Tuesday, even the calendar goes W T F

cmaglie

Here the definitions


// LEDs
#define PIN_LED_13           (13u)
#define PIN_LED_RXL          (25u)
#define PIN_LED_TXL          (26u)
#define PIN_LED              PIN_LED_13
#define PIN_LED2             PIN_LED_RXL
#define PIN_LED3             PIN_LED_TXL
#define LED_BUILTIN          PIN_LED_13


BTW I'm already doing a patch to use them to signal serial activity on SerialUSB and once implemented there will be no way to use them from the sketch (or at least to use them together with SerialUSB).
C.

bobricius

#7
Sep 23, 2015, 08:09 am Last Edit: Sep 23, 2015, 06:36 pm by bobricius
Hi, Is now RX/TX led supported ?
World smallest Arduino, Attiny85 wave player
https://www.tindie.com/stores/bobricius/

pharaohamps

Here the definitions


// LEDs
#define PIN_LED_13           (13u)
#define PIN_LED_RXL          (25u)
#define PIN_LED_TXL          (26u)
#define PIN_LED              PIN_LED_13
#define PIN_LED2             PIN_LED_RXL
#define PIN_LED3             PIN_LED_TXL
#define LED_BUILTIN          PIN_LED_13


BTW I'm already doing a patch to use them to signal serial activity on SerialUSB and once implemented there will be no way to use them from the sketch (or at least to use them together with SerialUSB).

I can't see this patch as being a positive thing.  I'd much prefer to be able to use these pins in any way I like, since serial activity indicators aren't that useful to me.  If using SerialUSB (and by extension some of the other pluggable USB messages) will preclude the use of two hardware pins, that's a big loss to users wishing to create their own boards using the SAMD21.  I'm using my Zero as a prototype platform before committing to a hardware design, and I'd love to be able to use some of the "reserved" pins such as RXLED and TXLED.

MartinL

Quote
I can't see this patch as being a positive thing.  I'd much prefer to be able to use these pins in any way I like, since serial activity indicators aren't that useful to me.  If using SerialUSB (and by extension some of the other pluggable USB messages) will preclude the use of two hardware pins, that's a big loss to users wishing to create their own boards using the SAMD21.  I'm using my Zero as a prototype platform before committing to a hardware design, and I'd love to be able to use some of the "reserved" pins such as RXLED and TXLED.
I totally agree.

MartinL

#10
Dec 03, 2015, 05:29 pm Last Edit: Dec 03, 2015, 05:41 pm by MartinL
The Tx and Rx LEDs can be turned on and off directly using the port registers:

To set the Tx LED pin to an output (PORT_PA27):
Code: [Select]
REG_PORT_DIRSET0 = PORT_PA27;
To switch the Tx LED on:
Code: [Select]
REG_PORT_OUTCLR0 = PORT_PA27;    // digitalWrite(PIN_LED_TX, LOW);
To switch the Tx LED off:
Code: [Select]
REG_PORT_OUTSET0 = PORT_PA27;    // digitalWrite(PIN_LED_TX, HIGH);
To set the Rx LED pin to an output (PORT_PB03):
Code: [Select]
REG_PORT_DIRSET1 = PORT_PB03;
To switch the Rx LED on:
Code: [Select]
REG_PORT_OUTCLR1 = PORT_PB03;    // digitalWrite(PIN_LED_RX, LOW);
To switch the Rx LED off:
Code: [Select]
REG_PORT_OUTSET1 = PORT_PB03;    // digitalWrite(PIN_LED_RX, HIGH);
The SAMD21 sinks current from the LEDs, so CLR switches the LED on and SET turns it off.

AloyseTech

These pins are defined in the variant files, you can simply use this :

Code: [Select]

pinMode(PIN_LED_RXL,OUTPUT/INPUT/INPUT_PULLUP);
pinMode(PIN_LED_TXL,OUTPUT/INPUT/INPUT_PULLUP);

digitalWrite(PIN_LED_RXL,LOW/HIGH);
digitalWrite(PIN_LED_TXL,LOW/HIGH);


Where PIN_LED_RXL and PIN_LED_TXL is defined like this :

Code: [Select]
#define PIN_LED_RXL          (25u)
#define PIN_LED_TXL          (26u)

sthudium

I attempted to write a very simple sketch to blink the three on-board LEDs on a Zero.

EXPECTED
============
Time   L    Tx    Rx
0 sec    
1 sec  ON
2 sec     
3 sec        ON
4 sec   
5 sec               ON
6 sec    
7 sec  ON
8 sec     
9 sec        ON

ACTUAL
============
Time   L    Tx    Rx
0 sec    
1 sec  ON
2 sec  ON   
3 sec  ON  ON
4 sec  ON 
5 sec  ON         ON
6 sec    
7 sec  ON
8 sec  ON   
9 sec  ON  ON

The problem with the actual results is that the L LED stays on when it shouldn't.

Can anyone figure out what's happening here?  Thanks.

Here is my code:


Code: [Select]
/*============================================
  Blink the three on-board LEDs in sequence
============================================*/

#include "Arduino.h"
#define LED_CNT  3    // number of on-board LEDs:

// define an array of the on-board LEDs:
int ledPin[] = {
  PIN_LED,            // labeled "L" on the board:
  PIN_LED3,           // labeled "TX" on the board:
  PIN_LED2            // labeled "RX" on the board:
};

int led = 0;

void setup() {
  // initialize each pin as an output:
  for (int i = 0; i < LED_CNT; i++)
    pinMode( ledPin[ i ], OUTPUT );
}

void loop() {
  // clear all LEDs:
  for (int i = 0; i < LED_CNT; i++)
    digitalWrite( ledPin[ led ], LOW  );

  // blink the selected LED:
  delay(1000);
  digitalWrite( ledPin[ led ], HIGH );
  delay(1000);

  // choose next LED:
  led += 1;
  if ( led >= LED_CNT ) led = 0;
}
I study the use of cognitive dissonance and confirmation bias to manipulate gullible people.

sthudium

At first I thought my problem was that the "L" LED illuminates whenever "Tx" or "Rx" illuminate.  But I made an ever so minor modification to my sketch and got a different blinking response, without that proposed "L" to "Tx/RX" link.
I study the use of cognitive dissonance and confirmation bias to manipulate gullible people.

Go Up