Code Monkey home page Code Monkey logo

arduinocore-renesas's Introduction

Arduino Renesas fsp Boards

Sync Labels status

Recompile libfsp.a

  • Navigate to extras/e2studioProjects/$projectName
  • Open the project in e2studio and build it
  • Launch fsp_to_arduino.sh script; this will
    • rebuild the library without .c files in ra_gen
    • rename the library and copy in variant/$boardName/libs
    • copy the include files (both generated and from fsp) in variant/$boardName/libs
    • copy the .c files in ra_gen to variants/$boardName/tmp_gen_c_files/ -> ONLY TEMPORARILY, these files will eventually go away

arduinocore-renesas's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

arduinocore-renesas's Issues

OPAMP example?

How can we configure and use the OPAMP? I could not find any code related to the OPAMP peripheral in the core. Only there are a few defines in the variants directory.

Serial[x].print/write - Could use some major performance enhancement.

It appears like any calls to Serial.print(), including Serial.println and likewise Serial.write(buffer, cnt), will remain in these calls, until the last byte is queued to the underlying UART.

Here is a simple sketch:

void setup() {
  Serial1.begin(115200); 
  pinMode(2, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);
}

uint32_t loop_count = 0;
void loop() {
  digitalWrite(5, HIGH);
  Serial1.print("Hello World...");
  digitalWrite(5, LOW);
  digitalWrite(5, HIGH);
  Serial1.println(loop_count++, DEC);
  digitalWrite(5, LOW);
  delay(10);
  digitalWrite(5, HIGH);
  Serial1.write("Buffer\n", 7);
  digitalWrite(5, LOW);
  delay(1000);  
}

Note, I instrumented the UART::write methods in Serial.cpp:

/* -------------------------------------------------------------------------- */
size_t UART::write(uint8_t c) {
/* -------------------------------------------------------------------------- */  
  if(init_ok) {
    tx_done = false;
    digitalWrite(2, HIGH);
    R_SCI_UART_Write(&uart_ctrl, &c, 1);
    digitalWrite(3, HIGH);
    while (!tx_done) {}
    digitalWrite(3, LOW);
    digitalWrite(2, LOW);  
    return 1;
  }
  else {
    return 0;
  }
}

size_t  UART::write(uint8_t* c, size_t len) {
  if(init_ok) {
    tx_done = false;
    digitalWrite(2, HIGH);
    R_SCI_UART_Write(&uart_ctrl, c, len);
    digitalWrite(3, HIGH);
    while (!tx_done) {}
    digitalWrite(3, LOW);
    digitalWrite(2, LOW);
    return len;
  }
  else {
    return 0;
  }
}

Likewise the callback method:

/* -------------------------------------------------------------------------- */
void UART::WrapperCallback(uart_callback_args_t *p_args) {
/* -------------------------------------------------------------------------- */  

  uint32_t channel = p_args->channel;
  
  UART *uart_ptr = UART::g_uarts[channel];

  if(uart_ptr == nullptr) {
    return;
  }
  

  digitalWrite(4, HIGH);

  switch (p_args->event){
      case UART_EVENT_ERR_PARITY:
      case UART_EVENT_ERR_FRAMING:
      case UART_EVENT_ERR_OVERFLOW:
      case UART_EVENT_RX_COMPLETE: // This is called when all the "expected" data are received
      {
          break;
      }
      case UART_EVENT_TX_COMPLETE:
      case UART_EVENT_TX_DATA_EMPTY:
      {
        //uint8_t to_enqueue = uart_ptr->txBuffer.available() < uart_ptr->uart_ctrl.fifo_depth ? uart_ptr->txBuffer.available() : uart_ptr->uart_ctrl.fifo_depth;
        //while (to_enqueue) {
        uart_ptr->tx_done = true;
        break;
      }
      case UART_EVENT_RX_CHAR:
      {
        if (uart_ptr->rxBuffer.availableForStore()) {
          uart_ptr->rxBuffer.store_char(p_args->data);
        }
        break;
      }
      case UART_EVENT_BREAK_DETECT:
      {
          break;
      }
  }

  digitalWrite(4, LOW);
}

Here are some images of the Logic analyzer output.
image

image

Observations:

  1. it appears like in all cases, the write method: size_t UART::write(uint8_t c)
    is being called, I would have expected the version: size_t UART::write(uint8_t* c, size_t len)
    to be called for the print of a string as well as the simple write of a buffer.

  2. I would have expected that there would be some form of software FIFO queue, like is on most of the other platforms, and only have to wait if you are writing more data than will fit. Would also expect that availableForWrite)_ would be implemented to give you a clue of how much I can write.

  3. Hardware FIFO? I believe the first two UARTS have 16 byte queues? If so why does it look like only one bytes at a type is sent...
    Maybe part of 1).

  4. Why are the write methods waiting at the end at all? Especially when they are waiting for an ISR to be called to set the tx_done?
    The only wait that should happen is if the hardware and/or software queues are full at the start of the call, should they wait for space to become available. And this waiting code should understand and deal with if the code calling write has a higher priority than the Serial UART ISR handler, but that is a different issue #38

Maybe more as I try to better understand all of the layers of this code.

UNO R4 Minima: CAN transmit/receive doesn't work - [Solved]

I'm using an UNO R4 Minima together with a NXP TJA1051 CAN high speed transceiver at 500 kBaud.

It's not possible to receive or transmit any CAN frames.

The TJA1051 I've cross-checked in my exiting CAN setup on an ESP32 and there it's properly working (there is also a Raspberry Pi2 with CAN HAT plus USB2CAN-FD connected to my Linux PC on which SavvyCAN and a socketCAN application is running).

By using the Arduino example "CANWrite" incl. changed baud rate from 250 to 500 kBaud, the following error is shown in the terminal:

CAN.write(...) failed with error code -60003

Changing Compiler Optimization Seems to have no affect.

In platforms.txt I changed the optimization level from -Os to -O2 and appears to have no affect performance. Using a coremark sketch that I used before the issue becomes apparent. See this post: https://forum.arduino.cc/t/changing-compiler-optimizations-had-no-affect/1150181/4. In summary:

Uno R4 WiFi (48Mhz, -0s) -  81.81
Uno R4 WiFi (48Mhz, -02) -  81.81
UnoR4 Minima (-02) - 106.75
UnoR4 Minima (-0s) - 106.75

but when I change it for other boards:

Teensy 3.2 (48Mhz -0s)  -  86.23
Teensy 3.2 (48Mhz -02)  - 116.07
Feather M0 (48Mhz -0s)  -   48.61
Feather M0 (48Mhz -02)  -   83.85
CH32V307 Eval(48Mhz -0s) - 91.80
CH32V307 Eval(48Mhz -02) - 116.52

it appears to make a difference. Is there something I am missing or can this be related to the micros issue. From what I saw the time is calculated from using millis()

REF: https://github.com/PaulStoffregen/CoreMark

QSPI bug with Portenta C33

While experimenting with Portenta C33 and certificate upload I discovered a bug 🐛 :
When a file is uploaded in the external QSPI of the board somehow it's corrupted.
To reproduce:

  1. flash the board with the UsbMsd/examples/MSD_QSPI/ example
  2. upload a file to the board using the new example in #2 or simply by copying to the mounted FS ( cp SSH_1.pdf /media/umberto/EB9F-C47C/SSH_1.pdf) ( the file I uploaded is here: SSH_1.pdf
  3. reset the board
  4. download the file from the mounted drive ( cp /media/umberto/EB9F-C47C/SSH_1.pdf SSH_1_new.pdf) (the file I got is here:
    SSH_1_new.pdf
  5. the files are different:
$ md5sum SSH_1.pdf
fba0dc994d857d5eee569ce2057b1b54  SSH_1.pdf
$ md5sum SSH_1_new.pdf 
b273108e7e4616afa33a5094d4c00068  SSH_1_new.pdf
  1. vbindiff SSH_1.pdf SSH_1_new.pdf:
    image

I don't know if that USBS in the vbindiff output could be a hint...

calling attachInterrupt(pin, ISR) within a c++ objects constructor

Problem:
calling attachInterrupt(pin, ISR) within a c++ objects constructor does not work for global objects.

We (@mjs513 and myself) found this issue when we were testing out the encoder library on both of the new
UNO R4 boards. We discovered that the attachInterrupt call within the constructor was not working. Did not
fault or the like, but the callback method was not called.

More details in the forum thread:
https://forum.arduino.cc/t/encoder-library-attachinterrupt-not-working-from-within-library/1149007/8

Reproducing the issue:
Run the "Basic" example of the Encoder library: https://github.com/paulStoffregen/encoder
And hook up something to the pins that allow you to make/break contact. I was using an encoder on one of my old robots.

Or here is a simple example sketch that shows the problem, without having to use an external library:

class test_stuff_in_constructor {
public:
  test_stuff_in_constructor(uint8_t pin)
    : _pin(pin) {
    pinMode(pin, INPUT_PULLUP);
    attachInterrupt(pin, &changeFunc, CHANGE);
    pinMode(LED_BUILTIN, OUTPUT);
    _counter = 0;
  }
  uint32_t count() {
    return _counter;
  }
  uint8_t pin() {
    return _pin;
  }
private:
  uint8_t _pin;

  static volatile uint32_t _counter;
  static void changeFunc() {
    digitalWrite(LED_BUILTIN, HIGH);
    _counter++;
  }
};

test_stuff_in_constructor testobj(2);
volatile uint32_t test_stuff_in_constructor::_counter = 0;

void setup() {
  // put your setup code here, to run once:
  while (!Serial && millis() < 4000)
    ;
  Serial.begin(115200);

  Serial.println("Test constructor stuff");
  Serial.print("Pin: ");
  Serial.println(testobj.pin());
}

uint32_t previous_count = 0;
void loop() {
  // put your main code here, to run repeatedly:
  uint32_t count = testobj.count();
  if (count != previous_count) {
    Serial.println(count, DEC);
    previous_count = count;
  }
}

Again with the above example, the function changeFunc is not called. However, if you instead have a global variable that holds a pointer to one of these objects and do a new within setup, it works. Ditto it works if you have it global, and have a two step initialization of the object, where the attachInterrupt is called there.

So for the Encoder library we have a workaround for this issue, and there is a Pull Request to the Encoder library to allow a two step initialization.

However it should be noted that the library has worked up till now on most if not all Arduino boards without needing this change.

Possible Things to investigate

  1. What is the state of the hardware and core code, when the C++ constructors are called?
    Maybe it is: __libc_init_array(); ?

  2. Maybe it is the order of c++ constructors that are called?
    For example suppose objects constructor is called before the:
    static IrqPool IrqChannel{};
    in Interrupts.cpp?

  3. ???

Comments:
Unclear to me, how global of an issue this might be. What other things that may or may not work when called from c++ constructors of global objects? IO pins? Serial objects? Wire? SPI?

Portenta C33-specific platform bundled libraries/examples are included in the "Arduino UNO R4 Boards" platform distribution

Board: Uno R4 Wifi
Core version 1.0.1

  1. RTC:
    • RTC_Alarm
      • LEDR etc were not defined
    • RTC_NTPSync
      • fatal error: WiFiC3.h: No such file or directory #include <WiFiC3.h>
      • change to -> #include "WiFiS3.h"
  2. Storage:
    • FatFsOnQSPIFlash
      • undefined reference to `BlockDevice::get_default_instance()'
    • LittleFsOnQSPIFlash
      • undefined reference to `BlockDevice::get_default_instance()'
    • QSPIFormat
      • undefined reference to `BlockDevice::get_default_instance()'
    • QSPIFReadPartitions
      • undefined reference to `BlockDevice::get_default_instance()'
    • TestCodeFlash
      • TestCodeFlash.ino.elf section .bss will not fit in region RAM
    • TestQSPIF
      • error: 'QSPI_ERASE_BLOCK_SIZE' was not declared in this scope
    • TestSDCARD
      • error: 'SDCardBlockDevice' does not name a type; did you mean 'BlockDevice'?
  3. UsbMsd
    • MSD_QSPI
      • error: 'SCSI_SENSE_ILLEGAL_REQUEST' was not declared in this scope
    • MSD_QSPI_SDCard
      • 'QSPIFlashBlockDevice' does not name a type; did you mean 'BlockDevice'?
    • MSD_SDCard
      • 'SDCardBlockDevice' does not name a type; did you mean 'BlockDevice'?

A lot of examples were just lazily copied from other board's examples (Portenta C33) 😱 and some of the does not make sense (SD card?)

Wire::setClock() only allows exact values of 100kHz, 400kHz, and 1 MHz

The case statements in void TwoWire::setClock(uint32_t freq) are at odds with Wire for Uno R3.

Uno R3 allows a range of clock values.

//   Probably R3 should be range checked.
void TwoWire::setClock(uint32_t clock)
{
  twi_setFrequency(clock);
}
void twi_setFrequency(uint32_t frequency)
{
  TWBR = ((F_CPU / frequency) - 16) / 2;
}

The R4 boards only allow values in this enum:

/** Communication speed options */
typedef enum e_i2c_master_rate
{
    I2C_MASTER_RATE_STANDARD = 100000, ///< 100 kHz
    I2C_MASTER_RATE_FAST     = 400000, ///< 400 kHz
    I2C_MASTER_RATE_FASTPLUS = 1000000 ///< 1 MHz
} i2c_master_rate_t;

The I2C standard suggest you should allow the best match possible to the requested clock.

The I2C clock can be 0 Hz to 100 kHz, 0 Hz to 400 kHz, 0 Hz to 1 MHz and 0 Hz to 3.4 MHz, depending on the mode. This means that an I2C-bus running at less than 10 kHz is not SMBus compliant since the SMBus devices may time-out.

Robotis Libraries DynamixelShield and Dynamixel2Arduino examples do not build (or work)

As I mentioned on the forum (https://forum.arduino.cc/t/robotis-dynamixel-shield-code-does-not-compile/1150975)

The Robotis libraries which are used with their Arduino shield:
https://en.robotis.com/shop_en/item.php?it_id=902-0146-000

Does not compile for the new UNO R4 boards.

More details on the forum posting.

To reproduce, install those libraries using the library manager.
Load one of the examples, I used the scan_dynamixel.ino.

And try compile.

FQBN: arduino:renesas_uno:minima
Using board 'minima' from platform in folder: C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.0.2
Using core 'arduino' from platform in folder: C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.0.2

Detecting libraries used...
"C:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\7-2017q4/bin/arm-none-eabi-g++" -c -w -Os -g3 -fno-use-cxa-atexit -fno-rtti -fno-exceptions -nostdlib -DF_CPU=48000000 -DARDUINO_UNOR4_MINIMA -std=gnu++17 -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fsigned-char -ffunction-sections -fdata-sections -fmessage-length=0 -fno-builtin -w -x c++ -E -CC -DARDUINO=10607 "-DPROJECT_NAME=\"C:\\Users\\kurte\\AppData\\Local\\Temp\\arduino\\sketches\\FD507D8329F1DFE2A4230DE8826AA014/scan_dynamixel.ino\"" -DARDUINO_MINIMA -DARDUINO_ARCH_RENESAS_UNO -DARDUINO_ARCH_RENESAS -DARDUINO_FSP -D_XOPEN_SOURCE -mthumb "@C:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\variants\\MINIMA/defines.txt" -DCFG_TUSB_MCU=OPT_MCU_RAXXX "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2/cores/arduino/tinyusb" "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\cores\\arduino/api/deprecated" "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\cores\\arduino/api/deprecated-avr-comp" "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\cores\\arduino" "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\variants\\MINIMA" "-iprefixC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2" "@C:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\variants\\MINIMA/includes.txt" "C:\\Users\\kurte\\AppData\\Local\\Temp\\arduino\\sketches\\FD507D8329F1DFE2A4230DE8826AA014\\sketch\\scan_dynamixel.ino.cpp" -o nul
Alternatives for DynamixelShield.h: [[email protected]]
ResolveLibrary(DynamixelShield.h)
  -> candidates: [[email protected]]
"C:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\7-2017q4/bin/arm-none-eabi-g++" -c -w -Os -g3 -fno-use-cxa-atexit -fno-rtti -fno-exceptions -nostdlib -DF_CPU=48000000 -DARDUINO_UNOR4_MINIMA -std=gnu++17 -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fsigned-char -ffunction-sections -fdata-sections -fmessage-length=0 -fno-builtin -w -x c++ -E -CC -DARDUINO=10607 "-DPROJECT_NAME=\"C:\\Users\\kurte\\AppData\\Local\\Temp\\arduino\\sketches\\FD507D8329F1DFE2A4230DE8826AA014/scan_dynamixel.ino\"" -DARDUINO_MINIMA -DARDUINO_ARCH_RENESAS_UNO -DARDUINO_ARCH_RENESAS -DARDUINO_FSP -D_XOPEN_SOURCE -mthumb "@C:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\variants\\MINIMA/defines.txt" -DCFG_TUSB_MCU=OPT_MCU_RAXXX "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2/cores/arduino/tinyusb" "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\cores\\arduino/api/deprecated" "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\cores\\arduino/api/deprecated-avr-comp" "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\cores\\arduino" "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\variants\\MINIMA" "-Ic:\\Users\\kurte\\Documents\\Arduino\\libraries\\DynamixelShield\\src" "-iprefixC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2" "@C:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\variants\\MINIMA/includes.txt" "C:\\Users\\kurte\\AppData\\Local\\Temp\\arduino\\sketches\\FD507D8329F1DFE2A4230DE8826AA014\\sketch\\scan_dynamixel.ino.cpp" -o nul
Alternatives for Dynamixel2Arduino.h: [[email protected]]
ResolveLibrary(Dynamixel2Arduino.h)
  -> candidates: [[email protected]]
"C:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\7-2017q4/bin/arm-none-eabi-g++" -c -w -Os -g3 -fno-use-cxa-atexit -fno-rtti -fno-exceptions -nostdlib -DF_CPU=48000000 -DARDUINO_UNOR4_MINIMA -std=gnu++17 -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fsigned-char -ffunction-sections -fdata-sections -fmessage-length=0 -fno-builtin -w -x c++ -E -CC -DARDUINO=10607 "-DPROJECT_NAME=\"C:\\Users\\kurte\\AppData\\Local\\Temp\\arduino\\sketches\\FD507D8329F1DFE2A4230DE8826AA014/scan_dynamixel.ino\"" -DARDUINO_MINIMA -DARDUINO_ARCH_RENESAS_UNO -DARDUINO_ARCH_RENESAS -DARDUINO_FSP -D_XOPEN_SOURCE -mthumb "@C:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\variants\\MINIMA/defines.txt" -DCFG_TUSB_MCU=OPT_MCU_RAXXX "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2/cores/arduino/tinyusb" "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\cores\\arduino/api/deprecated" "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\cores\\arduino/api/deprecated-avr-comp" "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\cores\\arduino" "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\variants\\MINIMA" "-Ic:\\Users\\kurte\\Documents\\Arduino\\libraries\\DynamixelShield\\src" "-Ic:\\Users\\kurte\\Documents\\Arduino\\libraries\\Dynamixel2Arduino\\src" "-iprefixC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2" "@C:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\variants\\MINIMA/includes.txt" "C:\\Users\\kurte\\AppData\\Local\\Temp\\arduino\\sketches\\FD507D8329F1DFE2A4230DE8826AA014\\sketch\\scan_dynamixel.ino.cpp" -o nul
"C:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\7-2017q4/bin/arm-none-eabi-g++" -c -w -Os -g3 -fno-use-cxa-atexit -fno-rtti -fno-exceptions -nostdlib -DF_CPU=48000000 -DARDUINO_UNOR4_MINIMA -std=gnu++17 -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fsigned-char -ffunction-sections -fdata-sections -fmessage-length=0 -fno-builtin -w -x c++ -E -CC -DARDUINO=10607 "-DPROJECT_NAME=\"C:\\Users\\kurte\\AppData\\Local\\Temp\\arduino\\sketches\\FD507D8329F1DFE2A4230DE8826AA014/scan_dynamixel.ino\"" -DARDUINO_MINIMA -DARDUINO_ARCH_RENESAS_UNO -DARDUINO_ARCH_RENESAS -DARDUINO_FSP -D_XOPEN_SOURCE -mthumb "@C:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\variants\\MINIMA/defines.txt" -DCFG_TUSB_MCU=OPT_MCU_RAXXX "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2/cores/arduino/tinyusb" "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\cores\\arduino/api/deprecated" "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\cores\\arduino/api/deprecated-avr-comp" "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\cores\\arduino" "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\variants\\MINIMA" "-Ic:\\Users\\kurte\\Documents\\Arduino\\libraries\\DynamixelShield\\src" "-Ic:\\Users\\kurte\\Documents\\Arduino\\libraries\\Dynamixel2Arduino\\src" "-iprefixC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2" "@C:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\variants\\MINIMA/includes.txt" "c:\\Users\\kurte\\Documents\\Arduino\\libraries\\DynamixelShield\\src\\DynamixelShield.cpp" -o nul
"C:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\7-2017q4/bin/arm-none-eabi-g++" -c -w -Os -g3 -fno-use-cxa-atexit -fno-rtti -fno-exceptions -nostdlib -DF_CPU=48000000 -DARDUINO_UNOR4_MINIMA -std=gnu++17 -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fsigned-char -ffunction-sections -fdata-sections -fmessage-length=0 -fno-builtin -w -x c++ -E -CC -DARDUINO=10607 "-DPROJECT_NAME=\"C:\\Users\\kurte\\AppData\\Local\\Temp\\arduino\\sketches\\FD507D8329F1DFE2A4230DE8826AA014/scan_dynamixel.ino\"" -DARDUINO_MINIMA -DARDUINO_ARCH_RENESAS_UNO -DARDUINO_ARCH_RENESAS -DARDUINO_FSP -D_XOPEN_SOURCE -mthumb "@C:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\variants\\MINIMA/defines.txt" -DCFG_TUSB_MCU=OPT_MCU_RAXXX "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2/cores/arduino/tinyusb" "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\cores\\arduino/api/deprecated" "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\cores\\arduino/api/deprecated-avr-comp" "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\cores\\arduino" "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\variants\\MINIMA" "-Ic:\\Users\\kurte\\Documents\\Arduino\\libraries\\DynamixelShield\\src" "-Ic:\\Users\\kurte\\Documents\\Arduino\\libraries\\Dynamixel2Arduino\\src" "-iprefixC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2" "@C:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\variants\\MINIMA/includes.txt" "c:\\Users\\kurte\\Documents\\Arduino\\libraries\\DynamixelShield\\src\\util\\RobotisRemoteController.cpp" -o nul
"C:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\7-2017q4/bin/arm-none-eabi-g++" -c -w -Os -g3 -fno-use-cxa-atexit -fno-rtti -fno-exceptions -nostdlib -DF_CPU=48000000 -DARDUINO_UNOR4_MINIMA -std=gnu++17 -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fsigned-char -ffunction-sections -fdata-sections -fmessage-length=0 -fno-builtin -w -x c++ -E -CC -DARDUINO=10607 "-DPROJECT_NAME=\"C:\\Users\\kurte\\AppData\\Local\\Temp\\arduino\\sketches\\FD507D8329F1DFE2A4230DE8826AA014/scan_dynamixel.ino\"" -DARDUINO_MINIMA -DARDUINO_ARCH_RENESAS_UNO -DARDUINO_ARCH_RENESAS -DARDUINO_FSP -D_XOPEN_SOURCE -mthumb "@C:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\variants\\MINIMA/defines.txt" -DCFG_TUSB_MCU=OPT_MCU_RAXXX "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2/cores/arduino/tinyusb" "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\cores\\arduino/api/deprecated" "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\cores\\arduino/api/deprecated-avr-comp" "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\cores\\arduino" "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\variants\\MINIMA" "-Ic:\\Users\\kurte\\Documents\\Arduino\\libraries\\DynamixelShield\\src" "-Ic:\\Users\\kurte\\Documents\\Arduino\\libraries\\Dynamixel2Arduino\\src" "-iprefixC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2" "@C:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\variants\\MINIMA/includes.txt" "c:\\Users\\kurte\\Documents\\Arduino\\libraries\\Dynamixel2Arduino\\src\\Dynamixel2Arduino.cpp" -o nul
"C:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\7-2017q4/bin/arm-none-eabi-g++" -c -w -Os -g3 -fno-use-cxa-atexit -fno-rtti -fno-exceptions -nostdlib -DF_CPU=48000000 -DARDUINO_UNOR4_MINIMA -std=gnu++17 -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fsigned-char -ffunction-sections -fdata-sections -fmessage-length=0 -fno-builtin -w -x c++ -E -CC -DARDUINO=10607 "-DPROJECT_NAME=\"C:\\Users\\kurte\\AppData\\Local\\Temp\\arduino\\sketches\\FD507D8329F1DFE2A4230DE8826AA014/scan_dynamixel.ino\"" -DARDUINO_MINIMA -DARDUINO_ARCH_RENESAS_UNO -DARDUINO_ARCH_RENESAS -DARDUINO_FSP -D_XOPEN_SOURCE -mthumb "@C:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\variants\\MINIMA/defines.txt" -DCFG_TUSB_MCU=OPT_MCU_RAXXX "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2/cores/arduino/tinyusb" "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\cores\\arduino/api/deprecated" "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\cores\\arduino/api/deprecated-avr-comp" "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\cores\\arduino" "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\variants\\MINIMA" "-Ic:\\Users\\kurte\\Documents\\Arduino\\libraries\\DynamixelShield\\src" "-Ic:\\Users\\kurte\\Documents\\Arduino\\libraries\\Dynamixel2Arduino\\src" "-iprefixC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2" "@C:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\variants\\MINIMA/includes.txt" "c:\\Users\\kurte\\Documents\\Arduino\\libraries\\Dynamixel2Arduino\\src\\actuator.cpp" -o nul
"C:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\7-2017q4/bin/arm-none-eabi-g++" -c -w -Os -g3 -fno-use-cxa-atexit -fno-rtti -fno-exceptions -nostdlib -DF_CPU=48000000 -DARDUINO_UNOR4_MINIMA -std=gnu++17 -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fsigned-char -ffunction-sections -fdata-sections -fmessage-length=0 -fno-builtin -w -x c++ -E -CC -DARDUINO=10607 "-DPROJECT_NAME=\"C:\\Users\\kurte\\AppData\\Local\\Temp\\arduino\\sketches\\FD507D8329F1DFE2A4230DE8826AA014/scan_dynamixel.ino\"" -DARDUINO_MINIMA -DARDUINO_ARCH_RENESAS_UNO -DARDUINO_ARCH_RENESAS -DARDUINO_FSP -D_XOPEN_SOURCE -mthumb "@C:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\variants\\MINIMA/defines.txt" -DCFG_TUSB_MCU=OPT_MCU_RAXXX "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2/cores/arduino/tinyusb" "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\cores\\arduino/api/deprecated" "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\cores\\arduino/api/deprecated-avr-comp" "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\cores\\arduino" "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\variants\\MINIMA" "-Ic:\\Users\\kurte\\Documents\\Arduino\\libraries\\DynamixelShield\\src" "-Ic:\\Users\\kurte\\Documents\\Arduino\\libraries\\Dynamixel2Arduino\\src" "-iprefixC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2" "@C:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\variants\\MINIMA/includes.txt" "c:\\Users\\kurte\\Documents\\Arduino\\libraries\\Dynamixel2Arduino\\src\\dxl_c\\protocol.c" -o nul
"C:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\7-2017q4/bin/arm-none-eabi-g++" -c -w -Os -g3 -fno-use-cxa-atexit -fno-rtti -fno-exceptions -nostdlib -DF_CPU=48000000 -DARDUINO_UNOR4_MINIMA -std=gnu++17 -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fsigned-char -ffunction-sections -fdata-sections -fmessage-length=0 -fno-builtin -w -x c++ -E -CC -DARDUINO=10607 "-DPROJECT_NAME=\"C:\\Users\\kurte\\AppData\\Local\\Temp\\arduino\\sketches\\FD507D8329F1DFE2A4230DE8826AA014/scan_dynamixel.ino\"" -DARDUINO_MINIMA -DARDUINO_ARCH_RENESAS_UNO -DARDUINO_ARCH_RENESAS -DARDUINO_FSP -D_XOPEN_SOURCE -mthumb "@C:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\variants\\MINIMA/defines.txt" -DCFG_TUSB_MCU=OPT_MCU_RAXXX "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2/cores/arduino/tinyusb" "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\cores\\arduino/api/deprecated" "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\cores\\arduino/api/deprecated-avr-comp" "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\cores\\arduino" "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\variants\\MINIMA" "-Ic:\\Users\\kurte\\Documents\\Arduino\\libraries\\DynamixelShield\\src" "-Ic:\\Users\\kurte\\Documents\\Arduino\\libraries\\Dynamixel2Arduino\\src" "-iprefixC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2" "@C:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\variants\\MINIMA/includes.txt" "c:\\Users\\kurte\\Documents\\Arduino\\libraries\\Dynamixel2Arduino\\src\\utility\\master.cpp" -o nul
"C:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\7-2017q4/bin/arm-none-eabi-g++" -c -w -Os -g3 -fno-use-cxa-atexit -fno-rtti -fno-exceptions -nostdlib -DF_CPU=48000000 -DARDUINO_UNOR4_MINIMA -std=gnu++17 -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fsigned-char -ffunction-sections -fdata-sections -fmessage-length=0 -fno-builtin -w -x c++ -E -CC -DARDUINO=10607 "-DPROJECT_NAME=\"C:\\Users\\kurte\\AppData\\Local\\Temp\\arduino\\sketches\\FD507D8329F1DFE2A4230DE8826AA014/scan_dynamixel.ino\"" -DARDUINO_MINIMA -DARDUINO_ARCH_RENESAS_UNO -DARDUINO_ARCH_RENESAS -DARDUINO_FSP -D_XOPEN_SOURCE -mthumb "@C:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\variants\\MINIMA/defines.txt" -DCFG_TUSB_MCU=OPT_MCU_RAXXX "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2/cores/arduino/tinyusb" "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\cores\\arduino/api/deprecated" "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\cores\\arduino/api/deprecated-avr-comp" "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\cores\\arduino" "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\variants\\MINIMA" "-Ic:\\Users\\kurte\\Documents\\Arduino\\libraries\\DynamixelShield\\src" "-Ic:\\Users\\kurte\\Documents\\Arduino\\libraries\\Dynamixel2Arduino\\src" "-iprefixC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2" "@C:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\variants\\MINIMA/includes.txt" "c:\\Users\\kurte\\Documents\\Arduino\\libraries\\Dynamixel2Arduino\\src\\utility\\port_handler.cpp" -o nul
"C:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\7-2017q4/bin/arm-none-eabi-g++" -c -w -Os -g3 -fno-use-cxa-atexit -fno-rtti -fno-exceptions -nostdlib -DF_CPU=48000000 -DARDUINO_UNOR4_MINIMA -std=gnu++17 -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fsigned-char -ffunction-sections -fdata-sections -fmessage-length=0 -fno-builtin -w -x c++ -E -CC -DARDUINO=10607 "-DPROJECT_NAME=\"C:\\Users\\kurte\\AppData\\Local\\Temp\\arduino\\sketches\\FD507D8329F1DFE2A4230DE8826AA014/scan_dynamixel.ino\"" -DARDUINO_MINIMA -DARDUINO_ARCH_RENESAS_UNO -DARDUINO_ARCH_RENESAS -DARDUINO_FSP -D_XOPEN_SOURCE -mthumb "@C:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\variants\\MINIMA/defines.txt" -DCFG_TUSB_MCU=OPT_MCU_RAXXX "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2/cores/arduino/tinyusb" "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\cores\\arduino/api/deprecated" "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\cores\\arduino/api/deprecated-avr-comp" "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\cores\\arduino" "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\variants\\MINIMA" "-Ic:\\Users\\kurte\\Documents\\Arduino\\libraries\\DynamixelShield\\src" "-Ic:\\Users\\kurte\\Documents\\Arduino\\libraries\\Dynamixel2Arduino\\src" "-iprefixC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2" "@C:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\variants\\MINIMA/includes.txt" "c:\\Users\\kurte\\Documents\\Arduino\\libraries\\Dynamixel2Arduino\\src\\utility\\slave.cpp" -o nul
Generating function prototypes...
"C:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\7-2017q4/bin/arm-none-eabi-g++" -c -w -Os -g3 -fno-use-cxa-atexit -fno-rtti -fno-exceptions -nostdlib -DF_CPU=48000000 -DARDUINO_UNOR4_MINIMA -std=gnu++17 -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fsigned-char -ffunction-sections -fdata-sections -fmessage-length=0 -fno-builtin -w -x c++ -E -CC -DARDUINO=10607 "-DPROJECT_NAME=\"C:\\Users\\kurte\\AppData\\Local\\Temp\\arduino\\sketches\\FD507D8329F1DFE2A4230DE8826AA014/scan_dynamixel.ino\"" -DARDUINO_MINIMA -DARDUINO_ARCH_RENESAS_UNO -DARDUINO_ARCH_RENESAS -DARDUINO_FSP -D_XOPEN_SOURCE -mthumb "@C:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\variants\\MINIMA/defines.txt" -DCFG_TUSB_MCU=OPT_MCU_RAXXX "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2/cores/arduino/tinyusb" "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\cores\\arduino/api/deprecated" "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\cores\\arduino/api/deprecated-avr-comp" "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\cores\\arduino" "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\variants\\MINIMA" "-Ic:\\Users\\kurte\\Documents\\Arduino\\libraries\\DynamixelShield\\src" "-Ic:\\Users\\kurte\\Documents\\Arduino\\libraries\\Dynamixel2Arduino\\src" "-iprefixC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2" "@C:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\variants\\MINIMA/includes.txt" "C:\\Users\\kurte\\AppData\\Local\\Temp\\arduino\\sketches\\FD507D8329F1DFE2A4230DE8826AA014\\sketch\\scan_dynamixel.ino.cpp" -o "C:\\Users\\kurte\\AppData\\Local\\Temp\\arduino\\sketches\\FD507D8329F1DFE2A4230DE8826AA014\\preproc\\sketch_merged.cpp"
"C:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\builtin\\tools\\ctags\\5.8-arduino11/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "C:\\Users\\kurte\\AppData\\Local\\Temp\\arduino\\sketches\\FD507D8329F1DFE2A4230DE8826AA014\\preproc\\sketch_merged.cpp"
Compiling sketch...
"C:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\7-2017q4/bin/arm-none-eabi-g++" -c -Wall -Wextra -Os -g3 -fno-use-cxa-atexit -fno-rtti -fno-exceptions -MMD -nostdlib -DF_CPU=48000000 -DARDUINO_UNOR4_MINIMA -MMD -std=gnu++17 -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fsigned-char -ffunction-sections -fdata-sections -fmessage-length=0 -fno-builtin -DARDUINO=10607 "-DPROJECT_NAME=\"C:\\Users\\kurte\\AppData\\Local\\Temp\\arduino\\sketches\\FD507D8329F1DFE2A4230DE8826AA014/scan_dynamixel.ino\"" -DARDUINO_MINIMA -DARDUINO_ARCH_RENESAS_UNO -DARDUINO_ARCH_RENESAS -DARDUINO_FSP -D_XOPEN_SOURCE -mthumb "@C:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\variants\\MINIMA/defines.txt" -DCFG_TUSB_MCU=OPT_MCU_RAXXX "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2/cores/arduino/tinyusb" "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\cores\\arduino/api/deprecated" "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\cores\\arduino/api/deprecated-avr-comp" "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\cores\\arduino" "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\variants\\MINIMA" "-Ic:\\Users\\kurte\\Documents\\Arduino\\libraries\\DynamixelShield\\src" "-Ic:\\Users\\kurte\\Documents\\Arduino\\libraries\\Dynamixel2Arduino\\src" "-iprefixC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2" "@C:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\variants\\MINIMA/includes.txt" "C:\\Users\\kurte\\AppData\\Local\\Temp\\arduino\\sketches\\FD507D8329F1DFE2A4230DE8826AA014\\sketch\\scan_dynamixel.ino.cpp" -o "C:\\Users\\kurte\\AppData\\Local\\Temp\\arduino\\sketches\\FD507D8329F1DFE2A4230DE8826AA014\\sketch\\scan_dynamixel.ino.cpp.o"
In file included from C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.0.2/variants/MINIMA/includes/ra_gen/common_data.h:13:0,
                 from C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.0.2\cores\arduino/Arduino.h:10,
                 from C:\Users\kurte\AppData\Local\Temp\arduino\sketches\FD507D8329F1DFE2A4230DE8826AA014\sketch\scan_dynamixel.ino.cpp:1:
C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.0.2/variants/MINIMA/includes/ra_cfg/fsp_cfg/bsp/bsp_pin_cfg.h:12:17: error: expected identifier before '(' token
 #define LED_RED (BSP_IO_PORT_00_PIN_11)
                 ^
c:\Users\kurte\Documents\Arduino\libraries\Dynamixel2Arduino\src/actuator.h:295:5: note: in expansion of macro 'LED_RED'
     LED_RED,
     ^~~~~~~
C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.0.2/variants/MINIMA/includes/ra_cfg/fsp_cfg/bsp/bsp_pin_cfg.h:12:17: error: expected '}' before '(' token
 #define LED_RED (BSP_IO_PORT_00_PIN_11)
                 ^
c:\Users\kurte\Documents\Arduino\libraries\Dynamixel2Arduino\src/actuator.h:295:5: note: in expansion of macro 'LED_RED'
     LED_RED,
     ^~~~~~~
In file included from c:\Users\kurte\Documents\Arduino\libraries\Dynamixel2Arduino\src/Dynamixel2Arduino.h:23:0,
                 from c:\Users\kurte\Documents\Arduino\libraries\DynamixelShield\src/DynamixelShield.h:21,
                 from C:\Users\kurte\AppData\Local\Temp\.arduinoIDE-unsaved2023623-14092-pk1fvc.t6vfa\scan_dynamixel\scan_dynamixel.ino:17:
c:\Users\kurte\Documents\Arduino\libraries\Dynamixel2Arduino\src/actuator.h:350:23: error: invalid conversion from 'int' to 'ControlTableItem::ControlTableItemIndex' [-fpermissive]
     LAST_DUMMY_ITEM = 0xFF
                       ^~~~
c:\Users\kurte\Documents\Arduino\libraries\Dynamixel2Arduino\src/actuator.h:351:3: error: expected ',' or ';' before '}' token
   };
   ^
c:\Users\kurte\Documents\Arduino\libraries\Dynamixel2Arduino\src/actuator.h:352:1: error: expected declaration before '}' token
 }
 ^

Using library DynamixelShield at version 0.2.6 in folder: C:\Users\kurte\Documents\Arduino\libraries\DynamixelShield 
Using library Dynamixel2Arduino at version 0.6.3 in folder: C:\Users\kurte\Documents\Arduino\libraries\Dynamixel2Arduino 
exit status 1

Compilation error: exit status 1

The issue, is with these defines:

C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.0.2\variants\MINIMA\includes\ra_cfg\fsp_cfg\bsp\bsp_pin_cfg.h:
   10  #define A1 (BSP_IO_PORT_00_PIN_01)
   11  #define A2 (BSP_IO_PORT_00_PIN_02)
   12: #define LED_RED (BSP_IO_PORT_00_PIN_11)
   13  #define TX_LED (BSP_IO_PORT_00_PIN_12)
   14  #define LED_BLUE (BSP_IO_PORT_00_PIN_13)

C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.0.2\variants\UNOWIFIR4\includes\ra_cfg\fsp_cfg\bsp\bsp_pin_cfg.h:
   10  #define A1 (BSP_IO_PORT_00_PIN_01)
   11  #define A2 (BSP_IO_PORT_00_PIN_02)
   12: #define LED_RED (BSP_IO_PORT_00_PIN_11)
   13  #define TX_LED (BSP_IO_PORT_00_PIN_12)
   14  #define LED_BLUE (BSP_IO_PORT_00_PIN_13)

2 matches across 2 files

Issue both with the LED_RED and with LED_BLUE.
These names are used in one of their header files, as part of an enum that is part of a name space.

Suggested Fix:
Remove these two defines from those two files. As far as I could tell, these defines were the only place in the cores project that defines or uses these two names.

Removing them allowed the sketch to build and run.

Upload broken for the Uno R4 WiFi on Windows 11 (Still Broken)

While uploading to the WiFi board I keep having issues with it returning errors about not finding com port and can not upload even though the Wifi Board is shown in the boards menu along with the com port:
Screenshot 2023-07-21 163518

It appears to be hit or miss on whether it works - mostly misses. Sometimes it will work if I replug the board in several times most not. Happens even with blink. Not sure it is related to the PR #10, #10. At time of this writing none of these things work and stuck.

Note: Must have loaded a few dozen times before this issue cropped up

System:

Edition	Windows 11 Home
Version	22H2
Installed on	‎7/‎8/‎2023
OS build	22621.1992
Experience	Windows Feature Experience Pack 1000.22644.1000.0

Arduino Version: 2.1.1 Released

Version: 2.1.1
Date: 2023-06-30T16:04:40.277Z
CLI Version: 0.32.3

happens with Minima as well but can usually recover the minima by hitting reset twice and then uploading.

EDIT: Also just went through this.

NUM_DIGITAL_PINS is wrong...

On Minima, NUM_DIGITAL_PINS is set to 22 even though the various translation arrays only contain 21 pins. (but see also #91 )
On UnoWiFiR4, NUM_DIGITAL_PINS is also set to 22, but the translation arrays contain 39 pins.

Bug in Wire timeout loop causes long delays in I2C read/write.

There is a bug these Wire.cpp member functions that causes delay(1) to be called for almost all transactions:

uint8_t TwoWire::read_from(uint8_t address, uint8_t* data, uint8_t length, unsigned int timeout_ms, bool sendStop)
uint8_t TwoWire::write_to(uint8_t address, uint8_t* data, uint8_t length, unsigned int timeout_ms, bool sendStop)

I tested with several I2C devices, a RTC and a OLED display.

Here are results of the RTC test with this program reading the time/date registers for a PCF8523 RTC.

I ran the program on a R4 WiFi.

#include "Wire.h"
// Read PCF8523 RTC registers
const uint8_t PCF8523I2cAdd = 0X68;  ///< I2C address.
const uint8_t PCF8523SecAdd = 0X03;  ///< Seconds register address.
void setup() {
  Serial.begin(9600);
  while (!Serial) {}
  digitalWrite(D13, LOW);
  pinMode(D13, OUTPUT);
  Wire.begin();
  Wire.setClock(400000L);
  Wire.beginTransmission(PCF8523I2cAdd);
  Wire.write(PCF8523SecAdd);
  digitalWrite(D13, HIGH);
  uint8_t rtn1 = Wire.endTransmission();
  digitalWrite(D13, LOW);
  digitalWrite(D13, HIGH);
  uint8_t rtn2 = Wire.requestFrom(PCF8523I2cAdd, 7);
  digitalWrite(D13, LOW);
  Serial.print("ss mm hh DD WD MM YY: ");
  for (uint8_t i = 0; i < 7; i++) {
    Serial.print(Wire.read(), HEX);
    Serial.print(i == 6 ? '\n' : ' ');
  }
  Serial.print("rtn1: ");
  Serial.print(rtn1);
  Serial.print(", rtn2: ");
  Serial.println(rtn2);
}
void loop() {}

Here is timing of Wire with the recent 400kHz fix. I use D13 HIGH on channel 2 to indicate time in Wire.

R4_wifi

Here is timing after I did a hack to remove the delay. This is not meant to be a fix for the bug.

R4_wifi_fix

Note that the time to to read the RTC was reduced from 2,146 μs to 259 μs.

Here are the two hacked timeout loops:

in read_from at about line 464 of Wire.cpp

    timeout_ms = 10000;   // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    while(timeout_ms > 0 && bus_status == WIRE_STATUS_UNSET) {
      timeout_ms--;
//      delay(1);  <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    }

In write_to at about line 493 of Wire.cpp

    timeout_ms = 10000;   //  <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    while(err == FSP_SUCCESS && timeout_ms > 0 && bus_status == WIRE_STATUS_UNSET) {
      timeout_ms--;
 //     delay(1);  <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    }

Edit: I tested on a R4 Minima and results are almost identical.

RTC.begin() crashes whole processor

This function is declared to have return value bool

bool RTClock::begin() {
if(openRtc()) {
is_initialized = true;
}
else {
is_initialized = false;
}
}

but there's not a single return keyword in that function. It ought to do return is_initialized; at the end.

This incorrect code causes some compilers (arm-none-eabi-gcc 10.3.1) to emit assembly that causes an infinite loop. Any sketch using RTC.begin(); deadlocks forever. Specifically, the assembly is

69eaa3dda954d333495272a5404b777435d6a9a7

(Notice how there is no pop {..., pc} to facilitate any returning in that function. After writing true, the code immediately writes false and jumps back to the beginingo of the code that writes false, thus being stuck forever at that line of C++ code). When I fix the code

eaed625b41282401253b94e15c48a04dd1e1fdcd

It does nicely return.

This code is undefined behavior which does happpen to work on the compiler version used in the Arduino IDE (7.0.1), however, the higher version one used in PlatformIO (10.3.1) breaks with it. (We upgraded it because, what could possible go wrong? Well, this). And of course, if this core ever decides to upgrade its compiler, this unfixed code is a ticking timebomb.

The strnlen() C Function Is Not Available

It appears that several C functions, e.g. strnlen() and strdup(), defined in the AVR based cores are not available within the Renesas core.

Both of the following statements work on an Arduino Uno WiFi Rev2 board but the second statement does not work on the new Arduino Uno R4 WiFi board.

Serial.print("strlen = ");  Serial.println(strlen(string));
Serial.print("strnlen = ");  Serial.println(strnlen(string, 10));  // error: 'strnlen' was not declared in this scope

I came across this issue by trying to compile a sketch that uses the PubSubClient library.

Please see The strnlen() C Function Is Not Available topic within the Arduino Forum for more information.

`micros()` sometimes returns incorrect value

Here is the problem - in this program bgn is often larger than end.

void setup() {
  Serial.begin(9600);
  while(!Serial) {}
  Serial.println("bgn, end, bgn - end");
  for (uint32_t i = 0; i < 10000; i++) {
    uint32_t bgn = micros();
    uint32_t end = micros();
    if (bgn > end) {
      Serial.print(bgn);
      Serial. print(',');
      Serial.print(end);
      Serial.print(',');
      Serial.println(bgn - end);
    }
  }
}
void loop() {
}

Here is the print out for the first few cases with bgn > end.

bgn, end, bgn - end
25992,25000,992
43992,43000,992
65993,65001,992
83994,83002,992

Wonder if the interrupt protection is correct. 1000 is a clue.

unsigned long micros() {
	// Convert time to us
	NVIC_DisableIRQ(main_timer.get_cfg()->cycle_end_irq);
 	uint32_t time_us = ((main_timer.get_period_raw() - main_timer.get_counter()) * 1000 / main_timer.get_period_raw()) +  (agt_time_ms * 1000); 
	NVIC_EnableIRQ(main_timer.get_cfg()->cycle_end_irq);
	return time_us;
}

Simple inclusion of <chrono> leads to compilation error

  • Minimal sketch to reproduce the error:
#include <chrono>

void setup() {

}

void loop() {

}
  • Compile the sketch via arduino-cli compile -b arduino:renesas_portenta:portenta_c33 -v ..
  • Error
/home/alex/.arduino15/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4/bin/arm-none-eabi-g++ -c -w -Os -g3 -fno-use-cxa-atexit -fno-rtti -fno-exceptions -nostdlib -DF_CPU=200000000 -std=gnu++17 -mcpu=cortex-m33 -mfloat-abi=hard -mfpu=fpv5-sp-d16 -fsigned-char -ffunction-sections -fdata-sections -fmessage-length=0 -fno-builtin -w -x c++ -E -CC -DARDUINO=10607 "-DPROJECT_NAME=\"/tmp/arduino/sketches/158652842019AB5611B5802F01A02A76/chrono.ino\"" -DARDUINO_PORTENTA_C33 -DARDUINO_ARCH_RENESAS -DARDUINO_ARCH_RENESAS -DARDUINO_FSP -D_XOPEN_SOURCE=700 -mthumb @/home/alex/Arduino/hardware/arduino-git/renesas/variants/PORTENTA_C33/defines.txt -DLWIP_DNS=1 -DCFG_TUSB_MCU=OPT_MCU_RAXXX -I/home/alex/Arduino/hardware/arduino-git/renesas/cores/arduino/tinyusb -I/home/alex/Arduino/hardware/arduino-git/renesas/cores/arduino/api/deprecated -I/home/alex/Arduino/hardware/arduino-git/renesas/cores/arduino/api/deprecated-avr-comp -I/home/alex/Arduino/hardware/arduino-git/renesas/cores/arduino -I/home/alex/Arduino/hardware/arduino-git/renesas/variants/PORTENTA_C33 -iprefix/home/alex/Arduino/hardware/arduino-git/renesas @/home/alex/Arduino/hardware/arduino-git/renesas/variants/PORTENTA_C33/includes.txt /tmp/arduino/sketches/158652842019AB5611B5802F01A02A76/sketch/chrono.ino.cpp -o /dev/null
Error while detecting libraries included by /tmp/arduino/sketches/158652842019AB5611B5802F01A02A76/sketch/chrono.ino.cpp
Generating function prototypes...
/home/alex/.arduino15/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4/bin/arm-none-eabi-g++ -c -w -Os -g3 -fno-use-cxa-atexit -fno-rtti -fno-exceptions -nostdlib -DF_CPU=200000000 -std=gnu++17 -mcpu=cortex-m33 -mfloat-abi=hard -mfpu=fpv5-sp-d16 -fsigned-char -ffunction-sections -fdata-sections -fmessage-length=0 -fno-builtin -w -x c++ -E -CC -DARDUINO=10607 "-DPROJECT_NAME=\"/tmp/arduino/sketches/158652842019AB5611B5802F01A02A76/chrono.ino\"" -DARDUINO_PORTENTA_C33 -DARDUINO_ARCH_RENESAS -DARDUINO_ARCH_RENESAS -DARDUINO_FSP -D_XOPEN_SOURCE=700 -mthumb @/home/alex/Arduino/hardware/arduino-git/renesas/variants/PORTENTA_C33/defines.txt -DLWIP_DNS=1 -DCFG_TUSB_MCU=OPT_MCU_RAXXX -I/home/alex/Arduino/hardware/arduino-git/renesas/cores/arduino/tinyusb -I/home/alex/Arduino/hardware/arduino-git/renesas/cores/arduino/api/deprecated -I/home/alex/Arduino/hardware/arduino-git/renesas/cores/arduino/api/deprecated-avr-comp -I/home/alex/Arduino/hardware/arduino-git/renesas/cores/arduino -I/home/alex/Arduino/hardware/arduino-git/renesas/variants/PORTENTA_C33 -iprefix/home/alex/Arduino/hardware/arduino-git/renesas @/home/alex/Arduino/hardware/arduino-git/renesas/variants/PORTENTA_C33/includes.txt /tmp/arduino/sketches/158652842019AB5611B5802F01A02A76/sketch/chrono.ino.cpp -o /tmp/arduino/sketches/158652842019AB5611B5802F01A02A76/preproc/sketch_merged.cpp
In file included from /tmp/chrono/chrono.ino:1:0:
/home/alex/.arduino15/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4/arm-none-eabi/include/c++/7.2.1/chrono:266:38: error: macro "abs" passed 2 arguments, but takes just 1
       abs(duration<_Rep, _Period> __d)

Workaround:

-#include <chrono>
+#undef abs
+#include <chrono>

Additional context

Additional reports

undefined reference to `BlockDevice::get_default_instance()' and other problems with flash examples

Hi, I'm trying the various examples for the flash features of the Uno R4 but a recursive compilation error is as follows:

undefined reference to `BlockDevice::get_default_instance()'

The problem is caused by the lack of the right tag for the architecture in the BlockDevice file.cpp :

by correcting and putting adding the right platform macro for example ARDUINO_UNOR4_MINIMA, the problem moves to compiling and defining parts of the QSPIFlashBlockDevice library.

Is this a known problem? I can't use the flash features of the board.

I use the last core 1.0.1 for Arduino Uno R4.

ArduinoBLE Support

Can't find support for ArduinoBLE library. Will it be supported on Arduino UNO R4 WiFi boards? ESP32-S3-MINI-1 has BLE&B5 in it.

Formatting with mbed reformat() fails

Formatting with mbed reformat() fails for SD Cards on the Portenta C33 (but works for USB thumb drives).

I'll be on vacation starting now, so ask the AE team if you need more information.

Core code should compile without warnings.

As I mentioned on the memory corruption issue, as a general practice, I don't want to see any compiler warnings, in my builds, even with the full or all warnings option turned on. Often times Warnings give you a hint on what might be wrong.

But your mind gets unsensitized to it, when you see them with every build. So you might miss ones that actually might help localize an issue.

With the current board release, I see warnings in at least two of the source files:

"C:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\7-2017q4/bin/arm-none-eabi-g++" -c -Wall -Wextra -Os -g3 -fno-use-cxa-atexit -fno-rtti -fno-exceptions -MMD -nostdlib -DF_CPU=48000000 -DNO_USB -DBACKTRACE_SUPPORT -DARDUINO_UNOR4_WIFI -MMD -std=gnu++17 -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fsigned-char -ffunction-sections -fdata-sections -fmessage-length=0 -fno-builtin -DARDUINO=10607 "-DPROJECT_NAME=\"C:\\Users\\kurte\\AppData\\Local\\Temp\\arduino\\sketches\\BD525D585FBF6679F28F92809D7A82B2/string_memory_corrupt.ino\"" -DARDUINO_UNOWIFIR4 -DARDUINO_ARCH_RENESAS_UNO -DARDUINO_ARCH_RENESAS -DARDUINO_FSP -D_XOPEN_SOURCE -mthumb "@C:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\variants\\UNOWIFIR4/defines.txt" -DCFG_TUSB_MCU=OPT_MCU_RAXXX "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2/cores/arduino/tinyusb" "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\cores\\arduino/api/deprecated" "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\cores\\arduino/api/deprecated-avr-comp" "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\cores\\arduino" "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\variants\\UNOWIFIR4" "-iprefixC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2" "@C:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\variants\\UNOWIFIR4/includes.txt" "C:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\cores\\arduino\\time.cpp" -o "C:\\Users\\kurte\\AppData\\Local\\Temp\\arduino\\sketches\\BD525D585FBF6679F28F92809D7A82B2\\core\\time.cpp.o"
C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.0.2\cores\arduino\cm_backtrace\cm_backtrace.c: In function 'cm_backtrace_init':
C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.0.2\cores\arduino\cm_backtrace\cm_backtrace.c:144:13: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
     fw_name = firmware_name;
             ^
C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.0.2\cores\arduino\cm_backtrace\cm_backtrace.c:145:12: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
     hw_ver = hardware_ver;
            ^
C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.0.2\cores\arduino\cm_backtrace\cm_backtrace.c:146:12: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
     sw_ver = software_ver;

And:

"C:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\7-2017q4/bin/arm-none-eabi-g++" -c -Wall -Wextra -Os -g3 -fno-use-cxa-atexit -fno-rtti -fno-exceptions -MMD -nostdlib -DF_CPU=48000000 -DNO_USB -DBACKTRACE_SUPPORT -DARDUINO_UNOR4_WIFI -MMD -std=gnu++17 -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -fsigned-char -ffunction-sections -fdata-sections -fmessage-length=0 -fno-builtin -DARDUINO=10607 "-DPROJECT_NAME=\"C:\\Users\\kurte\\AppData\\Local\\Temp\\arduino\\sketches\\BD525D585FBF6679F28F92809D7A82B2/string_memory_corrupt.ino\"" -DARDUINO_UNOWIFIR4 -DARDUINO_ARCH_RENESAS_UNO -DARDUINO_ARCH_RENESAS -DARDUINO_FSP -D_XOPEN_SOURCE -mthumb "@C:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\variants\\UNOWIFIR4/defines.txt" -DCFG_TUSB_MCU=OPT_MCU_RAXXX "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2/cores/arduino/tinyusb" "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\cores\\arduino/api/deprecated" "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\cores\\arduino/api/deprecated-avr-comp" "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\cores\\arduino" "-IC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\variants\\UNOWIFIR4" "-iprefixC:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2" "@C:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\variants\\UNOWIFIR4/includes.txt" "C:\\Users\\kurte\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\renesas_uno\\1.0.2\\cores\\arduino\\usb\\USB.cpp" -o "C:\\Users\\kurte\\AppData\\Local\\Temp\\arduino\\sketches\\BD525D585FBF6679F28F92809D7A82B2\\core\\usb\\USB.cpp.o"
C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.0.2\cores\arduino\IRQManager.cpp: In member function 'bool IRQManager::addPeripheral(Peripheral_t, void*)':
C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.0.2\cores\arduino\IRQManager.cpp:345:38: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if (irqcfg->first_irq_number != FSP_INVALID_VECTOR) {
C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.0.2\cores\arduino\IRQManager.cpp:408:38: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if (irqcfg->first_irq_number != FSP_INVALID_VECTOR) {
C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.0.2\cores\arduino\IRQManager.cpp: In member function 'void IRQManager::set_canfd_error_link_event(int, int)':
C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.0.2\cores\arduino\IRQManager.cpp:1662:49: warning: unused parameter 'li' [-Wunused-parameter]
 void IRQManager::set_canfd_error_link_event(int li, int ch)
                                                 ^~
C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.0.2\cores\arduino\IRQManager.cpp:1662:57: warning: unused parameter 'ch' [-Wunused-parameter]
 void IRQManager::set_canfd_error_link_event(int li, int ch)
                                                         ^~
C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.0.2\cores\arduino\IRQManager.cpp: In member function 'void IRQManager::set_canfd_rx_link_event(int, int)':
C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.0.2\cores\arduino\IRQManager.cpp:1677:46: warning: unused parameter 'li' [-Wunused-parameter]
 void IRQManager::set_canfd_rx_link_event(int li, int ch)
                                              ^~
C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.0.2\cores\arduino\IRQManager.cpp:1677:54: warning: unused parameter 'ch' [-Wunused-parameter]
 void IRQManager::set_canfd_rx_link_event(int li, int ch)
                                                      ^~
C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.0.2\cores\arduino\IRQManager.cpp: In member function 'void IRQManager::set_canfd_tx_link_event(int, int)':
C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.0.2\cores\arduino\IRQManager.cpp:1692:46: warning: unused parameter 'li' [-Wunused-parameter]
 void IRQManager::set_canfd_tx_link_event(int li, int ch)
                                              ^~
C:\Users\kurte\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.0.2\cores\arduino\IRQManager.cpp:1692:54: warning: unused parameter 'ch' [-Wunused-parameter]
 void IRQManager::set_canfd_tx_link_event(int li, int ch)
                                                      ^~

My quick look through I don't see anything obvious that is impacting the memory corruption bug, but...

[ArduinoEigen] Pin Definitions Conflict with Sketch/Library Variables when used with ArduinoCore-renesas

I posted this as well on the forum but may be better suited here: https://forum.arduino.cc/t/pin-definitions-conflict-with-sketch-library-variables/1147341

Many libraries (such as Eigen) and sketches may use variables such as A0-A5 and D0-D15 as variables versus pins definitions in pins_arduino.h:


#undef A0
#undef A1
#undef A2
#undef A3
#undef A4
#undef A5
static const uint8_t A0 = PIN_A0;
static const uint8_t A1 = PIN_A1;
static const uint8_t A2 = PIN_A2;
static const uint8_t A3 = PIN_A3;
static const uint8_t A4 = PIN_A4;
static const uint8_t A5 = PIN_A5;

// Digital pins
// -----------
#undef D0
#undef D1
#undef D2
#undef D3
#undef D4
#undef D5
#undef D6
#undef D7
#undef D8
#undef D9
#undef D10
#undef D11
#undef D12
#undef D13
#undef D14
#undef D15
#define D0  (0u)
#define D1  (1u)
#define D2  (2u)
#define D3  (3u)
#define D4  (4u)
#define D5  (5u)
#define D6  (6u)
#define D7  (7u)
#define D8  (8u)
#define D9  (9u)
#define D10 (10u)
#define D11 (11u)
#define D12 (12u)
#define D13 (13u)
#define D14 (14u)
#define D15 (15u)

So if you run a simple sketch:

void setup() {
  Serial.begin(115200);
  while(!Serial && millis() < 5000) {}
  int D0 = 1;
  Serial.println(D0);
  //digitalWrite(D0, HIGH);
}

void loop() {}

it will throw an error:

C:\Users\Merli\AppData\Local\Temp\.arduinoIDE-unsaved2023612-22120-liswj5.0ensn\sketch_jul12a\sketch_jul12a.ino: In function 'void setup()':
C:\Users\Merli\AppData\Local\Temp\.arduinoIDE-unsaved2023612-22120-liswj5.0ensn\sketch_jul12a\sketch_jul12a.ino:4:12: error: lvalue required as left operand of assignment
   int D0 = 1;
            ^
exit status 1
Compilation error: lvalue required as left operand of assignment

A more complex example would be using Eigen:
In file included from

C:\Users\Merli\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.0.2\cores\arduino/Arduino.h:125:0,
from C:\Users\Merli\AppData\Local\Temp\arduino\sketches\019E3DD99F1ECF6C34FCED459E6CC679\sketch\eigen_example.ino.cpp:1:
d:\Users\Merli\Documents\Arduino\libraries\eigen-main\src/Eigen/src/Core/products/GeneralBlockPanelKernel.h: In member function 'void Eigen::internal::lhs_process_one_packet<nr, LhsProgress, RhsProgress, LhsScalar, RhsScalar, ResScalar, AccPacket, LhsPacket, RhsPacket, ResPacket, GEBPTraits, LinearMapper, DataMapper>::operator()(const DataMapper&, const LhsScalar*, const RhsScalar*, ResScalar, Eigen::Index, Eigen::Index, Eigen::Index, Eigen::Index, Eigen::Index, Eigen::Index, int, Eigen::Index, Eigen::Index, Eigen::Index, Eigen::Index, Eigen::Index)':
C:\Users\Merli\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.0.2\variants\MINIMA/pins_arduino.h:56:16: error: lvalue required as unary '&' operand
#define D0 (0u)
^
d:\Users\Merli\Documents\Arduino\libraries\eigen-main\src/Eigen/src/Core/products/GeneralBlockPanelKernel.h:1270:73: note: in expansion of macro 'D0'
peeled_kc_onestep(1, blA, blB, traits, &A1, &rhs_panel, &T0, &D0, &D1, &D2, &D3);
^~
........
only one many errors. To correct this pins_arduino.h can be changed to (same way you did it for the analog pins):


// Digital pins
// -----------
#define PIN_D0   (0u)
#define PIN_D1   (1u)
#define PIN_D2   (2u)
#define PIN_D3   (3u)
#define PIN_D4   (4u)
#define PIN_D5   (5u)
#define PIN_D6   (6u)
#define PIN_D7   (7u)
#define PIN_D8   (8u)
#define PIN_D9   (9u)
#define PIN_D10   (10u)
#define PIN_D11   (11u)
#define PIN_D12   (12u)
#define PIN_D13   (13u)
#define PIN_D14   (14u)
#define PIN_D15   (15u)

#undef D0
#undef D1
#undef D2
#undef D3
#undef D4
#undef D5
#undef D6
#undef D7
#undef D8
#undef D9
#undef D10
#undef D11
#undef D12
#undef D13
#undef D14
#undef D15
static const uint8_t D0 = PIN_D0;
static const uint8_t D1 = PIN_D1;
static const uint8_t D2 = PIN_D2;
static const uint8_t D3 = PIN_D3;
static const uint8_t D4 = PIN_D4;
static const uint8_t D5 = PIN_D5;
static const uint8_t D6 = PIN_D6;
static const uint8_t D7 = PIN_D7;
static const uint8_t D8 = PIN_D8;
static const uint8_t D9 = PIN_D9;
static const uint8_t D10 = PIN_D10;
static const uint8_t D11 = PIN_D11;
static const uint8_t D12 = PIN_D12;
static const uint8_t D13 = PIN_D13;
static const uint8_t D14 = PIN_D14;
static const uint8_t D15 = PIN_D15;

this gets rid of the error messages in the same sketch and when using the Eigen Library for instance. I did test eigen with the recommended changes and it works.

EDIT: Would have to do for both the Wifi and Minima Version

SPI with the R4 is slower than with the R3

The SPI with the R4 is really slow, way slower than with the R3 when running the same clock and the same code.

SPI_Arduino_Uno.zip

This has three files for use with Saleae Logic 2.

SPI_Arduino_Uno_R3_SPI_Transfer.sal - single byte SPI.transfer()
SPI_Arduino_Uno_R4_SPI_Transfer.sal - single byte SPI.transfer()
SPI_Arduino_Uno_R4_SPI_Transfer_Buffer.sal - buffer transmit, for 4 bytes and for the whole large buffer

The "large" transfer has 3 bytes address + 228 bytes data.
R3: 524µs including all calculations necessary for that data
R4: 2.52ms including all calculations necessary for that data - so this takes almost five times longer
R4 buffer: 634µs without any calculations, only transferring the buffer

Is this something that is actively looked into so far?

The underlying FSP library from Renesas is rather slow.
It configures the SPI on every single transfer, even going as far as activating and deactivating the SPI thru the enable bit.

On the R3 I get <2µs pauses between two transfers.
On the R4 there are 11µs between two transfers - at three times the core clock.

I modified SPI.cpp to use a busy loop for with TX only for the buffer transfer:

uint8_t *buffer = (uint8_t *) buf;

_spi_ctrl.p_regs->SPCR = 0x4a; /* enable, no irq, master, tx only */

for(size_t index = 0; index < count; index++)
{
    _spi_ctrl.p_regs->SPDR_BY = buffer[index];
    while (0 == _spi_ctrl.p_regs->SPSR_b.SPTEF) {}
}
    while (_spi_ctrl.p_regs->SPSR_b.IDLNF) {}

_spi_ctrl.p_regs->SPCR = 0xb9; /* off, interrupts, master, full duplex */

This brought down the time to transfer the buffer to 310us with 400ns pauses.
Still not what the RA4M1 could do but at least it beats the AVR on the R3.
So this is entirely an software issue.

A couple of function calls into R_SPI_WriteRead() to check out what is going on there I found that
the buffer is send with an interrupt function.
So essentially it looks like the function is spending more time going into and out of that interrupt than it takes to transfer a byte.

And on top the RA4M1 has DMA, please make use of it.
Preferably take inspiration from the Teensy 4 SPI class that has DMA support baked in to allow this:
SPI.transfer(source, dest, count, event);
SPI.transfer( ((uint8_t *) &EVE_dma_buffer[0]) + 1U, NULL, (((EVE_dma_buffer_index) * 4U) - 1U), EVE_spi_event);

This "event" is for a callback function, a custom one that can be attached to the event and allows code to be executed when the DMA is done like setting CS to high again.
And setting "dest" to NULL makes the operation write only.

Calls to digitalWrite() don't work after a previous analogWrite()

Once you've generated PWM on a pin with analogWrite(), a subsequent digitalWrite() doesn't work.

Here is a sequence of calls and the resulting voltage on the pin (on core 0.8.7), compared to the same sequence on an original Arduino Uno R3:

Command Arduino R4 Arduino R3
pinMode(3, OUTPUT) 0V 0V
digitalWrite(3, HIGH) 4.7V 5V
analogWrite(3, 200) 3.68V 3.9V
digitalWrite(3, LOW) 3.68V 0V
digitalWrite(3, HIGH) 3.68V 5V

The R3 behaviour is what I'd expect.

Here's a visual demonstration of the problem. This program first blinks the builtin LED, and then pulsates it smoothly on and off:

void blink () {
  for (int i=0; i<5; i++) {
    digitalWrite(13, HIGH); delay(1000);
    digitalWrite(13, LOW); delay(1000);
  }
}

void pulse () {
  for (int i=0; i<5; i++) {
    for (int x=0; x<=255; x++) { analogWrite(13, x); delay(5); }
    for (int x=255; x>=0; x--) { analogWrite(13, x); delay(5); }
  }
}

void setup() {
  pinMode(13, OUTPUT);
}

void loop() {
  blink();
  delay(1000);
  pulse();
  delay(1000);
}

The call to blink() only works the first time around loop().

The same problem occurs on the Uno R4 WiFi.

Note: Originally posted on the Early Access Program forum, but still an issue.

fails uploading on linux with `Failed uploading: uploading error: exit status 74`

I just received my Arduino UNO R4 Minima, and uploading to it fails. I am on Fedora Linux (38, updated) and have the Arduino IDE 2.1.0 installed from Flatpak. I have the current release of the board definition (1.0.1 at the time of writing) installed.

I am trying to upload the standard blink example to it. It compiles fine, but uploading gives this result:

dfu-util: Cannot open DFU device 2341:0069 found on devnum 76 (LIBUSB_ERROR_ACCESS)
dfu-util: No DFU capable USB device available
Failed uploading: uploading error: exit status 74

My user usually has no problems uploading to any board or connecting via Serial. I am in the dialup group. I did not set any particular udev-rules, though. If that's something that is expected of me, I would value a hint.

Memory corruption in simple sketch

Reported at https://forum.arduino.cc/t/why-does-the-compiler-add-4x-00-to-a-string-array-element/1152890

UNO R4 Wifi, version 1.0.2 of this core.

String patternNames[] = {
    "@@@@@",
    "Light-weight spaceship",
    "R-Pentomino",
    "Diehard",
    ""
  };

void setup() {
  Serial.begin(9600);
  delay(1000);

  Serial.println("Looking at the first characters of the first element i the String-Arrazy");
  Serial.println(String(patternNames[0].charAt(0), HEX));
  Serial.println(String(patternNames[0].charAt(1), HEX));
  Serial.println(String(patternNames[0].charAt(2), HEX));
  Serial.println(String(patternNames[0].charAt(3), HEX));
  Serial.println(String(patternNames[0].charAt(4), HEX));

  Serial.end();
}
void loop() {}

Output:

Looking at the first five characters of the first element in the String-Array
0
0
0
0
40

Should be 5× 40.
Removing the last empty string from the array causes the right characters to be printed.

I've done some reverse engineering of the binary already (https://forum.arduino.cc/t/why-does-the-compiler-add-4x-00-to-a-string-array-element/1152890/44), but could not find anything, so I suspect memory corruption by some Core function (probably a 32-bit write to the beginning of the heap, presumably somewhere in a global constructor, initVariant, analogReference or startAgt).
Ideally, someone with access to an UNO R4 and a hardware debugger would debug it with the necessary watchpoints to see what causes the memory to be overwritten.

R4 Minima: "extra" pins inaccessible.

The board to chip pin translations for the RX and TX LEDs, and the RX/TX signals available on the SWD connector are not present in the Minima variants.cpp or pins_arduino.h, making those essentially inaccessible to "proper" arduino sketches.

Wire clock is slow for some 3.3V devices.

The RA4M1 I2C controller runs slower than the selected clock rate for some 3.3V devices. These devices run at the full rate on Uno R3.

I have had no problems with 5V devices. All 5V devices I have tried run at 400kHz.

I looked for any issues for RA4M1 on the Renesas site. It seems the controller is very fussy for 3.3V devices. Devices fail if powered by slightly less than 3.3V and Renesas states:

For the functioning of IIC Slave on all the boards except for EK-RA6M3/EK-RA6M3G,FPB-RA6E1,external pull up resistors of value 3.9 or 4.7k ohms are required to be connected on I2C(SDA/SCL) lines.

Here is an example with a SSD1306 128 x 64 OLED display which has 4.7 K pullups to 3.3V.

On a R4 Minima I get 329kHz for 400kHz requested clock. I get 95kHz for 100 kHz requested clock.

I added an analog trace for SCL.

R4_3V

For the same program and device on Uno R3 I get exactly 400 kHz.:

R3_3V

Any Ideas what is causing 3.3V devices to run a bit slower on R4?

I have not tried more than one I2C device at a time on R4.

Edit: Are internal pullups enabled on R4?

Upload broken for the Uno R4 WiFi on Windows

Hello,

I'm having an issue with uploading to the Uno R4 WiFi in a Windows environment.

This all uses ArduinoCore-renesas v1.0.1. When in the Arduino IDE, the device is recognized. It's only when uploading to it that it fails to find the device.

image

When looking at the device manager, I get the following values: USB VID 2341 PID 1002
image

Below is a table of the environments/configurations I tried and the various error codes I received.

Platform IDE Sketch Success Error Code
Mac 2.1.0 Blink Y N/A
Mac 2.1.0 GameOfLife Y N/A
Ubuntu 2.1.0 Blink Y N/A
Ubuntu 2.1.0 GameOfLife Y N/A
Windows 10 2.1.0 Blink N Performing 1200-bps touch reset on serial port COM22
"C:\Users\$USER\AppData\Local\Arduino15\packages\arduino\tools\bossac\1.9.1-arduino5/bossac" -d --port=COM22 -U -e -w "C:\Users\$USER\AppData\Local\Temp\arduino\sketches\FE8CA22D18608F6CBD5B3FFBE2AB9B4C/Blink.ino.bin" -R
No device found on COM22
Set binary mode
Send auto-baud
Set binary mode
Failed uploading: uploading error: exit status 1
Windows 10 2.1.0 GameOfLife N Performing 1200-bps touch reset on serial port COM22
"C:\Users\$USER\AppData\Local\Arduino15\packages\arduino\tools\bossac\1.9.1-arduino5/bossac" -d --port=COM22 -U -e -w "C:\Users\$USER\AppData\Local\Temp\arduino\sketches\63B0DA378C2FD7222A66F165BF61AF79/GameOfLife.ino.bin" -R
Set binary mode
Send auto-baud
Set binary mode
No device found on COM22
Failed uploading: uploading error: exit status 1
Windows 10 Arduino-cli Blink N Performing 1200-bps touch reset on serial port COM22
"C:\Users\$USER\AppData\Local\Arduino15\packages\arduino\tools\bossac\1.9.1-arduino5/bossac" -d --port=COM22 -U -e -w "C:\msys64\tmp\arduino\sketches\FE8CA22D18608F6CBD5B3FFBE2AB9B4C/Blink.ino.bin" -R
Set binary mode
Send auto-baud
Set binary mode
No device found on COM22
Error during Upload: Failed uploading: uploading error: exit status 1
Windows 10 VSCode Arduino Blink N [Starting] Uploading sketch '........\Arduino\Blink\Blink.ino'
[Warning] Output path is not specified. Unable to reuse previously compiled files. Build will be slower. See README.
Sketch uses 34828 bytes (13%) of program storage space. Maximum is 262144 bytes.
Global variables use 2460 bytes (7%) of dynamic memory, leaving 30308 bytes for local variables. Maximum is 32768 bytes.
No device found on COM22
Error during Upload: Failed uploading: uploading error: exit status 1
IntelliSense configuration already up to date. To manually rebuild your IntelliSense configuration run "Ctrl+Alt+I"
[Error] Uploading sketch '........\Arduino\Blink\Blink.ino': Exit with code=1

When I was reading through the R4 Datasheet I see that the R4 is programmed via the ESP32-S3. There's a jumper I could solder to move the USB directly to the Renesas chip, but that seems like the wrong way to go about trying to program the device based on it's intended use.

I followed this help article for the specific error, however the process explorer was unable to find a PID with the process in use.

I've been able to upload to the Minima using v1.0.1 in a Windows environment.

I tried on 3 Windows machines, 2 Win10, 1 Win11.

As a last ditch effort, I uninstalled Arduino, uninstalled the drivers, unplugged the device, rebooted the machine, reinstalled Arduino, installed the package, then plugged the device back in. This did not change anything.

Please let me know if there's something else I should be trying.

LED_Matrix: possible race condition.

The turnLed method, uses the R_PORT0->PCNTR1 register, to switch 5 IO Pins that are on PORT0 to input. It does this by using a read modify save.

There is a timing window after the read, that a higher priority interrupt (lower value) might happen that changes this state in some of the other IO pins on port 0, like lets say pin 15

If that happens, when that ISR returns to this one, and this one stores out the new values, it will wipe out the changes made by the higher priority interrupt handler. Probably won't happen often, but I have run into issues like this in the past, that can be a pain to find and fix.

#define LED_MATRIX_PORT0_MASK       ((1 << 3) | (1 << 4) | (1 << 11) | (1 << 12) | (1 << 13) | (1 << 15))
#define LED_MATRIX_PORT2_MASK       ((1 << 4) | (1 << 5) | (1 << 6) | (1 << 12) | (1 << 13))

static void turnLed(int idx, bool on) {
  R_PORT0->PCNTR1 &= ~((uint32_t) LED_MATRIX_PORT0_MASK);
  R_PORT2->PCNTR1 &= ~((uint32_t) LED_MATRIX_PORT2_MASK);

Serial.print() - from Interrupt callbacks hangs the processor.

With the current release (actually current code as well) as has been mentioned on a few threads now including:
https://forum.arduino.cc/t/serial-print-from-isr-will-hang/1145292

If you run a sketch like the unmodified example RTC->Test_RTC
The program will completely hang when it tries to do any Serial.print() statements... Actually would be true as well for Serial1.print()...

I am guessing that the current UART class code has not really been completed but just enough to be able to use the new board.
For example I am assuming that at some point there will be a TX software queue and the like.

But a quick and dirty fix would be to change the Interrupt priority for the UART to a high enough priority such that the NVIC code would allow it to be called from for example a timer interrupt callback.

On my machine I changed cores\arduino\IRQManager.cpp: line 14:
#define UART_SCI_PRIORITY 6 //12
Which allows it to preempt most IRQs except maybe SPI Master.

But again I do not believe this should be the long term fix, but may be sufficient for the short term

Edit: Note I have the Uno R4 Wifi

After reset pin 13 is configured as an output

On the Uno R4 Minima and Uno R4 WiFi, pin 13 is made an output after reset, so if you do:

void setup() {
  Serial.begin(9600);
  delay(5000);
}

void loop () {
  Serial.println(digitalRead(13));
  delay(1000);
}

and apply 5V to the pin (via a resistor for safety), you still get 0.

The usual Arduino convention is that all digital pins are inputs after reset, and to make a pin an output you have to call pinMode(13, OUTPUT), for example. As far as I know no other Arduino board does this.

The way it is currently working is undesirable, because you might have pin 13 connected to a voltage input; an accidental reset could then cause excessive dissipation in the output driver.

Note: Originally posted on the Early Access Program forum, but still an issue.

Performance of SafeRingBufferN - (Used in the UART class)

Note: earlier today I documented more of this up on the forum thread:
https://forum.arduino.cc/t/performance-of-saferingbuffern/1152977

The WIP code is up at: https://github.com/KurtE/ArduinoCore-renesas/tree/SerialX_use_write_fifo

I am experimenting with implementing the use of the RingBuffer in the Serial Transmit code, and noticed that my first cut of the code was spending a lot more time in the write method than I was expecting. There are things I can do to speed this up, like in this actual case bypass using the Ring buffer.

The beginning part of the write code:

Size_t  UART::write(const uint8_t* c, size_t len) {
  if(init_ok && (len > 0)) {
    DBGDigitalWrite(A5, HIGH);
    size_t cb_left = len;

    while (cb_left) {
      // see if we have room in the FIFO to store this character.
      bool tx_active_on_entry = tx_fsi_active;

      // Put as much of data into txBuffer as will fit
      while(cb_left && !txBuffer.isFull()) {
        txBuffer.store_char(*c++);
        cb_left--;
      }

      // if the UART was not active at the start we will start it.
      if (!tx_active_on_entry) {
        size_t cb = 0;
        while (cb < sizeof(tx_fsi_buffer)) {
          int ch = txBuffer.read_char();
          if (ch == -1) break;
          tx_fsi_buffer[cb++] = ch;            
        }
        tx_fsi_active = true;
        DBGDigitalToggle(A2);
        R_SCI_UART_Write(&(uart_ctrl), tx_fsi_buffer, cb);
,,,

In the case below I could detect that the queue is empty and transmit is not active and transfer directly to a temporary buffer that I pass off to R_SCI_UART_Write,

But in my first test case I was trying, which is to control Robotis servos at 1mbs half duplex. I see the timings of sending a logical packet
image
Channel 6 shows the time while we are in the write method. Channel 7 I do a toggle of the pin when I actually call out to the R_SCI_UART_Write.

It is taking about 50us in the write method when using the SafeRingBuffer. I did a quck and dirty check to see how long it would take if I used the RingBufferN instead, and the time was cut to about 17us.

I was hoping that the straight RingBufferN would be safe enough to use for the typical case of a single producer of data, and a single consumer of it. But I don't believe your implementation of this class is safe enough.

As the two methods store_char and read_char both modify a common member variable _numElems.

void RingBufferN<N>::store_char( uint8_t c )
{
  // if we should be storing the received character into the location
  // just before the tail (meaning that the head would advance to the
  // current location of the tail), we're about to overflow the buffer
  // and so we don't write the character or advance the head.
  if (!isFull())
  {
    _aucBuffer[_iHead] = c ;
    _iHead = nextIndex(_iHead);
    _numElems++;
  }
}

template <int N>
int RingBufferN<N>::read_char()
{
  if (isEmpty())
    return -1;

  uint8_t value = _aucBuffer[_iTail];
  _iTail = nextIndex(_iTail);
  _numElems--;

  return value;
}

In other implementations of like code, the store_char would only modify the _iHead member variable and the read_char would only modify the _iTail member.

When you need information like Available, you can easily compute it, something like:

template <int N>
int RingBufferN<N>::available()
{
  uint32_t head = _iHead;
  uint32_t tail = _iTail;
  if (head >= tail) return (head - tail);
  return = N + head - tail;
}

typed on fly...

There are more details up on the forum thread including the example sketch I was running. And more details on my attempt to describe the code base to another forum member.

EDIT: I am not sure if it was clear above, but the differences between the SafeRingBufferN and the simple RingBufferNm is the methods like store_char use the Synchronized code like:

template <int N>
void SafeRingBufferN<N>::store_char(uint8_t c) {
  synchronized {
    RingBufferN<N>::store_char(c);
  }
}

use the synchronized loop around code, which creates an __Guard object on entry, who disables all interrupt on creation, and restores the global interrupt enable state on exit (i.e., when the code leaves the scope).

Thoughts?

UNO R4: Add support for CAN Standard Frame Format (in addition to EFF)

Please add in the UNO R4 CAN library the support for transmit/receive of CAN frames also in SFF.

Preferred would be an own parameter in the message creation which allows to define either SFF (maybe the default) or EFF.

Adding a hint towards the current CAN tutorials would be helpful, because it's not directly obvious to be forced/limited to EFF.

CAN 2.0A defines SFF.
CAN 2.0B defines EFF.
Most of the available MCP2515 libs are supporting SFF and EFF.
CAN on Arduino Due by "due_can" lib supports SFF and EFF.
In the automotive area SFF for communication is very common.

Stanrdard CAN IDs not supported

I use Arduinos in an industrial context to communicate with and get info from our large scale machinery.

Up until now I used the SEED Studio Can shield, but have an issue with the size. I was quite irritated when I tried the Minima and Wifi boards, and only extended IDs are supported. Our CAN IDs are "standard" 11 Bit. My programming doesn't go as far as implementing that with a PR, please please (urgently) amend your library with support for standard IDs. I wasn't expecing such a limitation and already designed all my housings around a single uno sized board without a shield, and am now more or less standing in a "rue de la gack" with this situation.

image

Is license MIT?

Hello,

Yesterday, the LICENSE file was added. It is the MIT license. Is it right?

Best regards,
NoMaY

USB Serial - differences between WIFI and MINIMA

There API differences between the Serial objects on the WIFI and MINIMA.

Sorry, it is unclear to me if this should be an issue here, as code compiles on one and not the other. Or should be a discussion on the forum.

The following sketch, which is a slightly modified version of the USBToSerial Teensy example sketch, builds and runs fine on MINIMA, but compiler errors with WIFI. Note: code will not properly on current released code as availableForWrite() was not implemented and uses the default implementation which returns 0.

/* USB to Serial - Teensy becomes a USB to Serial converter
   http://dorkbotpdx.org/blog/paul/teensy_as_benito_at_57600_baud

   You must select Serial from the "Tools > USB Type" menu

   This example code is in the public domain.
*/

// set this to the hardware serial port you wish to use
#if defined(ARDUINO_UNOR4_WIFI)

UART _UART4_(18, 19);
#define SerialX Serial3
#else
UART _UART2_(18, 19);
#define SerialX Serial2
#endif


#define HWSERIAL Serial1

unsigned long baud = 115200;
const int reset_pin = 4;

void setup()
{
  pinMode(LED_BUILTIN, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(6, OUTPUT);
  pinMode(7, OUTPUT);
  pinMode(8, OUTPUT);
  digitalWrite(LED_BUILTIN, LOW);
  digitalWrite(reset_pin, HIGH);
  pinMode(reset_pin, OUTPUT);
  Serial.begin(baud);	// USB, communication to PC or Mac
  HWSERIAL.begin(baud);	// communication to hardware serial
  
}

long led_on_time=0;
byte buffer[80];
unsigned char prev_dtr = 0;

void loop()
{
  unsigned char dtr;
  int rd, wr, n;

  // check if any data has arrived on the USB virtual serial port
  rd = Serial.available();
  if (rd > 0) {
    // check if the hardware serial port is ready to transmit
    wr = HWSERIAL.availableForWrite();
    if (wr > 0) {
      // compute how much data to move, the smallest
      // of rd, wr and the buffer size
      if (rd > wr) rd = wr;
      if (rd > 80) rd = 80;
      // read data from the USB port
      n = Serial.readBytes((char *)buffer, rd);
      // write it to the hardware serial port
      HWSERIAL.write(buffer, n);
      // turn on the LED to indicate activity
      digitalWrite(LED_BUILTIN, HIGH);
      led_on_time = millis();
    }
  }

  // check if any data has arrived on the hardware serial port
  rd = HWSERIAL.available();
  if (rd > 0) {
    // check if the USB virtual serial port is ready to transmit
    wr = Serial.availableForWrite();
    if (wr > 0) {
      // compute how much data to move, the smallest
      // of rd, wr and the buffer size
      if (rd > wr) rd = wr;
      if (rd > 80) rd = 80;
      // read data from the hardware serial port
      n = HWSERIAL.readBytes((char *)buffer, rd);
      // write it to the USB port
      Serial.write(buffer, n);
      // turn on the LED to indicate activity
      digitalWrite(LED_BUILTIN, HIGH);
      led_on_time = millis();
    }
  }

  // check if the USB virtual serial port has raised DTR
  dtr = Serial.dtr();
  if (dtr && !prev_dtr) {
    digitalWrite(reset_pin, LOW);
    delayMicroseconds(250);
    digitalWrite(reset_pin, HIGH);
  }
  prev_dtr = dtr;

  // if the LED has been left on without more activity, turn it off
  if (millis() - led_on_time > 3) {
    digitalWrite(LED_BUILTIN, LOW);
  }

  // check if the USB virtual serial wants a new baud rate
  if (Serial.baud() != baud) {
    baud = Serial.baud();
    if (baud == 57600) {
      // This ugly hack is necessary for talking
      // to the arduino bootloader, which actually
      // communicates at 58824 baud (+2.1% error).
      // Teensyduino will configure the UART for
      // the closest baud rate, which is 57143
      // baud (-0.8% error).  Serial communication
      // can tolerate about 2.5% error, so the
      // combined error is too large.  Simply
      // setting the baud rate to the same as
      // arduino's actual baud rate works.
      HWSERIAL.begin(58824);
    } else {
      HWSERIAL.begin(baud);
    }
  }
}

The difference to the actual example is I added a bunch of pinMode statements to enable some debugging of my updated code base and I setup to allow optional Serial object using the SCL/SDA pins.

Compiler errors on the WIFI board:

C:\Users\kurte\Documents\Arduino\R4-Uno-wifi\USBtoSerial_r4\USBtoSerial_r4.ino: In function 'void loop()':
C:\Users\kurte\Documents\Arduino\R4-Uno-wifi\USBtoSerial_r4\USBtoSerial_r4.ino:92:16: error: 'class UART' has no member named 'dtr'
   dtr = Serial.dtr();
                ^~~
C:\Users\kurte\Documents\Arduino\R4-Uno-wifi\USBtoSerial_r4\USBtoSerial_r4.ino:106:14: error: 'class UART' has no member named 'baud'
   if (Serial.baud() != baud) {
              ^~~~
C:\Users\kurte\Documents\Arduino\R4-Uno-wifi\USBtoSerial_r4\USBtoSerial_r4.ino:107:19: error: 'class UART' has no member named 'baud'
     baud = Serial.baud();
                   ^~~~

exit status 1

Compilation error: 'class UART' has no member named 'dtr'

Notes/Questions - things to try.

MINIMA:

  1. Does the MINIMA code pickup baud rate changes, with the baud() method? I have not tried to see yet.
  2. Does it reflect it back to the host?
  3. Does the Serial monitor care what the baud rate is set to? As it sends and receives at USB speed

WIFI:

  1. baud(). Could either make Serial object, as a sub-class of the UART code, or could add baud() to the UART code, or could punt.

  2. How are the communications between ESP32 and hardware UART impacted by what BAUD rate chosen? Does it change the speed between the two processors, I pretty sure YES. but could instead choose to use some fixed speed.

  3. And if I do Serial.begin(new_baud_rate) is that communicated back to ESP32? And then back to the host?

ScanNetworks WiFiS3.h not found WiFi

Examples for Arduino UNO R4 Wifi
WiFiS3 -> ScanNetworks.ino

Scanning available networks...
** Scan Networks **
number of available networks:0
Your MAC Address is: 00:00:00:00:00:00

Is this a Software or Hardware Problem?

Lazy stacking of float context not enabled, slowing down all exception processing.

Lazy stacking of floating point context is enabled by the LSPACT bit in the FPU->FPCCR register;
It causes the floating point registers to be stacked during an exception ONLY if a floating point instruction is used during the exception.
Since most except code does not use floats, saving the floating point context slows things down pretty significantly, for no reason.

Here's a sketch showing the issue:

char spbuffer[100];

void setup() {
  Serial.begin(9600);
  while (!Serial)
    ;

  sprintf(spbuffer, "FPU (Float Processing Unit info @%08lx)\n", (uint32_t)FPU);
  Serial.print(spbuffer);

  sprintf(spbuffer, "  %6s@%08lx=0x%08lx%s\n", "FPCCR", (uint32_t)&FPU->FPCCR,
          FPU->FPCCR, " FP Context Control Register");
  Serial.print(spbuffer);
  if (FPU->FPCCR & FPU_FPCCR_LSPACT_Msk) {
    Serial.print("    (Lazy State Preservation is ON)\n");
  } else {
    Serial.print("    (Lazy State Preservation is OFF)\n");
  }
}

void loop() {}

PINS_COUNT doesn't work

In the variants, there is:

#define PINS_COUNT           (PINCOUNT_fn())

but PINCOUNT_fn() does not seem to be defined anywhere.
(for SAMD, PINCOUNT_fn() is defined based on`sizeof(g_aPinDescription), but Renesas pin mapping is done differently.)

SCL is incorrectly defined in variants (pins_arduino.h)

The pins_arduino.h header files in MIMINA and UNOWIFIR4 directories are incorrectly defining the SCL symbol.
They are defining the SCL pin to be same as the SDA pin.
To fix this the pins_arduino.h header files for both/all variants
will need to change this:

static const uint8_t SDA = WIRE_SDA_PIN;
static const uint8_t SCL = WIRE_SDA_PIN;

to this

static const uint8_t SDA = WIRE_SDA_PIN;
static const uint8_t SCL = WIRE_SCL_PIN;

compatibility - Consider shipping an empty wiring_private.h

There are several libraries out there, like most of the Adafruit display libraries for whatever reason include this file.
Obviously, the library owners can add some additional #if type statements to avoid this in this case, but you probably will get forum threads for a lot of these libraries, like Adafruit_ILI9341, that can easily be solved by simply putting in a blank file. Or maybe one with a #warning

Just a thought.

There may be other such files that should be considered as well.

Sources for Uno R4 Minima/WiFi bootloaders (SANTIAGO)

Sadly the referred Git repository at

  1. Sources for Uno R4 WIFi at [email protected]:bcmi-labs/tinyusb.git , commit 185ae31ff15a1013a5a890455220a29bad1ed209
  2. Sources for Uno R4 Minima at [email protected]:bcmi-labs/tinyusb.git , commit b80fa8f4027c5aa4d9af5720a82e9238d8f792bb

is not accessible.

Where (or how) can I clone the source code?

[Feature Request] UNO R4: Support for CAN TXD/RXD pin remapping

Please provide an alternative method for remapping the TXD/RXD pins during initialization of the CAN interface (different from defaults) if this is possible by hardware.

Use case: By adding e.g. the Arduino Ethernet Shield Rev2, its SD-card reader SPI chip select would collide with CAN TXD/RXD without being able to assign different pins. This would as example allow a usage as CAN<->ETH gateway.

Upload to UNO R4 WiFi fails when "1200 bps touch" causes port change

Describe the problem

The upload operation for the UNO R4 WiFi follows this sequence:

  1. Perform a "1200 bps touch" to put the board into the mode where it can be flashed.
  2. Invoke the bossac command that flashes the binary to the board.

It is common for the address of the board port to change after the "1200 bps touch" step and so the Arduino development tools have a system for detecting the post-touch address and using that address when the upload command is generated from the "pattern" defined for the board in platform.txt. That system involves a post-touch wait to watch for the new port to appear before eventually timing out and resorting to the fallback behavior of using the original address to the upload pattern if no address change was detected. Since some boards will never produce a post-touch address change (meaning the post-touch wait step would only cause an unnecessary delay in the upload operation) it is possible to configure the board to skip the wait step by setting the upload.wait_for_upload_port property to false in the board definition.

The assumption was made that the address of the UNO R4 WiFi board's port will never experience a post-touch address change, so its upload.wait_for_upload_port property is set to false. However, the address can change under certain conditions and this causes the bossac command invocation to fail with a "No device found on ..." error because the original port address is used in the generated command instead of the post-touch address.

To reproduce

Arduino IDE

  1. Create a sketch with the following code:
    #include <HID.h>
    void setup() {}
    void loop() {}
  2. Select the appropriate board and port for the UNO R4 WiFi from the Arduino IDE menus.
  3. Select Sketch > Upload from the Arduino IDE menus.
  4. Wait for the upload to complete successfully.
    the upload should be successful as long as the board isn't already running a problematic sketch.
  5. Select Sketch > Upload from the Arduino IDE menus.

🐛 The upload fails:

Performing 1200-bps touch reset on serial port COM12
No device found on COM12
"C:\Users\per\AppData\Local\Arduino15\packages\arduino\tools\bossac\1.9.1-arduino5/bossac" -d --port=COM12 -U -e -w "C:\Users\per\AppData\Local\Temp\arduino\sketches\6CF073A8170159518E82E009B3D511D0/sketch_jul27a.ino.bin" -R
Failed uploading: uploading error: exit status 1

Arduino CLI

Setup
$ arduino-cli version

arduino-cli.exe  Version: git-snapshot Commit: f66becdf Date: 2023-07-23T20:34:26Z

$ mkdir /tmp/HIDSketch

$ printf "#include <HID.h>\nvoid setup() {}\nvoid loop() {}\n" > "/tmp/HIDSketch/HIDSketch.ino"

$ arduino-cli compile --fqbn arduino:renesas_uno:unor4wifi /tmp/HIDSketch

[...]

Used library Version Path
HID                  C:\Users\per\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.0.2\libraries\HID

Used platform       Version Path
arduino:renesas_uno 1.0.2   C:\Users\per\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.0.2

$ arduino-cli board list

Port  Protocol Type              Board Name                FQBN                          Core
COM42 serial   Serial Port (USB) Arduino UNO R4 WiFi       arduino:renesas_uno:unor4wifi arduino:renesas_uno

$ arduino-cli upload --fqbn arduino:renesas_uno:unor4wifi --port COM42 --verbose /tmp/HIDSketch  # Upload of the sketch is successful as long as the board is not already running a problematic sketch

Performing 1200-bps touch reset on serial port COM42
"C:\Users\per\AppData\Local\Arduino15\packages\arduino\tools\bossac\1.9.1-arduino5/bossac" -d --port=COM42 -U -e -w "C:\Users\per\AppData\Local\Temp\arduino\sketches\1F72A0DD582A60EAC64D21C07F93BFD9/HIDSketch.ino.bin" -R
Set binary mode
version()=Arduino Bootloader (SAM-BA extended) 2.0 [Arduino:IKXYZ]
Connected at 921600 baud
identifyChip()=nRF52840-QIAA
write(addr=0,size=0x34)
writeWord(addr=0x30,value=0x400)
writeWord(addr=0x20,value=0)
Erase flash
chipErase(addr=0)

Done in 0.001 seconds
Write 34604 bytes to flash (9 pages)
[                              ] 0% (0/9 pages)write(addr=0x34,size=0x1000)
writeBuffer(scr_addr=0x34, dst_addr=0, size=0x1000)
[===                           ] 11% (1/9 pages)write(addr=0x34,size=0x1000)
writeBuffer(scr_addr=0x34, dst_addr=0x1000, size=0x1000)
[======                        ] 22% (2/9 pages)write(addr=0x34,size=0x1000)
writeBuffer(scr_addr=0x34, dst_addr=0x2000, size=0x1000)
[==========                    ] 33% (3/9 pages)write(addr=0x34,size=0x1000)
writeBuffer(scr_addr=0x34, dst_addr=0x3000, size=0x1000)
[=============                 ] 44% (4/9 pages)write(addr=0x34,size=0x1000)
writeBuffer(scr_addr=0x34, dst_addr=0x4000, size=0x1000)
[================              ] 55% (5/9 pages)write(addr=0x34,size=0x1000)
writeBuffer(scr_addr=0x34, dst_addr=0x5000, size=0x1000)
[====================          ] 66% (6/9 pages)write(addr=0x34,size=0x1000)
writeBuffer(scr_addr=0x34, dst_addr=0x6000, size=0x1000)
[=======================       ] 77% (7/9 pages)write(addr=0x34,size=0x1000)
writeBuffer(scr_addr=0x34, dst_addr=0x7000, size=0x1000)
[==========================    ] 88% (8/9 pages)write(addr=0x34,size=0x1000)
writeBuffer(scr_addr=0x34, dst_addr=0x8000, size=0x1000)
[==============================] 100% (9/9 pages)
Done in 2.238 seconds
reset()
Demo
$ arduino-cli board list  # The HID sketch causes the port address to change

Port  Protocol Type              Board Name                FQBN                          Core
COM12 serial   Serial Port (USB) Arduino UNO R4 WiFi       arduino:renesas_uno:unor4wifi arduino:renesas_uno

$ arduino-cli upload --fqbn arduino:renesas_uno:unor4wifi --port COM12 --verbose /tmp/HIDSketch  # Touch step fails and the bossac command runs with the wrong port

Performing 1200-bps touch reset on serial port COM12
Cannot perform port reset: TOUCH: error during reset: opening port at 1200bps: Invalid serial port
"C:\Users\per\AppData\Local\Arduino15\packages\arduino\tools\bossac\1.9.1-arduino5/bossac" -d --port=COM12 -U -e -w "C:\Users\per\AppData\Local\Temp\arduino\sketches\1F72A0DD582A60EAC64D21C07F93BFD9/HIDSketch.ino.bin" -R
No device found on COM12
Failed uploading: uploading error: exit status 1

$ arduino-cli board list  # Even though the touch process failed, it did put the board into bootloader mode

Port  Protocol Type              Board Name                FQBN                          Core
COM42 serial   Serial Port (USB) Arduino UNO R4 WiFi       arduino:renesas_uno:unor4wifi arduino:renesas_uno

$ arduino-cli upload --fqbn arduino:renesas_uno:unor4wifi --port COM42 /tmp/HIDSketch  # The next upload succeeds because the board is in bootloader mode

Performing 1200-bps touch reset on serial port COM42
"C:\Users\per\AppData\Local\Arduino15\packages\arduino\tools\bossac\1.9.1-arduino5/bossac" -d --port=COM42 -U -e -w "C:\Users\per\AppData\Local\Temp\arduino\sketches\1F72A0DD582A60EAC64D21C07F93BFD9/HIDSketch.ino.bin" -R
Set binary mode
version()=Arduino Bootloader (SAM-BA extended) 2.0 [Arduino:IKXYZ]
Connected at 921600 baud
identifyChip()=nRF52840-QIAA
write(addr=0,size=0x34)
writeWord(addr=0x30,value=0x400)
writeWord(addr=0x20,value=0)
Erase flash
chipErase(addr=0)

Done in 0.001 seconds
Write 34604 bytes to flash (9 pages)
[                              ] 0% (0/9 pages)write(addr=0x34,size=0x1000)
writeBuffer(scr_addr=0x34, dst_addr=0, size=0x1000)
[===                           ] 11% (1/9 pages)write(addr=0x34,size=0x1000)
writeBuffer(scr_addr=0x34, dst_addr=0x1000, size=0x1000)
[======                        ] 22% (2/9 pages)write(addr=0x34,size=0x1000)
writeBuffer(scr_addr=0x34, dst_addr=0x2000, size=0x1000)
[==========                    ] 33% (3/9 pages)write(addr=0x34,size=0x1000)
writeBuffer(scr_addr=0x34, dst_addr=0x3000, size=0x1000)
[=============                 ] 44% (4/9 pages)write(addr=0x34,size=0x1000)
writeBuffer(scr_addr=0x34, dst_addr=0x4000, size=0x1000)
[================              ] 55% (5/9 pages)write(addr=0x34,size=0x1000)
writeBuffer(scr_addr=0x34, dst_addr=0x5000, size=0x1000)
[====================          ] 66% (6/9 pages)write(addr=0x34,size=0x1000)
writeBuffer(scr_addr=0x34, dst_addr=0x6000, size=0x1000)
[=======================       ] 77% (7/9 pages)write(addr=0x34,size=0x1000)
writeBuffer(scr_addr=0x34, dst_addr=0x7000, size=0x1000)
[==========================    ] 88% (8/9 pages)write(addr=0x34,size=0x1000)
writeBuffer(scr_addr=0x34, dst_addr=0x8000, size=0x1000)
[==============================] 100% (9/9 pages)
Done in 2.238 seconds
reset()

Expected behavior

Correct port address is always used in the upload command.

Project version

e5ab698

Operating system

  • Windows
  • Linux
  • macOS

Operating system version

  • Windows 11
  • Ubuntu 22.04
  • macOS Ventura

Additional context

For the sake of simplicity, I used The the low level "HID" library in the demonstration sketch, but that is not commonly used in real world sketches. However, it is common to use the "Keyboard" or "Mouse" libraries, which have a dependency on the "HID" library and are documented as supported for use with the UNO R4 WiFi:

https://docs.arduino.cc/tutorials/uno-r4-wifi/usb-hid

The fault will also occur when using either of those libraries in a sketch:

#include <Keyboard.h>
void setup() {}
void loop() {}

Originally reported at https://forum.arduino.cc/t/failed-uploading-after-upload-usb-hid-example/1151778

Workaround

  1. Unplug the USB cable of the UNO R4 WiFi board from your computer.
  2. Connect the UNO R4 WiFi board to your computer with the USB cable.
  3. Press and release the button marked "RESET" on your UNO R4 WiFi board quickly twice.
    You should now see the "L" LED pulsing.
  4. Check the port of the UNO R4 WiFi board.
    ❗ The double reset you did in step (1) can cause the port number of the board to change, so don't assume you already have the correct port selected.
  5. Upload the sketch to the board as usual.

Serial(__UARTx__ ) and FSP code issue can lose data

@facchinm @maidnl and others,

As I have mentioned in another issue: #44, there are some pieces missing in the current implementation of the SerialX classes as well as things that could improve performance. Toward this goal I have tried to implement code to flesh out some of the missing pieces, like availableForWrite, flush, etc. #59 marked Draft.

The main thing I am trying to do, is to change the implementation of the write method, to use the rather large FIFO buffer already built into your Uart class.

Roughly: when you call Write, the code would put the new data into your FIFO. If the UART was not active, have the class have a temporary buffer maybe 8 or 16 bytes or the like, that the code would extract up to that many bytes from the fifo and call off to: R_SCI_UART_Write with that buffer and length.

When the FSP method and corresponding ISR code completes the processing of this buffer, it will call back to your code class saying that it completed that buffer. I would expect at that point I should be able to extract the next set of bytes into my temporary buffer and call some FSP method, which might be R_SCI_UART_Write, or potentially something else to continue to output.

The problem:
In r_rsi_b_uart.c, the ISR function: void sci_b_uart_txi_isr (void)
Will see that it is more data to output, so suppose the tx_src_bytes has is equal to 1, i.e the last element.
In simplified explanation (disregarding the FIFO case), will place the last character into TDR register and decrement the count.

It will then see that the tx_src_bytes is now 0, and it will do the callback.

Now in the callback I calling R_SCI_UART_Write, would at times would blindly put the first character of the new buffer into the TDR register without checking the TDRE status, and would overwrite the last character that I output in the previous buffer.
The code looks different now, not sure if there as a new version of this stuff that my last sync of all sub-systems may have changed. I need to look closer, but almost like it still turns off the interrupts, and maybe now waits until everything transfers, before starting back up? Will experiment. But either way, this is not an ideal solution.

possibilities

  1. Fix or extend the FSP code - For example if it is stuffing out a character regardless of TDRE (or FIFO full), add a check to not do so.
    or maybe better solution, either allow the callback method to call something to say continue using this buffer and length, or have method for either FIFO of buffers or double buffer of them. Or add the FIFO of actual bytes to the FSP code.

If this is the preferred approach, it brings up questions like:
a) How do you make changes to FSP? Does Arduino have to submit request to Renesas, and wait for hopefully new release.
b) How do you build a new FSP archive file to build with? So far it looks like you need to an IDE, but then it looks like it requires several other things as well.

  1. Mostly use FSP, but for example add our own method, which might be something new or a fixed version of an existing api. Example updates the buffer/counter in their data structures.

Sort of messy but at least you can easily get up and running.

  1. Replace FSP, with hopefully a lighter weight and hopefully faster implementation. This potentially could be only part of the code or the whole UART code. I do not know Arduino's goals for the usage of FSP. Is it the goal to have the Arduino code as a wrapper of the Renesas code, or the FSP code was simply the fastest way to the goal of being able to release the new board.

My WIP branch I mentioned, is a partial 3). Probably not in a clean way. I replaced their TX ISR, with my own. Not sure if Arduino has a prescribed way to do so, or if it is frowned upon. I did it by hacking up an equivalent Teensy code: attachInterruptVector, where I passed in the ISR number for TX and my own code, which uses the FIFO queue already built into the code.

Question:
What strategy does Arduino prefer to deal with, issues with FSP, with bugs, limitations, or bloat?

I know that none of these solutions are overly original, but having a good idea of your preferences, make it a lot easier to make progress and hopefully an acceptable solution.

Thanks

Kurt

Hardware-Accelerator Crypto

On the Uno R4 WiFi, I'd like to make use of the Renesas' chips SCE (Secure Cryptography Engine). According to the .h file, the chip does that peripheral.

#define BSP_FEATURE_BSP_HAS_SCE5 (1)
#define BSP_FEATURE_CRYPTO_HAS_SCE5B (0)
#define BSP_FEATURE_CRYPTO_HAS_SCE5 (1)

In docs:
grafik

And r_sce_if.h seems to be the main header that declares the availble functions.

Creating a new .c file and writing a small test program

#include <r_sce_if.h>

void test() {
    const char* msg = "Hello";
    sce_sha_md5_handle_t ctx;
    uint8_t sha256_out[256 / 8];
    uint32_t digestLen = 256/8;
    HW_SCE_McuSpecificInit();
    HW_SCE_Sha256Init(&ctx);
    HW_SCE_Sha256Update(&ctx, (uint8_t*)msg, strlen(msg));
    HW_SCE_Sha256Final(&ctx, sha256_out, &digestLen);

    printf("Hash: ");
    for(int i=0; i < 256/8; i++) printf("%02x", sha256_out[i]);
    printf("\n");
}

fails at the linking stage with

main.c:(.text.test+0xe): undefined reference to `HW_SCE_Sha256Init'
main.c:(.text.test+0x20): undefined reference to `HW_SCE_Sha256Update'
main.c:(.text.test+0x2a): undefined reference to `HW_SCE_Sha256Final'

Some related datasheets very unhelpfully say

grafik

And the implementation of HW_SCE_Sha256Init() and related is nowhere to be found in the FSP (neither v4.0 that you used for this core nor the current version).

Am I blind or do I have to sign a freaking NDA with Renesas to use the crypto accelerator hardware in a chip I already paid money for?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.