HM-LC-Sw1PBU-FM alternative firmware

yaourt -S hmland perl-switch

update HMUSB Firmware:

wget http://git.zerfleddert.de/hmcfgusb/firmware/hmusbif.03c7.enc /opt/hmland/flash-hmcfgusb hmusbif.03c7.enc http://git.zerfleddert.de/hmcfgusb/firmware/hmusbif.03c7.enc

build bootloader:

git clone 'https://github.com/kc-GitHub/Asksin_OTA_Bootloader' 
cd Asksin_OTA_Bootloader/ 
vi devices/HM-LC-Sw1PBU-FM.h -> HM_ID & HM_SERIAL (from QR Code on device) 
make clean HM_LC_Sw1PBU_FM_8k

ports solder connect to rasberian:
Raspberry PIN | Beschreibung | HM-LC-Sw1PBU-FM
Pin #17 | 3,3V | MP2
Pin #19 | MOSI | MP4
Pin #21 | MISO | MP5
Pin #23 | SCLK | MP6
Pin #24 | Reset | MP3
Pin #25 | GND | MP15

build and install avrdude (6.1-1) with:

./configure --enable-linuxgpio=yes

on raspberry and edit /etc/avrdude.conf:

programmer id = desc = "Use the Linux sysfs interface to bitbang GPIO lines"; type = "linuxgpio"; reset = 8; sck = 11; mosi = 10; miso = 9; ;

/boot/cmdline.txt remove:

console=ttyAMA0,115200 and console=tty1 and kgdboc=…

fuses:

avrdude -p m644 -P linuxgpio -c linuxgpio -U lfuse:w:0xFD:m -U hfuse:w:0xD8:m -U lock:w:0x3F:m

flash bootloader:

avrdude -p m644 -P linuxgpio -c linuxgpio -V -U flash:w:Bootloader-AskSin-OTA-HM_LC_Sw1PBU_FM_8k.hex

build firmware:

cd ~/sketchbook/hardware
git clone  https://github.com/jabdoa2/jabduino.git
cd ~/sketchbook 
git clone https://github.com/jabdoa2/Asksin_HM_LC_Sw1PBU_FM/trunk Asksin_HM_LC_Sw1PBU_FM 
mv Asksin_HM_LC_Sw1PBU_FM/trunk/* Asksin_HM_LC_Sw1PBU_FM/

arduino ->  Board: Jabduino ATMega644
Sketch: Asksin_HM_LC_Sw1PBU_FM
Config: Register.h: HMID & Serial

also:

#define firstLoad

reg.ch_0.pairCentral[0] = 0xCC; reg.ch_0.pairCentral[1] = 0xCC; reg.ch_0.pairCentral[2] = 0xCC;
srec_cat Asksin_HM_LC_Sw1PBU_FM.cpp.hex -intel -fill 0xFF 0x0000 0xDFFE -Cyclic_Redundancy_Check_16_Little_Endian 0xDFFE -o /tmp/payload.bin -binary ~/src/Asksin_OTA_Bootloader/bin2eq3.php /tmp/payload.bin /tmp/payload.eq3 
systemctl stop hmland

maybe usb probs, then: /boot/cmdline.txt add dwc_otg.speed=1 and reboot

until /opt/hmcfgusb/flash-ota -f /tmp/payload.eq3 -s LEQ"$HM_SERIAL" ; do true;done

cp Asksin_HM_LC_Sw1PBU_FM/99_Asksin_HM_LC_Sw1PBU_FM_CustomFW.pm /opt/fhem/FHEM/

reboot fhem

activate fhem pairing:

set HMLAN1 hmPairForSec 600

press config button for 5 sec

set regset paircentral xxxxxx

Bootloader OTA Update(?):

php contrib\hex2eq3.php --inFile Bootloader-AskSin-OTA-HM_LC_Sw1PBU_FM_8k.hex --outFile Bootloader-AskSin-OTA-HM_LC_Sw1PBU_FM_8k.eq3 --spmPageSize 256 --hexEndAddress 0xDFFE --outFormat eq3 --markAsBootloaderUpdate --withCrcCheck --pathTo-srec_cat e:\programme\srecord-1.64-win32\srec_cat.exe

see also:
https://adke.org/?p=317