sui77 / rc-switch

Arduino lib to operate 433/315Mhz devices like power outlet sockets.
1.9k stars 658 forks source link

original "Arduino Nano Every" not supported? (ATmega4809) #398

Open m-hoppe opened 3 years ago

m-hoppe commented 3 years ago

I just tried to upload a working Arduino sketch (based on your library) to my all new "Arduino NANO Every" (ATmega4809) and im receiving hints / error messages (see below). The Arduino sketch worked fine with my original Arduino UNO and fake Arduino NANO V3 (ATmega328 CH340). I'm using the same sender and receiver - and I also tried the hardware once again with the old Arduinos - so the hardware is OK.

The problem starts already by just trying to open the "examples" of your library - BUT only with the NANO Every!

incompatible

Here is the hint / warning of the Arduino NANO Every:

SHORT message:

WARNING: library rc-switch-2.6.4 claims to run on avr, esp8266, esp32, stm32 architecture(s) and may be incompatible with your current board which runs on megaavr architecture(s). Sketch uses 8147 bytes (16%) of program storage space. Maximum is 49152 bytes. Global variables use 587 bytes (9%) of dynamic memory, leaving 5557 bytes for local variables. Maximum is 6144 bytes. avrdude: jtagmkII_initialize(): Cannot locate "flash" and "boot" memories in description

LONG message:

WARNING: library rc-switch-2.6.4 claims to run on avr, esp8266, esp32, stm32 architecture(s) and may be incompatible with your current board which runs on megaavr architecture(s). Sketch uses 8147 bytes (16%) of program storage space. Maximum is 49152 bytes. Global variables use 587 bytes (9%) of dynamic memory, leaving 5557 bytes for local variables. Maximum is 6144 bytes. Forcing reset using 1200bps open/close on port COM3 C:\Users\MarcH\Documents\ArduinoData\packages\arduino\tools\avrdude\6.3.0-arduino17/bin/avrdude -CC:\Users\MarcH\Documents\ArduinoData\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf -v -patmega4809 -cjtag2updi -PCOM3 -b115200 -e -D -Uflash:w:C:\Users\MarcH\AppData\Local\Temp\arduino_build_16758/BatterySwitch_1.0.0.10.ino.hex:i -Ufuse2:w:0x01:m -Ufuse5:w:0xC9:m -Ufuse8:w:0x00:m {upload.extra_files}

avrdude: Version 6.3-20190619 Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/ Copyright (c) 2007-2014 Joerg Wunsch

     System wide configuration file is "C:\Users\MarcH\Documents\ArduinoData\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf"

     Using Port                    : COM3
     Using Programmer              : jtag2updi
     Overriding Baud Rate          : 115200

JTAG ICE mkII sign-on message: Communications protocol version: 1 M_MCU: boot-loader FW version: 1 firmware version: 1.07 hardware version: 1 S_MCU: boot-loader FW version: 1 firmware version: 6.07 hardware version: 1 Serial number: 00:00:00:00:00:00 Device ID: JTAGICE mkII AVR Part : ATmega4809 Chip Erase delay : 0 us PAGEL : P00 BS2 : P00 RESET disposition : dedicated RETRY pulse : SCK serial program mode : yes parallel program mode : yes Timeout : 0 StabDelay : 0 CmdexeDelay : 0 SyncLoops : 0 ByteDelay : 0 PollIndex : 0 PollValue : 0x00 Memory Detail :

                              Block Poll               Page                       Polled
       Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
       ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
       signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00
       prodsig        0     0     0    0 no         61   61      0     0     0 0x00 0x00
       fuses          0     0     0    0 no          9    0      0     0     0 0x00 0x00
       fuse0          0     0     0    0 no          1    0      0     0     0 0x00 0x00
       fuse1          0     0     0    0 no          1    0      0     0     0 0x00 0x00
       fuse2          0     0     0    0 no          1    0      0     0     0 0x00 0x00
       fuse4          0     0     0    0 no          1    0      0     0     0 0x00 0x00
       fuse5          0     0     0    0 no          1    0      0     0     0 0x00 0x00
       fuse6          0     0     0    0 no          1    0      0     0     0 0x00 0x00
       fuse7          0     0     0    0 no          1    0      0     0     0 0x00 0x00
       fuse8          0     0     0    0 no          1    0      0     0     0 0x00 0x00
       lock           0     0     0    0 no          1    0      0     0     0 0x00 0x00
       data           0     0     0    0 no          0    0      0     0     0 0x00 0x00
       usersig        0     0     0    0 no         64   64      0     0     0 0x00 0x00
       flash          0     0     0    0 no      49152  128      0     0     0 0x00 0x00
       eeprom         0     0     0    0 no        256   64      0     0     0 0x00 0x00

     Programmer Type : JTAGMKII_PDI
     Description     : JTAGv2 to UPDI bridge
     M_MCU hardware version: 1
     M_MCU firmware version: 1.07
     S_MCU hardware version: 1
     S_MCU firmware version: 6.07
     Serial number:          00:00:00:00:00:00
     Vtarget         : 5.0 V

avrdude: jtagmkII_initialize(): Cannot locate "flash" and "boot" memories in description avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.27s

avrdude: Device signature = 0x1e9651 (probably m4809) avrdude: erasing chip avrdude: reading input file "C:\Users\MarcH\AppData\Local\Temp\arduino_build_16758/BatterySwitch_1.0.0.10.ino.hex" avrdude: writing flash (8148 bytes):

Writing | ################################################## | 100% 5.99s

avrdude: 8148 bytes of flash written avrdude: verifying flash memory against C:\Users\MarcH\AppData\Local\Temp\arduino_build_16758/BatterySwitch_1.0.0.10.ino.hex: avrdude: load data flash data from input file C:\Users\MarcH\AppData\Local\Temp\arduino_build_16758/BatterySwitch_1.0.0.10.ino.hex: avrdude: input file C:\Users\MarcH\AppData\Local\Temp\arduino_build_16758/BatterySwitch_1.0.0.10.ino.hex contains 8148 bytes avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 1.13s

avrdude: verifying ... avrdude: 8148 bytes of flash verified avrdude: reading input file "0x01" avrdude: writing fuse2 (1 bytes):

Writing | ################################################## | 100% 0.01s

avrdude: 1 bytes of fuse2 written avrdude: verifying fuse2 memory against 0x01: avrdude: load data fuse2 data from input file 0x01: avrdude: input file 0x01 contains 1 bytes avrdude: reading on-chip fuse2 data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ... avrdude: 1 bytes of fuse2 verified avrdude: reading input file "0xC9" avrdude: writing fuse5 (1 bytes):

Writing | ################################################## | 100% 0.01s

avrdude: 1 bytes of fuse5 written avrdude: verifying fuse5 memory against 0xC9: avrdude: load data fuse5 data from input file 0xC9: avrdude: input file 0xC9 contains 1 bytes avrdude: reading on-chip fuse5 data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ... avrdude: 1 bytes of fuse5 verified avrdude: reading input file "0x00" avrdude: writing fuse8 (1 bytes):

Writing | ################################################## | 100% 0.01s

avrdude: 1 bytes of fuse8 written avrdude: verifying fuse8 memory against 0x00: avrdude: load data fuse8 data from input file 0x00: avrdude: input file 0x00 contains 1 bytes avrdude: reading on-chip fuse8 data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ... avrdude: 1 bytes of fuse8 verified

avrdude done. Thank you.

jpolton commented 1 year ago

I added "megaavr" to the allowed architectures in library.properties:

...
architectures=avr,esp8266,esp32,stm32,megaavr
...

and I was able to send messages using an Arduino Nano Every (ATMega4809).

E.g.

#include <RCSwitch.h>

RCSwitch mySwitch = RCSwitch();

void setup() {

  Serial.begin(9600);

  // Transmitter is connected to Arduino Every Pin #4  
  mySwitch.enableTransmit(4);

}

void loop() {

  /* Button 3 Toggle */

  mySwitch.send(1397076, 24); // Button 3: OFF
  delay(1000);  
  mySwitch.send(1397079, 24); // Button 3: ON
  delay(1000);  

}

Did not do more extensive testing as this fulfilled my requirements.