Hello and Happy 2018 :)
I'm using ATmega1284P DIP chip, 3.3V with 16MHz external crystal.
I have uploaded MoteinoMEGA bootloader (DualOptiboot_V5.0_atmega1284p_BlinkD15.hex) using STK 500 programmer. (also tried Dualoptiboot_v5.0_atmega328_8mhz_57600baud_BlinkD9_SPIdisable.hex)
Problem: when using Node.ino example, in Serial Monitor I can see that all those Sending[1]... Sending[2] lines are with approximately 3 or 4 seconds delay. And because of that, on Receiver side (Gateway.ino example) nothing is received. I have tried simple Blink program and time is OK and LED is blinking correctly. I tried to blink an LED inside Node.ino sketch and LED is blinking in time correctly. But sending with RFM69HW module is not working.
When I change chip to ATmega328P, sending and receiving is working as expected.
I have also tried to burn Optiboot 6.2 bootloader (https://github.com/Optiboot/optiboot) and then upload Node.ino sketch, then I got some junk in Serial Monitor.
I have also tried to burn MightyCore bootloader (https://github.com/MCUdude/MightyCore) and then upload Node.ino sketch, then again every sending is like with 4 seconds delay and nothing received on Receiver side.
What am I doing wrong? Why this is working only on ATmega328P chip but not on ATmega1284P?
F.
I think you're doing everything right.
Are your DIP chips from china?
Well I bought those DIP chips from eBay (UK seller), so probably from China.
I also have ATmega1284P-AU TQFP-44 chip which I bought from Farnell (so this is definitely not a clone). Just uploaded MoteinoMEGA bootloader and then uploaded default Blink sketch from Arduino IDE examples and LED is blinking randomly. So probably something is wrong.
Maybe problem with programmer? My AVR MKII is a clone because AVR Studio can't find it. I bought this programmer some 10 years ago.
What else should I try?
First of all, what bootloader shoud I upload? From where to start?
F.
Cheap parts from china is like the lottery :-\
Anyways assuming you do have 1 good part, you need a working ISP programmer.
Then you need to set fuses correctly, as indicated in the MoteinoMEGA core. Then burn the bootloader depending on your chip speed 8mhz - or 16mhz version. You can even burn Optiboot if you don't need wireless programming ability.
Good luck.
I found the cause of the LED blinking strange behavior and the problem was faulty 16 MHz crystal. Replaced that and problem disappeared.
Now back to original problem.
I successfully uploaded Node.ino sketch to OEM ATmega1284P-AU (TQFP-44) chip bought from Farnell UK, but the problem with slow speed is still happening. I tried other TQFP chip and the same problem.
So probably ISP programmer is the problem..
What do you mean by setting fuses correctly?
I did this:
Followed instructions here https://lowpowerlab.com/guide/moteino/programming-libraries/
So now I have Moteino folder here: ~/.arduino15/packages/Moteino/hardware/avr/1.3.0
File boards.txt contains these settings:
MoteinoMEGA.name=MoteinoMEGA
MoteinoMEGA.upload.tool=avrdude
MoteinoMEGA.upload.maximum_size=130048
MoteinoMEGA.upload.maximum_data_size=16384
MoteinoMEGA.upload.speed=115200
MoteinoMEGA.upload.protocol=arduino
MoteinoMEGA.bootloader.low_fuses=0xDE
MoteinoMEGA.bootloader.high_fuses=0xDE
MoteinoMEGA.bootloader.extended_fuses=0xFD
MoteinoMEGA.bootloader.unlock_bits=0x3F
MoteinoMEGA.bootloader.lock_bits=0xCF
MoteinoMEGA.bootloader.path=MoteinoMEGA
MoteinoMEGA.bootloader.file=DualOptiboot_V5.0_atmega1284p_BlinkD15_SPIdisable.hex
#MoteinoMEGA.bootloader.file=DualOptiboot_V5.0_atmega1284p_BlinkD15.hex
MoteinoMEGA.bootloader.tool=arduino:avrdude
MoteinoMEGA.build.mcu=atmega1284p
MoteinoMEGA.build.f_cpu=16000000L
MoteinoMEGA.build.core=arduino:arduino
MoteinoMEGA.build.board=AVR_ATmega1284
MoteinoMEGA.build.variant=MoteinoMEGA
Is that correct?
Also, should ATmega1284P also use INT0 pin like for ATmega328P?
I tried to pull-up SS pin while burning bootloader, no help.
Should I use DualOptiboot_V5.0_atmega1284p_BlinkD15.hex or DualOptiboot_V5.0_atmega1284p_BlinkD15_SPIdisable.hex bootloader?
F.
I found the problem.
I should use INT2 on ATmega1284P instead of INT0.
I looked in file RFM69.h and found that "RF69_IRQ_PIN" is set to use pin 2.
For Arduino core this is D2 pin which is INT0 (PD2) on ATmega328P, but on ATmega1284P it is actually INT2 (PB2). Jeez, my fault..
Now sending/receiving is working as expected.
Anyway, Felix, could you please explain difference between DualOptiboot bootloaders? SPIdisable? What it is?
F.
https://lowpowerlab.com/guide/moteino/wireless-programming/
https://github.com/LowPowerLab/DualOptiboot