r-map / rmap

rete monitoraggio ambientale partecipativo documentation at https://doc.rmap.cc
https://rmap.cc
52 stars 43 forks source link

firmware: digitecoboot seems to work from SDcard the first time only #373

Closed pat1 closed 2 years ago

pat1 commented 2 years ago

digitecoboot compiled with:

~/.platformio/packages/toolchain-atmelavr/bin/avr-gcc --version
avr-gcc (GCC) 7.3.0

the first time the firmware is loaded se secondos the firmware is ignored

and after loading firmware from serial I get a lot of:

Uploading .pio/build/1284p16m/firmware.hex
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x23
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x31
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x39
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x37
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x30
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x2d
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x30
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x30
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x2d
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x30

avrdude done.  Thank you.
pat1 commented 2 years ago

sembra che i messaggi

not in sync

siano prodotti quando è presente una SDcard con un firmware che il bootloader non riesce a leggere.

Per il resto pare che il firmware sia caricato correttamente solo con una SDcard appena formattata e con il file FIRMWARE.BIN appena copiato senza altri maneggiamenti.

pat1 commented 2 years ago

Mi pare che il funzionamento sia abbastanza casuale e non riesco a identificare una corretta procedura per garantire l'upload del firmware.

pat1 commented 2 years ago

è comunque disponibile: https://github.com/r-map/rmap/tree/master/platformio/stima_v3/SdFormatter per garantire una corretta formattazione dell'SDcard

pat1 commented 2 years ago

il problema pare sia presente solo per il microcontrollore 1284

pat1 commented 2 years ago

https://forum.arduino.cc/t/avr_boot/513885

conclusion therefore is: either get an SD card reader with no quad buffer gate, if you want to use any new SD card
or
get an old 2GB max SD card, if you want to use any SD card reader
pat1 commented 2 years ago

other project for fat16 only: https://github.com/prunkdump/optiboot-sdcard

pat1 commented 2 years ago

Added a retry to read SDcard. The firmware size now is 3896 bytes

AVR Memory Usage

Device: Unknown

Program: 3896 bytes (.text + .data + .bootloader)

Data: 319 bytes (.data + .bss + .noinit)