WIreless connection not working - help please.

230 views
Skip to first unread message

Przemysław Biernat

unread,
Jan 23, 2015, 1:21:49 AM1/23/15
to openhr20-d...@googlegroups.com
Hi.
I compiled, flashed and soldiered HR20 and master board, following https://piontecsmumble.wordpress.com/ .

I soldiered twice HR20 and twice the master board.
Still there is no communication between them. I have a message E4.

Is connections on this website are correct?
Can there any other error.
Help please.

Tomas Kopal

unread,
Jan 23, 2015, 4:20:19 AM1/23/15
to openhr20-d...@googlegroups.com
Hi,

I haven't checked the website too thoroughly, but as far as I know, it
is correct. Unfortunately, it is quite hard to debug and diagnose the
wireless communication without special equipment. And there is a LOT of
things which can go wrong.

First, check that you have set the same frequency on both ends, and also
that your encryption key is identical on both ends. (E.g. I had a
problem that for my master unit, I was flashing it "arduino style" via
serial, not via SPI, and this method can't program eeprom, where the key
is stored. Took me a while to figure this out).

If you have two pieces of the master board, you can also try to program
some primitive test application to communicate between the two master
boards, to check that the master board is ok. Once you establish that,
you can concentrate on the regulator.

Do you have access to some equipment to check the SPI communication with
the radio? Logical analyzer? Oscilloscope?

Other than that, I would probably invest into some cheap RTL based USB
TV dongle, which can be used with some SDR application. I have
personally used SDR-sharp (http://sdrsharp.com/#download), but there are
others as well. It can be very helpful to check whether you are
transmitting at all, on what frequencies etc.

Good luck

Tomas

Przemysław Biernat

unread,
Jan 23, 2015, 5:04:44 AM1/23/15
to openhr20-d...@googlegroups.com
It seems to me that the problem with the EEPROM is probable.
My JTAG is noname.
I solder today USBASP directly.

What set FUSEBIT the master and the HR20?

What are the parameters for the master compilation (Arduino Nano)?
Compile_arduino.sh file causes errors.

In the master i connect DIGITAL3 to DIGITAL 12
I need connect this to the nINT in RMF12B?

Tomas Kopal

unread,
Jan 23, 2015, 5:28:54 AM1/23/15
to openhr20-d...@googlegroups.com
On 23/01/15 11:04, Przemysław Biernat wrote:
> It seems to me that the problem with the EEPROM is probable.
> My JTAG is noname.
If you are using jtag and you are able to program the chip without
errors, I would guess that all should be ok (given you are using the
right parameters for flashing). ISP programming should be also OK.
Problematic is mostly programming via bootloader and serial
communication, then you rely on the bootloader to implement programming
of all memories, which some do not do due to space constraints.

But you are giving too little information here. Are you using JTAG for
master? Slave? Both? What software, avrdude?

> I solder today USBASP directly.
>
> What set FUSEBIT the master and the HR20?

Fuses are stated in the code, look in main.c, look for FUSES structure
definition. They should be ok for the regulator, but may not be right
for your master, depending on what kind of hardware you are using as a
master.

> What are the parameters for the master compilation (Arduino Nano)?
> Compile_arduino.sh file causes errors.

No idea, what is your master? Custom built? Arduino Nano? Some third-party?

> In the master i connect DIGITAL3 to DIGITAL 12
> I need connect this to the nINT in RMF12B?
>

:-) Without seeing the schematics or at least you telling us what is
your master, I do not think anyone can answer this :-).

Regards

Tomas


Przemysław Biernat

unread,
Jan 25, 2015, 1:51:37 PM1/25/15
to openhr20-d...@googlegroups.com, tomas...@altap.cz
W dniu piątek, 23 stycznia 2015 11:28:54 UTC+1 użytkownik Tomas Kopal napisał:
> If you are using jtag and you are able to program the chip without
> errors, I would guess that all should be ok (given you are using the
> right parameters for flashing). ISP programming should be also OK.
> Problematic is mostly programming via bootloader and serial
> communication, then you rely on the bootloader to implement programming
> of all memories, which some do not do due to space constraints.
>
> But you are giving too little information here. Are you using JTAG for
> master? Slave? Both? What software, avrdude?

I get sources from:
https://github.com/OpenHR20/OpenHR20

I compile HR20:
# ./compile_hr20.sh

-------- begin --------

Cleaning project:
rm -f hr20.hex
rm -f hr20.eep
rm -f hr20.bin
rm -f hr20.cof
rm -f hr20.elf
rm -f hr20.map
rm -f hr20.sym
rm -f hr20.lss
rm -f hr20.txt
rm -f obj/motor.o obj/controller.o obj/watch.o obj/com.o obj/wireless.o obj/rfm.o obj/cmac.o
rm -f obj/motor.lst obj/controller.lst obj/watch.lst obj/com.lst obj/wireless.lst obj/rfm.lst obj/cmac.lst
rm -f obj/xtea-asm.o
rm -f obj/xtea-asm.lst
rm -f motor.s controller.s watch.s com.s wireless.s rfm.s cmac.s
rm -f motor.d controller.d watch.d com.d wireless.d rfm.d cmac.d
rm -f motor.i controller.i watch.i com.i wireless.i rfm.i cmac.i
rm -f obj/rtc.o obj/main.o obj/keyboard.o obj/adc.o obj/eeprom.o obj/menu.o obj/lcd.o obj/rs232_485_hw.o
rm -f obj/rtc.lst obj/main.lst obj/keyboard.lst obj/adc.lst obj/eeprom.lst obj/menu.lst obj/lcd.lst obj/rs232_485_hw.lst
rm -f rtc.s main.s keyboard.s adc.s eeprom.s menu.s lcd.s rs232_485_hw.s
rm -f rtc.d main.d keyboard.d adc.d eeprom.d menu.d lcd.d rs232_485_hw.d
rm -f rtc.i main.i keyboard.i adc.i eeprom.i menu.i lcd.i rs232_485_hw.i
rm -rf .dep
-------- end --------


-------- begin --------
avr-gcc (GCC) 4.9.2 20141224 (prerelease)
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


Compiling C: motor.c
avr-gcc -c -mmcu=atmega169p -I. -gdwarf-2 -DF_CPU=4000000UL -DRFM=1 -DRFM_TUNING=1 -DRFM_FREQ=868 -DRFM_BAUD_RATE=9600 -DSECURITY_KEY_0=0x01 -DSECURITY_KEY_1=0x23 -DSECURITY_KEY_2=0x45 -DSECURITY_KEY_3=0x67 -DSECURITY_KEY_4=0x89 -DSECURITY_KEY_5=0x01 -DSECURITY_KEY_6=0x23 -DSECURITY_KEY_7=0x45 -DRFM_DEVICE_ADDRESS=10 -DRFM_WIRE_MARIOJTAG=1 -DMOTOR_COMPENSATE_BATTERY=1 -DREMOTE_SETTING_ONLY=0 -Os -mcall-prologues -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=obj/motor.lst -std=gnu99 -ffreestanding -Wl,--relax -fdata-sections -MMD -MP -MF .dep/motor.o.d motor.c -o obj/motor.o
motor.c: In function 'MOTOR_updateCalibration':
motor.c:120:17: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
MOTOR_ManuCalibration=-1; // automatic calibration
^
motor.c:124:17: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
MOTOR_ManuCalibration=0; // not calibrated
^
motor.c: In function 'MOTOR_timer_stop':
motor.c:337:21: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
if (MOTOR_ManuCalibration==0) {
^
motor.c:339:29: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
MOTOR_ManuCalibration = a;
^

Compiling C: controller.c
avr-gcc -c -mmcu=atmega169p -I. -gdwarf-2 -DF_CPU=4000000UL -DRFM=1 -DRFM_TUNING=1 -DRFM_FREQ=868 -DRFM_BAUD_RATE=9600 -DSECURITY_KEY_0=0x01 -DSECURITY_KEY_1=0x23 -DSECURITY_KEY_2=0x45 -DSECURITY_KEY_3=0x67 -DSECURITY_KEY_4=0x89 -DSECURITY_KEY_5=0x01 -DSECURITY_KEY_6=0x23 -DSECURITY_KEY_7=0x45 -DRFM_DEVICE_ADDRESS=10 -DRFM_WIRE_MARIOJTAG=1 -DMOTOR_COMPENSATE_BATTERY=1 -DREMOTE_SETTING_ONLY=0 -Os -mcall-prologues -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=obj/controller.lst -std=gnu99 -ffreestanding -Wl,--relax -fdata-sections -MMD -MP -MF .dep/controller.o.d controller.c -o obj/controller.o

Compiling C: watch.c
avr-gcc -c -mmcu=atmega169p -I. -gdwarf-2 -DF_CPU=4000000UL -DRFM=1 -DRFM_TUNING=1 -DRFM_FREQ=868 -DRFM_BAUD_RATE=9600 -DSECURITY_KEY_0=0x01 -DSECURITY_KEY_1=0x23 -DSECURITY_KEY_2=0x45 -DSECURITY_KEY_3=0x67 -DSECURITY_KEY_4=0x89 -DSECURITY_KEY_5=0x01 -DSECURITY_KEY_6=0x23 -DSECURITY_KEY_7=0x45 -DRFM_DEVICE_ADDRESS=10 -DRFM_WIRE_MARIOJTAG=1 -DMOTOR_COMPENSATE_BATTERY=1 -DREMOTE_SETTING_ONLY=0 -Os -mcall-prologues -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=obj/watch.lst -std=gnu99 -ffreestanding -Wl,--relax -fdata-sections -MMD -MP -MF .dep/watch.o.d watch.c -o obj/watch.o

Compiling C: com.c
avr-gcc -c -mmcu=atmega169p -I. -gdwarf-2 -DF_CPU=4000000UL -DRFM=1 -DRFM_TUNING=1 -DRFM_FREQ=868 -DRFM_BAUD_RATE=9600 -DSECURITY_KEY_0=0x01 -DSECURITY_KEY_1=0x23 -DSECURITY_KEY_2=0x45 -DSECURITY_KEY_3=0x67 -DSECURITY_KEY_4=0x89 -DSECURITY_KEY_5=0x01 -DSECURITY_KEY_6=0x23 -DSECURITY_KEY_7=0x45 -DRFM_DEVICE_ADDRESS=10 -DRFM_WIRE_MARIOJTAG=1 -DMOTOR_COMPENSATE_BATTERY=1 -DREMOTE_SETTING_ONLY=0 -Os -mcall-prologues -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=obj/com.lst -std=gnu99 -ffreestanding -Wl,--relax -fdata-sections -MMD -MP -MF .dep/com.o.d com.c -o obj/com.o

Compiling C: wireless.c
avr-gcc -c -mmcu=atmega169p -I. -gdwarf-2 -DF_CPU=4000000UL -DRFM=1 -DRFM_TUNING=1 -DRFM_FREQ=868 -DRFM_BAUD_RATE=9600 -DSECURITY_KEY_0=0x01 -DSECURITY_KEY_1=0x23 -DSECURITY_KEY_2=0x45 -DSECURITY_KEY_3=0x67 -DSECURITY_KEY_4=0x89 -DSECURITY_KEY_5=0x01 -DSECURITY_KEY_6=0x23 -DSECURITY_KEY_7=0x45 -DRFM_DEVICE_ADDRESS=10 -DRFM_WIRE_MARIOJTAG=1 -DMOTOR_COMPENSATE_BATTERY=1 -DREMOTE_SETTING_ONLY=0 -Os -mcall-prologues -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=obj/wireless.lst -std=gnu99 -ffreestanding -Wl,--relax -fdata-sections -MMD -MP -MF .dep/wireless.o.d wireless.c -o obj/wireless.o

Compiling C: rfm.c
avr-gcc -c -mmcu=atmega169p -I. -gdwarf-2 -DF_CPU=4000000UL -DRFM=1 -DRFM_TUNING=1 -DRFM_FREQ=868 -DRFM_BAUD_RATE=9600 -DSECURITY_KEY_0=0x01 -DSECURITY_KEY_1=0x23 -DSECURITY_KEY_2=0x45 -DSECURITY_KEY_3=0x67 -DSECURITY_KEY_4=0x89 -DSECURITY_KEY_5=0x01 -DSECURITY_KEY_6=0x23 -DSECURITY_KEY_7=0x45 -DRFM_DEVICE_ADDRESS=10 -DRFM_WIRE_MARIOJTAG=1 -DMOTOR_COMPENSATE_BATTERY=1 -DREMOTE_SETTING_ONLY=0 -Os -mcall-prologues -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=obj/rfm.lst -std=gnu99 -ffreestanding -Wl,--relax -fdata-sections -MMD -MP -MF .dep/rfm.o.d rfm.c -o obj/rfm.o
In file included from rfm.c:3:0:
../common/rfm.c: In function 'rfm_spi16':
../common/rfm.c:81:11: warning: 'ret' may be used uninitialized in this function [-Wmaybe-uninitialized]
ret <<= 1;
^

Compiling C: cmac.c
avr-gcc -c -mmcu=atmega169p -I. -gdwarf-2 -DF_CPU=4000000UL -DRFM=1 -DRFM_TUNING=1 -DRFM_FREQ=868 -DRFM_BAUD_RATE=9600 -DSECURITY_KEY_0=0x01 -DSECURITY_KEY_1=0x23 -DSECURITY_KEY_2=0x45 -DSECURITY_KEY_3=0x67 -DSECURITY_KEY_4=0x89 -DSECURITY_KEY_5=0x01 -DSECURITY_KEY_6=0x23 -DSECURITY_KEY_7=0x45 -DRFM_DEVICE_ADDRESS=10 -DRFM_WIRE_MARIOJTAG=1 -DMOTOR_COMPENSATE_BATTERY=1 -DREMOTE_SETTING_ONLY=0 -Os -mcall-prologues -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=obj/cmac.lst -std=gnu99 -ffreestanding -Wl,--relax -fdata-sections -MMD -MP -MF .dep/cmac.o.d cmac.c -o obj/cmac.o
In file included from cmac.c:3:0:
../common/cmac.c: In function 'cmac_calc':
../common/cmac.c:70:18: warning: 'Kx' may be used uninitialized in this function [-Wmaybe-uninitialized]
uint8_t* Kx;
^

Assembling: xtea-asm.S
avr-gcc -c -mmcu=atmega169p -I. -x assembler-with-cpp -DF_CPU=4000000 -Wa,-adhlns=obj/xtea-asm.lst,-gstabs,--listing-cont-lines=100 xtea-asm.S -o obj/xtea-asm.o

Compiling C: rtc.c
avr-gcc -c -mmcu=atmega169p -I. -gdwarf-2 -DF_CPU=4000000UL -DRFM=1 -DRFM_TUNING=1 -DRFM_FREQ=868 -DRFM_BAUD_RATE=9600 -DSECURITY_KEY_0=0x01 -DSECURITY_KEY_1=0x23 -DSECURITY_KEY_2=0x45 -DSECURITY_KEY_3=0x67 -DSECURITY_KEY_4=0x89 -DSECURITY_KEY_5=0x01 -DSECURITY_KEY_6=0x23 -DSECURITY_KEY_7=0x45 -DRFM_DEVICE_ADDRESS=10 -DRFM_WIRE_MARIOJTAG=1 -DMOTOR_COMPENSATE_BATTERY=1 -DREMOTE_SETTING_ONLY=0 -Os -mcall-prologues -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=obj/rtc.lst -std=gnu99 -ffreestanding -Wl,--relax -fdata-sections -MMD -MP -MF .dep/rtc.o.d rtc.c -o obj/rtc.o
In file included from rtc.c:3:0:
../common/rtc.c: In function 'RTC_timer_set':
../common/rtc.c:600:19: warning: 'next' may be used uninitialized in this function [-Wmaybe-uninitialized]
OCR2A = next;
^
../common/rtc.c: In function '__vector_4':
../common/rtc.c:694:19: warning: 'next' may be used uninitialized in this function [-Wmaybe-uninitialized]
OCR2A = next;
^

Compiling C: main.c
avr-gcc -c -mmcu=atmega169p -I. -gdwarf-2 -DF_CPU=4000000UL -DRFM=1 -DRFM_TUNING=1 -DRFM_FREQ=868 -DRFM_BAUD_RATE=9600 -DSECURITY_KEY_0=0x01 -DSECURITY_KEY_1=0x23 -DSECURITY_KEY_2=0x45 -DSECURITY_KEY_3=0x67 -DSECURITY_KEY_4=0x89 -DSECURITY_KEY_5=0x01 -DSECURITY_KEY_6=0x23 -DSECURITY_KEY_7=0x45 -DRFM_DEVICE_ADDRESS=10 -DRFM_WIRE_MARIOJTAG=1 -DMOTOR_COMPENSATE_BATTERY=1 -DREMOTE_SETTING_ONLY=0 -Os -mcall-prologues -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=obj/main.lst -std=gnu99 -ffreestanding -Wl,--relax -fdata-sections -MMD -MP -MF .dep/main.o.d main.c -o obj/main.o

Compiling C: keyboard.c
avr-gcc -c -mmcu=atmega169p -I. -gdwarf-2 -DF_CPU=4000000UL -DRFM=1 -DRFM_TUNING=1 -DRFM_FREQ=868 -DRFM_BAUD_RATE=9600 -DSECURITY_KEY_0=0x01 -DSECURITY_KEY_1=0x23 -DSECURITY_KEY_2=0x45 -DSECURITY_KEY_3=0x67 -DSECURITY_KEY_4=0x89 -DSECURITY_KEY_5=0x01 -DSECURITY_KEY_6=0x23 -DSECURITY_KEY_7=0x45 -DRFM_DEVICE_ADDRESS=10 -DRFM_WIRE_MARIOJTAG=1 -DMOTOR_COMPENSATE_BATTERY=1 -DREMOTE_SETTING_ONLY=0 -Os -mcall-prologues -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=obj/keyboard.lst -std=gnu99 -ffreestanding -Wl,--relax -fdata-sections -MMD -MP -MF .dep/keyboard.o.d keyboard.c -o obj/keyboard.o

Compiling C: adc.c
avr-gcc -c -mmcu=atmega169p -I. -gdwarf-2 -DF_CPU=4000000UL -DRFM=1 -DRFM_TUNING=1 -DRFM_FREQ=868 -DRFM_BAUD_RATE=9600 -DSECURITY_KEY_0=0x01 -DSECURITY_KEY_1=0x23 -DSECURITY_KEY_2=0x45 -DSECURITY_KEY_3=0x67 -DSECURITY_KEY_4=0x89 -DSECURITY_KEY_5=0x01 -DSECURITY_KEY_6=0x23 -DSECURITY_KEY_7=0x45 -DRFM_DEVICE_ADDRESS=10 -DRFM_WIRE_MARIOJTAG=1 -DMOTOR_COMPENSATE_BATTERY=1 -DREMOTE_SETTING_ONLY=0 -Os -mcall-prologues -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=obj/adc.lst -std=gnu99 -ffreestanding -Wl,--relax -fdata-sections -MMD -MP -MF .dep/adc.o.d adc.c -o obj/adc.o
adc.c: In function 'task_ADC':
adc.c:243:26: warning: 'ad' may be used uninitialized in this function [-Wmaybe-uninitialized]
dummy_adc=ad;
^

Compiling C: eeprom.c
avr-gcc -c -mmcu=atmega169p -I. -gdwarf-2 -DF_CPU=4000000UL -DRFM=1 -DRFM_TUNING=1 -DRFM_FREQ=868 -DRFM_BAUD_RATE=9600 -DSECURITY_KEY_0=0x01 -DSECURITY_KEY_1=0x23 -DSECURITY_KEY_2=0x45 -DSECURITY_KEY_3=0x67 -DSECURITY_KEY_4=0x89 -DSECURITY_KEY_5=0x01 -DSECURITY_KEY_6=0x23 -DSECURITY_KEY_7=0x45 -DRFM_DEVICE_ADDRESS=10 -DRFM_WIRE_MARIOJTAG=1 -DMOTOR_COMPENSATE_BATTERY=1 -DREMOTE_SETTING_ONLY=0 -Os -mcall-prologues -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=obj/eeprom.lst -std=gnu99 -ffreestanding -Wl,--relax -fdata-sections -MMD -MP -MF .dep/eeprom.o.d eeprom.c -o obj/eeprom.o

Compiling C: menu.c
avr-gcc -c -mmcu=atmega169p -I. -gdwarf-2 -DF_CPU=4000000UL -DRFM=1 -DRFM_TUNING=1 -DRFM_FREQ=868 -DRFM_BAUD_RATE=9600 -DSECURITY_KEY_0=0x01 -DSECURITY_KEY_1=0x23 -DSECURITY_KEY_2=0x45 -DSECURITY_KEY_3=0x67 -DSECURITY_KEY_4=0x89 -DSECURITY_KEY_5=0x01 -DSECURITY_KEY_6=0x23 -DSECURITY_KEY_7=0x45 -DRFM_DEVICE_ADDRESS=10 -DRFM_WIRE_MARIOJTAG=1 -DMOTOR_COMPENSATE_BATTERY=1 -DREMOTE_SETTING_ONLY=0 -Os -mcall-prologues -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=obj/menu.lst -std=gnu99 -ffreestanding -Wl,--relax -fdata-sections -MMD -MP -MF .dep/menu.o.d menu.c -o obj/menu.o
menu.c: In function 'menu_view':
menu.c:613:13: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
if (MOTOR_ManuCalibration==-1) LCD_PrintChar(LCD_CHAR_d,2,LCD_MODE_ON);
^
menu.c: At top level:
menu.c:475:13: warning: 'clr_show3' defined but not used [-Wunused-function]
static void clr_show3(uint8_t seg1, uint8_t seg2, uint8_t seg3) {
^

Compiling C: lcd.c
avr-gcc -c -mmcu=atmega169p -I. -gdwarf-2 -DF_CPU=4000000UL -DRFM=1 -DRFM_TUNING=1 -DRFM_FREQ=868 -DRFM_BAUD_RATE=9600 -DSECURITY_KEY_0=0x01 -DSECURITY_KEY_1=0x23 -DSECURITY_KEY_2=0x45 -DSECURITY_KEY_3=0x67 -DSECURITY_KEY_4=0x89 -DSECURITY_KEY_5=0x01 -DSECURITY_KEY_6=0x23 -DSECURITY_KEY_7=0x45 -DRFM_DEVICE_ADDRESS=10 -DRFM_WIRE_MARIOJTAG=1 -DMOTOR_COMPENSATE_BATTERY=1 -DREMOTE_SETTING_ONLY=0 -Os -mcall-prologues -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=obj/lcd.lst -std=gnu99 -ffreestanding -Wl,--relax -fdata-sections -MMD -MP -MF .dep/lcd.o.d lcd.c -o obj/lcd.o

Compiling C: rs232_485_hw.c
avr-gcc -c -mmcu=atmega169p -I. -gdwarf-2 -DF_CPU=4000000UL -DRFM=1 -DRFM_TUNING=1 -DRFM_FREQ=868 -DRFM_BAUD_RATE=9600 -DSECURITY_KEY_0=0x01 -DSECURITY_KEY_1=0x23 -DSECURITY_KEY_2=0x45 -DSECURITY_KEY_3=0x67 -DSECURITY_KEY_4=0x89 -DSECURITY_KEY_5=0x01 -DSECURITY_KEY_6=0x23 -DSECURITY_KEY_7=0x45 -DRFM_DEVICE_ADDRESS=10 -DRFM_WIRE_MARIOJTAG=1 -DMOTOR_COMPENSATE_BATTERY=1 -DREMOTE_SETTING_ONLY=0 -Os -mcall-prologues -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=obj/rs232_485_hw.lst -std=gnu99 -ffreestanding -Wl,--relax -fdata-sections -MMD -MP -MF .dep/rs232_485_hw.o.d rs232_485_hw.c -o obj/rs232_485_hw.o

Linking: hr20.elf
avr-gcc -mmcu=atmega169p -I. -gdwarf-2 -DF_CPU=4000000UL -DRFM=1 -DRFM_TUNING=1 -DRFM_FREQ=868 -DRFM_BAUD_RATE=9600 -DSECURITY_KEY_0=0x01 -DSECURITY_KEY_1=0x23 -DSECURITY_KEY_2=0x45 -DSECURITY_KEY_3=0x67 -DSECURITY_KEY_4=0x89 -DSECURITY_KEY_5=0x01 -DSECURITY_KEY_6=0x23 -DSECURITY_KEY_7=0x45 -DRFM_DEVICE_ADDRESS=10 -DRFM_WIRE_MARIOJTAG=1 -DMOTOR_COMPENSATE_BATTERY=1 -DREMOTE_SETTING_ONLY=0 -Os -mcall-prologues -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=obj/motor.o -std=gnu99 -ffreestanding -Wl,--relax -fdata-sections -MMD -MP -MF .dep/hr20.elf.d obj/motor.o obj/controller.o obj/watch.o obj/com.o obj/wireless.o obj/rfm.o obj/cmac.o obj/xtea-asm.o obj/rtc.o obj/main.o obj/keyboard.o obj/adc.o obj/eeprom.o obj/menu.o obj/lcd.o obj/rs232_485_hw.o --output hr20.elf -Wl,-Map=hr20.map,--cref -lm

Creating load file for Flash: hr20.hex
avr-objcopy -O ihex -R .eeprom -R .fuse hr20.elf hr20.hex

Creating load file for EEPROM: hr20.eep
avr-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" \
--change-section-lma .eeprom=0 --no-change-warnings -O ihex hr20.elf hr20.eep || exit 0

creating Binary for use with bootloader
avr-objcopy hr20.elf -S -R .eeprom -R .fuse -O binary hr20.bin

Creating Extended Listing: hr20.lss
avr-objdump -h -S -z hr20.elf > hr20.lss
rm -f hr20.txt
avr-size --mcu=atmega169p --format=avr hr20.elf >> hr20.txt

Size after:
AVR Memory Usage
----------------
Device: atmega169p

Program: 16026 bytes (97.8% Full)
(.text + .data + .bootloader)

Data: 693 bytes (67.7% Full)
(.data + .bss + .noinit)

EEPROM: 408 bytes (79.7% Full)
(.eeprom)



-------- end --------










Compile a master and I get errors:

# ./compile_arduino.sh

-------- begin --------

Cleaning project:
rm -f master.hex
rm -f master.eep
rm -f master.bin
rm -f master.cof
rm -f master.elf
rm -f master.map
rm -f master.sym
rm -f master.lss
rm -f master.txt
rm -f obj/main.o obj/rs232_485_hw.o obj/com.o obj/rfm.o obj/rtc.o obj/cmac.o obj/eeprom.o obj/wireless.o obj/queue.o
rm -f obj/main.lst obj/rs232_485_hw.lst obj/com.lst obj/rfm.lst obj/rtc.lst obj/cmac.lst obj/eeprom.lst obj/wireless.lst obj/queue.lst
rm -f obj/xtea-asm.o
rm -f obj/xtea-asm.lst
rm -f main.s rs232_485_hw.s com.s rfm.s rtc.s cmac.s eeprom.s wireless.s queue.s
rm -f main.d rs232_485_hw.d com.d rfm.d rtc.d cmac.d eeprom.d wireless.d queue.d
rm -f main.i rs232_485_hw.i com.i rfm.i rtc.i cmac.i eeprom.i wireless.i queue.i
rm -rf .dep
-------- end --------


-------- begin --------
avr-gcc (GCC) 4.9.2 20141224 (prerelease)
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


Compiling C: main.c
avr-gcc -c -mmcu=atmega328p -I. -gdwarf-2 -DF_CPU=10000000UL -DNANODE=0 -DJEENODE=0 -Os -mcall-prologues -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=obj/main.lst -std=gnu99 -ffreestanding -fdata-sections -Wundef -MMD -MP -MF .dep/main.o.d -DMCU=atmega328p -DATMEGA32_DEV_BOARD=0 -DRFM_TUNING=1 -DRFM_FREQ=868 -DRFM_BAUD_RATE=9600 -DSECURITY_KEY_0=0x01 -DSECURITY_KEY_1=0x23 -DSECURITY_KEY_2=0x45 -DSECURITY_KEY_3=0x67 -DSECURITY_KEY_4=0x89 -DSECURITY_KEY_5=0x01 -DSECURITY_KEY_6=0x23 -DSECURITY_KEY_7=0x45 main.c -o obj/main.o
main.c:70:2: warning: #warning task variable manipulation is not protected to interrupt, fix it [-Wcpp]
#warning task variable manipulation is not protected to interrupt, fix it
^
In file included from eeprom.h:40:0,
from main.c:50:
main.c: In function 'main':
rfm_config.h:133:34: error: 'GICR' undeclared (first use in this function)
#define RFM_INT_EN_NOCALL() (GICR |= _BV(INT2))
^
rfm_config.h:137:23: note: in expansion of macro 'RFM_INT_EN_NOCALL'
#define RFM_INT_EN() (RFM_INT_EN_NOCALL(), RFM_INT_vect())
^
main.c:92:5: note: in expansion of macro 'RFM_INT_EN'
RFM_INT_EN();
^
rfm_config.h:133:34: note: each undeclared identifier is reported only once for each function it appears in
#define RFM_INT_EN_NOCALL() (GICR |= _BV(INT2))
^
rfm_config.h:137:23: note: in expansion of macro 'RFM_INT_EN_NOCALL'
#define RFM_INT_EN() (RFM_INT_EN_NOCALL(), RFM_INT_vect())
^
main.c:92:5: note: in expansion of macro 'RFM_INT_EN'
RFM_INT_EN();
^
In file included from /usr/avr/include/avr/io.h:99:0,
from main.c:37:
rfm_config.h:133:46: error: 'INT2' undeclared (first use in this function)
#define RFM_INT_EN_NOCALL() (GICR |= _BV(INT2))
^
rfm_config.h:137:23: note: in expansion of macro 'RFM_INT_EN_NOCALL'
#define RFM_INT_EN() (RFM_INT_EN_NOCALL(), RFM_INT_vect())
^
main.c:92:5: note: in expansion of macro 'RFM_INT_EN'
RFM_INT_EN();
^
In file included from eeprom.h:40:0,
from main.c:50:
rfm_config.h:137:42: warning: left-hand operand of comma expression has no effect [-Wunused-value]
#define RFM_INT_EN() (RFM_INT_EN_NOCALL(), RFM_INT_vect())
^
main.c:92:5: note: in expansion of macro 'RFM_INT_EN'
RFM_INT_EN();
^
main.c: In function 'init':
main.c:257:2: error: 'DDRA' undeclared (first use in this function)
DDRA = _BV(PA2); //Green LED for Sync
^
In file included from /usr/avr/include/avr/io.h:99:0,
from main.c:37:
main.c:257:13: error: 'PA2' undeclared (first use in this function)
DDRA = _BV(PA2); //Green LED for Sync
^
main.c:261:5: error: 'PORTA' undeclared (first use in this function)
PORTA = 0xff;
^
main.c:289:7: error: 'MCUCSR' undeclared (first use in this function)
MCUCSR |= _BV(ISC2); // rising edge interrupt
^
In file included from /usr/avr/include/avr/io.h:99:0,
from main.c:37:
main.c:289:21: error: 'ISC2' undeclared (first use in this function)
MCUCSR |= _BV(ISC2); // rising edge interrupt
^
Makefile:606: polecenia dla obiektu 'obj/main.o' nie powiodły się
make: *** [obj/main.o] Błąd 1







I append "nanode=1" at the beginning of "Makefile"

# ./compile_arduino.sh

-------- begin --------

Cleaning project:
rm -f master.hex
rm -f master.eep
rm -f master.bin
rm -f master.cof
rm -f master.elf
rm -f master.map
rm -f master.sym
rm -f master.lss
rm -f master.txt
rm -f obj/main.o obj/rs232_485_hw.o obj/com.o obj/rfm.o obj/rtc.o obj/cmac.o obj/eeprom.o obj/wireless.o obj/queue.o
rm -f obj/main.lst obj/rs232_485_hw.lst obj/com.lst obj/rfm.lst obj/rtc.lst obj/cmac.lst obj/eeprom.lst obj/wireless.lst obj/queue.lst
rm -f obj/xtea-asm.o
rm -f obj/xtea-asm.lst
rm -f main.s rs232_485_hw.s com.s rfm.s rtc.s cmac.s eeprom.s wireless.s queue.s
rm -f main.d rs232_485_hw.d com.d rfm.d rtc.d cmac.d eeprom.d wireless.d queue.d
rm -f main.i rs232_485_hw.i com.i rfm.i rtc.i cmac.i eeprom.i wireless.i queue.i
rm -rf .dep
-------- end --------


-------- begin --------
avr-gcc (GCC) 4.9.2 20141224 (prerelease)
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


Compiling C: main.c
avr-gcc -c -mmcu=atmega328p -I. -gdwarf-2 -DF_CPU=16000000UL -DNANODE=1 -DJEENODE=0 -Os -mcall-prologues -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=obj/main.lst -std=gnu99 -ffreestanding -fdata-sections -Wundef -MMD -MP -MF .dep/main.o.d -DMCU=atmega328p -DATMEGA32_DEV_BOARD=0 -DRFM_TUNING=1 -DRFM_FREQ=868 -DRFM_BAUD_RATE=9600 -DSECURITY_KEY_0=0x01 -DSECURITY_KEY_1=0x23 -DSECURITY_KEY_2=0x45 -DSECURITY_KEY_3=0x67 -DSECURITY_KEY_4=0x89 -DSECURITY_KEY_5=0x01 -DSECURITY_KEY_6=0x23 -DSECURITY_KEY_7=0x45 main.c -o obj/main.o
main.c:70:2: warning: #warning task variable manipulation is not protected to interrupt, fix it [-Wcpp]
#warning task variable manipulation is not protected to interrupt, fix it
^

Compiling C: rs232_485_hw.c
avr-gcc -c -mmcu=atmega328p -I. -gdwarf-2 -DF_CPU=16000000UL -DNANODE=1 -DJEENODE=0 -Os -mcall-prologues -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=obj/rs232_485_hw.lst -std=gnu99 -ffreestanding -fdata-sections -Wundef -MMD -MP -MF .dep/rs232_485_hw.o.d -DMCU=atmega328p -DATMEGA32_DEV_BOARD=0 -DRFM_TUNING=1 -DRFM_FREQ=868 -DRFM_BAUD_RATE=9600 -DSECURITY_KEY_0=0x01 -DSECURITY_KEY_1=0x23 -DSECURITY_KEY_2=0x45 -DSECURITY_KEY_3=0x67 -DSECURITY_KEY_4=0x89 -DSECURITY_KEY_5=0x01 -DSECURITY_KEY_6=0x23 -DSECURITY_KEY_7=0x45 rs232_485_hw.c -o obj/rs232_485_hw.o

Compiling C: com.c
avr-gcc -c -mmcu=atmega328p -I. -gdwarf-2 -DF_CPU=16000000UL -DNANODE=1 -DJEENODE=0 -Os -mcall-prologues -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=obj/com.lst -std=gnu99 -ffreestanding -fdata-sections -Wundef -MMD -MP -MF .dep/com.o.d -DMCU=atmega328p -DATMEGA32_DEV_BOARD=0 -DRFM_TUNING=1 -DRFM_FREQ=868 -DRFM_BAUD_RATE=9600 -DSECURITY_KEY_0=0x01 -DSECURITY_KEY_1=0x23 -DSECURITY_KEY_2=0x45 -DSECURITY_KEY_3=0x67 -DSECURITY_KEY_4=0x89 -DSECURITY_KEY_5=0x01 -DSECURITY_KEY_6=0x23 -DSECURITY_KEY_7=0x45 com.c -o obj/com.o

Compiling C: rfm.c
avr-gcc -c -mmcu=atmega328p -I. -gdwarf-2 -DF_CPU=16000000UL -DNANODE=1 -DJEENODE=0 -Os -mcall-prologues -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=obj/rfm.lst -std=gnu99 -ffreestanding -fdata-sections -Wundef -MMD -MP -MF .dep/rfm.o.d -DMCU=atmega328p -DATMEGA32_DEV_BOARD=0 -DRFM_TUNING=1 -DRFM_FREQ=868 -DRFM_BAUD_RATE=9600 -DSECURITY_KEY_0=0x01 -DSECURITY_KEY_1=0x23 -DSECURITY_KEY_2=0x45 -DSECURITY_KEY_3=0x67 -DSECURITY_KEY_4=0x89 -DSECURITY_KEY_5=0x01 -DSECURITY_KEY_6=0x23 -DSECURITY_KEY_7=0x45 rfm.c -o obj/rfm.o
In file included from ../common/rfm.c:39:0,
from rfm.c:3:
../common/rfm.c: In function '__vector_2':
../common/../common/rfm.h:320:55: warning: value computed is not used [-Wunused-value]
#define RFM_READ_FIFO() (RFM_SPI_16(0xB000) & 0xFF)
^
../common/rfm.c:278:13: note: in expansion of macro 'RFM_READ_FIFO'
RFM_READ_FIFO();
^
In file included from rfm.c:3:0:
../common/rfm.c: In function 'rfm_spi16':
../common/rfm.c:81:11: warning: 'ret' may be used uninitialized in this function [-Wmaybe-uninitialized]
ret <<= 1;
^

Compiling C: rtc.c
avr-gcc -c -mmcu=atmega328p -I. -gdwarf-2 -DF_CPU=16000000UL -DNANODE=1 -DJEENODE=0 -Os -mcall-prologues -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=obj/rtc.lst -std=gnu99 -ffreestanding -fdata-sections -Wundef -MMD -MP -MF .dep/rtc.o.d -DMCU=atmega328p -DATMEGA32_DEV_BOARD=0 -DRFM_TUNING=1 -DRFM_FREQ=868 -DRFM_BAUD_RATE=9600 -DSECURITY_KEY_0=0x01 -DSECURITY_KEY_1=0x23 -DSECURITY_KEY_2=0x45 -DSECURITY_KEY_3=0x67 -DSECURITY_KEY_4=0x89 -DSECURITY_KEY_5=0x01 -DSECURITY_KEY_6=0x23 -DSECURITY_KEY_7=0x45 rtc.c -o obj/rtc.o
In file included from rtc.c:3:0:
../common/rtc.c: In function 'RTC_timer_set':
../common/rtc.c:596:26: warning: 'next' may be used uninitialized in this function [-Wmaybe-uninitialized]
RTC_next_compare = next;
^
../common/rtc.c: In function '__vector_11':
../common/rtc.c:734:30: warning: 'next' may be used uninitialized in this function [-Wmaybe-uninitialized]
RTC_next_compare = next;
^

Compiling C: cmac.c
avr-gcc -c -mmcu=atmega328p -I. -gdwarf-2 -DF_CPU=16000000UL -DNANODE=1 -DJEENODE=0 -Os -mcall-prologues -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=obj/cmac.lst -std=gnu99 -ffreestanding -fdata-sections -Wundef -MMD -MP -MF .dep/cmac.o.d -DMCU=atmega328p -DATMEGA32_DEV_BOARD=0 -DRFM_TUNING=1 -DRFM_FREQ=868 -DRFM_BAUD_RATE=9600 -DSECURITY_KEY_0=0x01 -DSECURITY_KEY_1=0x23 -DSECURITY_KEY_2=0x45 -DSECURITY_KEY_3=0x67 -DSECURITY_KEY_4=0x89 -DSECURITY_KEY_5=0x01 -DSECURITY_KEY_6=0x23 -DSECURITY_KEY_7=0x45 cmac.c -o obj/cmac.o
In file included from cmac.c:3:0:
../common/cmac.c: In function 'cmac_calc':
../common/cmac.c:70:18: warning: 'Kx' may be used uninitialized in this function [-Wmaybe-uninitialized]
uint8_t* Kx;
^

Compiling C: eeprom.c
avr-gcc -c -mmcu=atmega328p -I. -gdwarf-2 -DF_CPU=16000000UL -DNANODE=1 -DJEENODE=0 -Os -mcall-prologues -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=obj/eeprom.lst -std=gnu99 -ffreestanding -fdata-sections -Wundef -MMD -MP -MF .dep/eeprom.o.d -DMCU=atmega328p -DATMEGA32_DEV_BOARD=0 -DRFM_TUNING=1 -DRFM_FREQ=868 -DRFM_BAUD_RATE=9600 -DSECURITY_KEY_0=0x01 -DSECURITY_KEY_1=0x23 -DSECURITY_KEY_2=0x45 -DSECURITY_KEY_3=0x67 -DSECURITY_KEY_4=0x89 -DSECURITY_KEY_5=0x01 -DSECURITY_KEY_6=0x23 -DSECURITY_KEY_7=0x45 eeprom.c -o obj/eeprom.o

Compiling C: wireless.c
avr-gcc -c -mmcu=atmega328p -I. -gdwarf-2 -DF_CPU=16000000UL -DNANODE=1 -DJEENODE=0 -Os -mcall-prologues -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=obj/wireless.lst -std=gnu99 -ffreestanding -fdata-sections -Wundef -MMD -MP -MF .dep/wireless.o.d -DMCU=atmega328p -DATMEGA32_DEV_BOARD=0 -DRFM_TUNING=1 -DRFM_FREQ=868 -DRFM_BAUD_RATE=9600 -DSECURITY_KEY_0=0x01 -DSECURITY_KEY_1=0x23 -DSECURITY_KEY_2=0x45 -DSECURITY_KEY_3=0x67 -DSECURITY_KEY_4=0x89 -DSECURITY_KEY_5=0x01 -DSECURITY_KEY_6=0x23 -DSECURITY_KEY_7=0x45 wireless.c -o obj/wireless.o

Compiling C: queue.c
avr-gcc -c -mmcu=atmega328p -I. -gdwarf-2 -DF_CPU=16000000UL -DNANODE=1 -DJEENODE=0 -Os -mcall-prologues -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=obj/queue.lst -std=gnu99 -ffreestanding -fdata-sections -Wundef -MMD -MP -MF .dep/queue.o.d -DMCU=atmega328p -DATMEGA32_DEV_BOARD=0 -DRFM_TUNING=1 -DRFM_FREQ=868 -DRFM_BAUD_RATE=9600 -DSECURITY_KEY_0=0x01 -DSECURITY_KEY_1=0x23 -DSECURITY_KEY_2=0x45 -DSECURITY_KEY_3=0x67 -DSECURITY_KEY_4=0x89 -DSECURITY_KEY_5=0x01 -DSECURITY_KEY_6=0x23 -DSECURITY_KEY_7=0x45 queue.c -o obj/queue.o

Assembling: xtea-asm.S
avr-gcc -c -mmcu=atmega328p -I. -x assembler-with-cpp -DF_CPU=16000000 -Wa,-adhlns=obj/xtea-asm.lst,-gstabs,--listing-cont-lines=100 -DMCU=atmega328p -DATMEGA32_DEV_BOARD=0 -DRFM_TUNING=1 -DRFM_FREQ=868 -DRFM_BAUD_RATE=9600 -DSECURITY_KEY_0=0x01 -DSECURITY_KEY_1=0x23 -DSECURITY_KEY_2=0x45 -DSECURITY_KEY_3=0x67 -DSECURITY_KEY_4=0x89 -DSECURITY_KEY_5=0x01 -DSECURITY_KEY_6=0x23 -DSECURITY_KEY_7=0x45 xtea-asm.S -o obj/xtea-asm.o

Linking: master.elf
avr-gcc -mmcu=atmega328p -I. -gdwarf-2 -DF_CPU=16000000UL -DNANODE=1 -DJEENODE=0 -Os -mcall-prologues -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=obj/main.o -std=gnu99 -ffreestanding -fdata-sections -Wundef -MMD -MP -MF .dep/master.elf.d -DMCU=atmega328p -DATMEGA32_DEV_BOARD=0 -DRFM_TUNING=1 -DRFM_FREQ=868 -DRFM_BAUD_RATE=9600 -DSECURITY_KEY_0=0x01 -DSECURITY_KEY_1=0x23 -DSECURITY_KEY_2=0x45 -DSECURITY_KEY_3=0x67 -DSECURITY_KEY_4=0x89 -DSECURITY_KEY_5=0x01 -DSECURITY_KEY_6=0x23 -DSECURITY_KEY_7=0x45 obj/main.o obj/rs232_485_hw.o obj/com.o obj/rfm.o obj/rtc.o obj/cmac.o obj/eeprom.o obj/wireless.o obj/queue.o obj/xtea-asm.o --output master.elf -Wl,-Map=master.map,--cref -lm

Creating load file for Flash: master.hex
avr-objcopy -O ihex -R .eeprom master.elf master.hex

Creating load file for EEPROM: master.eep
avr-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" \
--change-section-lma .eeprom=0 --no-change-warnings -O ihex master.elf master.eep || exit 0

creating Binary for use with bootloader
avr-objcopy master.elf -S -R .eeprom -R .fuse -O binary master.bin

Creating Extended Listing: master.lss
avr-objdump -h -S -z master.elf > master.lss
rm -f master.txt
avr-size --mcu=atmega328p --format=avr master.elf >> master.txt

Size after:
AVR Memory Usage
----------------
Device: atmega328p

Program: 7504 bytes (22.9% Full)
(.text + .data + .bootloader)

Data: 1191 bytes (58.2% Full)
(.data + .bss + .noinit)

EEPROM: 104 bytes (10.2% Full)
(.eeprom)



-------- end --------





I flash HR20 using JTAG (like http://allegro.pl/show_item.php?item=4937235781)

I flash in AVR Studio 4 because avrdude causes errors "jtagmkI_read_byte(): timeout/error communicating with programmer (resp Ç)"
In AVR studio 4 there are no errors.

I flash my master Arduino NANO clone (like http://allegro.pl/arduino-nano-v3-0-i4970846956.html) in avrdude using USBASP. No errors.

I get E4 on HR20, and in serial console i get:

N0?
RTC?
(01)?
(02)?
(03)?
(04)?
(05)?
(06)?
(07)?
(08)?
(09)?
(0a)?
(0b)?
(0c)?
(0d)?
(0e)?
(0f)?
(10)?
(11)?
(12)?
(13)?
(14)?
(15)?
(16)?
(17)?
(18)?
(19)?
(1a)?
(1b)?
(1c)?
(1d)?
N1?


Why do they still can not connect?
I connected the HR20 and master as described on https://piontecsmumble.wordpress.com/


I'm sorry for my very very bad English.

Kind regards from Poland.
Przemek

Przemysław Biernat

unread,
Jan 27, 2015, 4:44:56 AM1/27/15
to openhr20-d...@googlegroups.com, tomas...@altap.cz
rfm12b can run on 5v in the arduino?

Tomas Kopal

unread,
Jan 27, 2015, 5:01:52 AM1/27/15
to openhr20-d...@googlegroups.com
On 27/01/15 10:44, Przemysław Biernat wrote:
> rfm12b can run on 5v in the arduino?

According to RFM12B datasheet, the maximum allowed supply voltage is 6V,
so you should not fry it. Also, the logic levels are defined based on
power supply voltage, so they should be ok for 5V operation.

However, recommended supply voltage is 2.2 - 3.8V, so you are operating
outside of these, so my guess is it's ok to connect it for testing, but
I would not use it for normal long-term operation.

Tomas

Tomas Kopal

unread,
Jan 27, 2015, 5:26:23 AM1/27/15
to openhr20-d...@googlegroups.com
I haven't looked too closely yet for the lack of time, sorry, but on the
first sight, everything seems to be OK.

Few more ideas:
- Check your RFM12B are 868MHz variant, as that's what is your code
expecting, according to the compilation log you sent.
- Try setting the time on the master via serial Hhhmmsscc where hh, mm,
ss, cc are hours, mintes, seconds, and fraction of a second, in hex. So
e.g. H0c000000 should give you OK and set the time to 12:00:00.00.
Similarly for date: Yyymmdd, e.g. Y0F0101 will set 1.1.2015. Without
correct date/time, the master does not really communicate. The php
frontend will do this for you when you start it.

Tomas

Przemysław Biernat

unread,
Jan 27, 2015, 4:47:57 PM1/27/15
to openhr20-d...@googlegroups.com, tomas...@altap.cz
W dniu wtorek, 27 stycznia 2015 11:26:23 UTC+1 użytkownik Tomas Kopal napisał:
> - Check your RFM12B are 868MHz variant, as that's what is your code
> expecting, according to the compilation log you sent.

All my RFM12b modules is 868MHz

> - Try setting the time on the master via serial Hhhmmsscc where hh, mm,
> ss, cc are hours, mintes, seconds, and fraction of a second, in hex. So
> e.g. H0c000000 should give you OK and set the time to 12:00:00.00.
> Similarly for date: Yyymmdd, e.g. Y0F0101 will set 1.1.2015. Without
> correct date/time, the master does not really communicate. The php
> frontend will do this for you when you start it.

I run daemon.php.
Unfortunately, we still did not work.
Here is the log:

< RTC?
H162a3b63
Y0f011b
< (01)?
< OK
< OK
< d2 27.01.15 22:43:00
< RTC?
H162b0001
Y0f011b
< (01)?
< OK
< OK
O0000
< OK
< d2 27.01.15 22:43:30

Tomas Kopal

unread,
Jan 28, 2015, 4:01:38 AM1/28/15
to openhr20-d...@googlegroups.com

Hmm, sorry, I run out of ideas. Maybe someone else will have some?

I think it would be great if you could find a way to get access to logic
analyzer and inspected the SPI communication between the MCU and the RFM
module (in both master and regualtor) to check it's really working and
it's on the right wires. I would also try the cheap RTL-based TV dongle
as wireless spectrum analyzer, as I suggested before, to check if you
are transmitting something or not.
You can also try adding some debugging code, e.g. to check if there is
any packet received and discarded for some reason, etc.

Other than that, I can't help, sorry...

Tomas

Przemysław Biernat

unread,
Jan 28, 2015, 4:15:21 AM1/28/15
to openhr20-d...@googlegroups.com, tomas...@altap.cz
If you can, please you check the connections.

HR20:
https://piontecsmumble.files.wordpress.com/2013/03/rfm12_mounted_internally_1.jpg?w=640&h=824

https://piontecsmumble.files.wordpress.com/2013/03/rfm12_mounted_internally_2.jpg?w=640&h=894


Master (Arduino nano):
arduino Digital 10 to Slave Select (nSEL)
arduino Digital 11 to SPI shared MOSI (Master Output, Slave Input; SDI)
arduino Digital 12 to SPI shared MISO (Master Input, Slave Output; SDO)
arduino Digital 13 to SPI shared Serial Clock (SCK)
arduino Digital 3 to arduino Digital 12

https://piontecsmumble.files.wordpress.com/2013/03/arduino_master.jpg?w=640&h=441

Przemysław Biernat

unread,
Feb 9, 2015, 7:18:57 AM2/9/15
to openhr20-d...@googlegroups.com, tomas...@altap.cz
In a simple program written in the Arduino IDE all my RFM12b modules work.
I can see signal in my DVBT - SDR (RTL chip) dongle.

Unfortunately I do not see OpenHR master signal.

You are able to send me the correct compiled HEX and EEP files?
HR20 - mariojtag, 868MHz.
master - nanode, 328p, 16Mhz.

ToHei

unread,
Jan 12, 2016, 11:21:14 AM1/12/16
to OpenHR20 Development, tomas...@altap.cz
Hello Przemysław Biernat,
I have the same problem. Did you solve the Problem?

Wojciech Kopyciak

unread,
Jan 16, 2016, 10:38:00 AM1/16/16
to OpenHR20 Development, tomas...@altap.cz
Same problem here. All compiled for 433MHz with standard other config values, devices programmed with no errors (HR20 and arduino@mega328p) and there is no transmission at all. Sometimes I got ERRxxx message on daemon.php and that's it.

Any idea what to check? Can anybody compile master and hr20 for 433MHz and publish somewhere? What are yours fusebits for atmega328p master?

Tomas Kopal

unread,
Jan 22, 2016, 9:32:53 AM1/22/16
to openhr20-d...@googlegroups.com
How did you flash EEPROM on the arduino master? As far as I know (and I
spent some time resolving the same problem :-) ), the bootloader in
arduino is not able to flash EEPROM, just code.
Without valid EEPROM, there are no encryption keys, so connection won't
be possible. I believe (no time to check right now, sorry) there is a
way to upload/download EEPROM contents via serial, so you can
check/update manually. Or you can 'hack' the code to initialize the
EEPROM to correct values, run this software and then re-flash the
correct code (without erasing EEPROM).

Other than that, no ideas, sorry.

Regards

Tomas

Wojciech Kopyciak

unread,
Jan 23, 2016, 11:52:09 AM1/23/16
to OpenHR20 Development, Tomas...@altap.cz
It was also my concern that there is something wrong with EEPROM data (encryption key) so I flashed it manually (usbasp), read data from EEPROM and verified it manually - it looks to be correct. And I am not using arduino bootloader - just hardware :)
Issue still exists...

Malte Pöggel

unread,
Nov 28, 2017, 12:15:36 PM11/28/17
to OpenHR20 Development
I know this thread is a bit old, but i had exactly the same issue. I've spent 3 days debugging...

The EEPROM data is written correctly on both sides. I also double checked every connection to the RFM, had a look with a oscilloscope. The SPI signals were looking good. After that i added resistors as 5V -> 3,3V voltage divider to the SPI lines from the Arduino board. Still no success. I wired a second Arduino master and used the LowPowerLab RFM12 library to transfer data between both Boards, which worked without any problems. I compared and modified different initialization parameters of both implementations which did not change anything.

After that i started to play with different AVR-GCC versions and suddenly the HR20 received Sync packets. Time was set and E4 gone. Later i realized that i did use the makefile instead of the compile scripts which made the difference. So:

A) Both scripts override the crypto key to 0123456789012345, while the makefile uses 0123456789abcdef. If you compile your HR20 using the makefile and use the script for your Arduino this will result in a non working communication.

B) One of the scripts overrides the default baudrate. So if you are using the scripts this could never ever work!

I fixed everything and sent a pull request. The patch is now included in the official Github repository.

It seems that there is still an issue with the Arduino because my master did not receive packets sent from the HR20's. Might be a timing problem with the FIFO or 16MHz clock. I received my PCBs for the original master (which is running on 10MHz from clock from the RFM), assembled one of them and it is working for a few days now.

Newer RFM12B-S2P with a SMD crystal are a few hundred Hz off. It seems they need a load capacitance of 15-15,5pF instead of 12pF for the HC49U-S Xtal. Just change the macro used in common/rfm.c from RFM_CONFIG_X_12_0pf to RFM_CONFIG_X_15_0pf and check with a frequency counter if available.

If you still need to debug: You may enable DEBUG_DUMP_RFM in debug.h and maybe COM_RS232 in config.h of the HR20 code.

Best regards,
Malte

Reply all
Reply to author
Forward
0 new messages