Do RX/TX LEDS glow?

Hi!
I was using the UNO R4 MINIMA and noticed something.
There is an RX / TX LED, but it has never glowed. I tried communication with both serial (USB) and serial1 (D0/D1), but the LED did not light up in either.
Is this just me?

1 Like

Hi, we are looking into this. Will get back to you with more information.

1 Like

Hi!
Same problem here.
No TX/RX led while downloading to the board or serial activity.
On my Uno R4 Wifi works, but not on the Uno R4 Minima.

Hi, we will update the documentation to reflect the behaviour of RX and TX LED. If you would like to have an idea before the documentation please have a look at the Pin definitions in Arduino Renesas Core in Github.

1 Like

Thank you for telling us.

On the Minima the Tx and Rx LEDs are on P012 and P013.
Note as they are tied to +5V the pin is set LOW to turn on the LED, and HIGH to turn it off.

See RA4M1 datasheet - Section: 19.2.5 Port mn Pin Function Select Register - for bit function description

#define PORTBASE 0x40040000 /* Port Base */
#define PFS_P012PFS_BY ((volatile unsigned char  *)(PORTBASE + 0x0803 + (12 * 4))) // TxLED - VREFH
#define PFS_P013PFS_BY ((volatile unsigned char  *)(PORTBASE + 0x0803 + (13 * 4))) // RxLED - VREFL

void code_function_fragment(void)
  {
  *PFS_P012PFS_BY = 0x04;        // OnBoard TxLED on  
  *PFS_P012PFS_BY = 0x05;        // OnBoard TxLED off   

  *PFS_P013PFS_BY = 0x04;        // OnBoard RxLED on  
  *PFS_P013PFS_BY = 0x05;        // OnBoard RxLED off   
  }

Turning a LED on or turning a LED off takes only 83nS, so has a very minimal overhead on code speed.
So very useful in the Minima for showing code modes etc outside of D13 which is likely already being used for something e.g SPI clock.

2 Likes

Minima seems to have very "sparse" "board pin" definitions. Pretty much nothing more than 0-19 to cover the Digital and Analog pins, plus one more for for reading Vcc.

If the rxled and txled aren't available to digitalWrite()/etc, they might as well not exist :frowning:
This is a bug, IMO.

1 Like

Use my code as above to turn the LEDs On or Off, it is fully functional for the Minima and does not need any other setups to use.

Don't need to use the digitalWrite() function, which takes Foooooeeeevvveeerrr! to execute.

It really is this simple :slight_smile:

shine your TX led at a CCD video camera. it should light up. you should not see them on a CMOS camera

a CCTV camera that works with an LED IR illuminator is CCD. a high qualty video camera should be CCD. If an infrared heater glows like a searchlight when seen by a camera, that is a CCD camera

your cellphone is probably a CMOS camera

In order to make all relevant information available to any who are interested in this subject, I'll share a link to the formal report submitted by @westfw here:

Thanks!

The TX and RX LEDs emit visible light, No need for an IR sensitive camera.

I can see them with my eyes, they are yellow.

1 Like

I can confirm that the Rx and Tx LEDs are yellow, and clearly visible. :slight_smile:

1 Like

With the new board core (1.0.4), those LEDs can be user controlled with simple sketch like:

void setup() {
pinMode(22, OUTPUT); // Use 21 for TX LED.
}
void loop() {
digitalWrite(22, HIGH);
delay(1000);
digitalWrite(22, LOW);
delay(1000);
}

1 Like

After upgrading the Arduino IDE to 2.2.1, I was able to update the Arduino UNO R4 Boards to 1.0.4. I was able to display RX/TX with the code you indicated. Thank you.

1 Like

This is great. WIll be interesting to try out these pins as well as the others that were defined.

Sorry if this is slightly off the topic.

Wondering about Symbolic names for these pins as well as others?
Two new pin definitions were added for the two pins. Actually 6 pins were added to variant.cpp.

  { BSP_IO_PORT_00_PIN_12,    P012   }, /* (21) TX LED  */
  { BSP_IO_PORT_00_PIN_13,    P013   }, /* (22) RX LED  */

  { BSP_IO_PORT_05_PIN_01,    P501   }, /* (23) TX on SWD connector  */
  { BSP_IO_PORT_05_PIN_02,    P502   }, /* (24) RX on SWD connector  */
  { BSP_IO_PORT_01_PIN_08,    P108   }, /* (25) SWDIO  */
  { BSP_IO_PORT_03_PIN_00,    P300   }, /* (26) SWCLK  */

(I Updated and uploaded my excel document... )

Was wondering about the usage/availability of the symbolic names for these pins?

That is, there are symbolic names created for these pins as well as several other in the e2studioproject file (configuration.xml)

...
    <symbolicName propertyId="p011.symbolic_name" value="LED_RED"/>
    <symbolicName propertyId="p012.symbolic_name" value="TX_LED"/>
    <symbolicName propertyId="p013.symbolic_name" value="LED_BLUE"/>
...
    <symbolicName propertyId="p201.symbolic_name" value="RX_LED"/>
...

These defines are then generated in the variant file bsp_pin_cfg.h) which is included (through a few levels of header files) in Arduino.h.

#define LED_RED (BSP_IO_PORT_00_PIN_11)
#define TX_LED (BSP_IO_PORT_00_PIN_12)
#define LED_BLUE (BSP_IO_PORT_00_PIN_13)
#define RX_LED (BSP_IO_PORT_02_PIN_01)

So it appears like they were given symbolic names:
Pin 21 -> P012 -> TX_LED
Pin 22 -> P013 -> LED_BLUE

My question is: Are there ways to properly use these defines, within an Arduino sketch or library? If not, maybe these defines should be removed? Especially those which do not actually exist, like RX_LED or LED_RED

1 Like

Possible way to use them:

int led_blue = -1;
int tx_led = -1;
void setup() {
  while (!Serial && millis() < 5000) {}
  Serial.begin(9600);

  led_blue = getPinIndex(LED_BLUE);
  Serial.print("LED_BLUE index: ");
  Serial.println(led_blue, DEC);

  Serial.print("LED_RED index: ");
  Serial.println(getPinIndex(LED_RED), DEC);

  Serial.print("TX_LED index: ");
  Serial.println((tx_led = getPinIndex(TX_LED)), DEC);

  Serial.print("RX_LED index: ");
  Serial.println(getPinIndex(RX_LED), DEC);



  if (led_blue < 0) {
    pinMode(LED_BUILTIN, OUTPUT);
    while (1) {
      digitalWrite(LED_BUILTIN, HIGH);
      delay(250);
      digitalWrite(LED_BUILTIN, LOW);
      delay(250);
    }
  }
  pinMode(led_blue, OUTPUT);
  pinMode(tx_led, OUTPUT);

}

uint8_t loop_count = 0;
void loop() {
  loop_count++;
  digitalWrite(led_blue,  (loop_count & 1)? HIGH : LOW);
  digitalWrite(tx_led,  (loop_count & 1)? LOW : HIGH);
  delay(1000);
}

Serial output:

LED_BLUE index: 22
LED_RED index: -1
TX_LED index: 21
RX_LED index: -1

Note: Both leds are yellow, so LED_BLUE is not helpful.

And likewise if I run same sketch on WIFI, output shows:

LED_BLUE index: 32
LED_RED index: 30
TX_LED index: 31
RX_LED index: -1

And by accident it alternates turning on LED Matrix LED 4 and 5.

They are probably tied to digitalWrite(). I saw some code earlier to turn these on. - try:

void loop() {
digitalWrite(LED_TX, HIGH)
digitalWrite(LED_RX, HIGH)
}

Sorry if my code looks bad - I know nearly nothing about C++. :joy:

Small footnote:
Pin P010 to P015 total current can not exceed 30mA and TX and RX have 330 ohm resistors, so that's already almost 20mA meaning A0 (the DAC) should not see more than 10mA if the LEDs are on