X-Git-Url: http://git.droids-corp.org/?p=aversive.git;a=blobdiff_plain;f=config%2Fprog_fuses.sh;h=1719764b602044d342341a0696336b57fe778f51;hp=60bd6515d746c415dbb9bf29af05e622caef93b6;hb=HEAD;hpb=39dc0cbf31e824e4f1147a9f6a33731af7c4bdcb diff --git a/config/prog_fuses.sh b/config/prog_fuses.sh index 60bd651..1719764 100755 --- a/config/prog_fuses.sh +++ b/config/prog_fuses.sh @@ -139,12 +139,13 @@ CANNOT_READ=0 for f in ${FUSE_LIST} do rm -f $f 2> /dev/null - echo 0x00 > ${f}_new - ${AVRDUDE} ${DELAY} -p ${MCU} -P `echo ${AVRDUDE_PORT} | sed 's,",,g'` \ - -c ${AVRDUDE_PROGRAMMER} -U ${f}:r:${f}:i + echo 0xff > ${f}_new # default for each bit is 1 (unprogrammed) + ${AVRDUDE} ${DELAY} -p ${MCU} -P `echo ${AVRDUDE_PORT} | \ + sed 's,",,g'` -c ${AVRDUDE_PROGRAMMER} -U ${f}:r:${f}:i if [ ! -f $f ]; then CANNOT_READ=1 fi + sleep 1 done echo @@ -210,10 +211,11 @@ do 1) NEW_VAL=$((1 << $BIT | `cat ${FUSE}_new`)) printf "0x%x\n" ${NEW_VAL} > ${FUSE}_new - # <<$ fix syntax coloration echo " get 1 (unprogrammed)" ;; 0) + NEW_VAL=$((~(1 << $BIT) & `cat ${FUSE}_new`)) + printf "0x%x\n" ${NEW_VAL} > ${FUSE}_new echo " get 0 (programmed)" ;; *) @@ -255,6 +257,7 @@ do ${AVRDUDE} -p ${MCU} -P ${PORT} \ -c ${AVRDUDE_PROGRAMMER} \ -U ${f}:w:${f}_new:i ${DELAY} + sleep 1 done exit 0 ;;