From 5c60b59e9f305ea8d2e72d62f78ec0d15e3dc42d Mon Sep 17 00:00:00 2001 From: Tobias Date: Tue, 29 Nov 2016 10:52:45 +0100 Subject: [PATCH] CRC16 correctur by get Info (0x85) --- DS2423/DS2423.c | 2 +- DS2423_BMP280/DS2423_BMP280.c | 2 +- DS2423_komische platine/DS2423.c | 2 +- DS2450/DS2450.c | 2 +- DS2450/DS2450.cproj | 18 ++++++++++++++---- DS2450_SHT2X_BMP280/DS2450_SHT2X_BMP280.c | 2 +- .../DS2450_SHT2X_BMP280_MAX44009.c | 2 +- DS2450_SHT2X_MAX44009/DS2450_SHT2X_MAX44009.c | 2 +- DS2450_VOC_SHT_BMP/DS2450_VOC_SHT_BMP.c | 2 +- common/OWRomFunctions.s | 16 +++++++++++----- programmer/flash/flashp18_atmelice.bat | 3 ++- programmer/programmer/programmer.asmproj | 14 +++++++++----- 12 files changed, 44 insertions(+), 23 deletions(-) diff --git a/DS2423/DS2423.c b/DS2423/DS2423.c index c545126..cdca3e4 100644 --- a/DS2423/DS2423.c +++ b/DS2423/DS2423.c @@ -54,7 +54,7 @@ extern void OWINIT(); uint8_t owid[8]={0x1D, 0xA2, 0xD9, 0x84, 0x00, 0x26, 0x02, 0x5C};/**/ -uint8_t config_info[16]={0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; +uint8_t config_info[18]={9,13,9,13,9,13,9,13,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; //+2 for CRC diff --git a/DS2423_BMP280/DS2423_BMP280.c b/DS2423_BMP280/DS2423_BMP280.c index 8f0596e..d3aa7b4 100644 --- a/DS2423_BMP280/DS2423_BMP280.c +++ b/DS2423_BMP280/DS2423_BMP280.c @@ -50,7 +50,7 @@ extern void OWINIT(); extern void EXTERN_SLEEP(); uint8_t owid[8]={0x1D, 0xA2, 0xD9, 0x84, 0x00, 0x26, 0x02, 0x5C};/**/ -uint8_t config_info[16]={0x09,0x0D,0x09,0x0D,0x01,0x08,0x02,0x08,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; +uint8_t config_info[18]={0x09,0x0D,0x09,0x0D,0x01,0x08,0x02,0x08,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; diff --git a/DS2423_komische platine/DS2423.c b/DS2423_komische platine/DS2423.c index 2cf20e3..b1c6332 100644 --- a/DS2423_komische platine/DS2423.c +++ b/DS2423_komische platine/DS2423.c @@ -45,7 +45,7 @@ extern void OWINIT(); uint8_t owid[8]={0x1D, 0xA2, 0xD9, 0x84, 0x00, 0x26, 0x02, 0x5C};/**/ -uint8_t config_info[16]={0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; +uint8_t config_info[18]={0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; diff --git a/DS2450/DS2450.c b/DS2450/DS2450.c index cf4e588..6a89067 100644 --- a/DS2450/DS2450.c +++ b/DS2450/DS2450.c @@ -43,7 +43,7 @@ extern void OWINIT(); extern void EXTERN_SLEEP(); uint8_t owid[8]={0x20, 0xA2, 0xD9, 0x84, 0x00, 0x16, 0x02, 0x5D};/**/ -uint8_t config_info[16]={0x06,0x09,0x06,0x09,0x06,0x09,0x06,0x09,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; +uint8_t config_info[18]={0x06,0x09,0x06,0x09,0x06,0x09,0x06,0x09,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; #if (owid>128) #error "Variable not correct" diff --git a/DS2450/DS2450.cproj b/DS2450/DS2450.cproj index a79f289..856184d 100644 --- a/DS2450/DS2450.cproj +++ b/DS2450/DS2450.cproj @@ -44,7 +44,7 @@ - -mmcu=attiny84a -B "%24(PackRepoDir)\atmel\ATtiny_DFP\1.0.68\gcc\dev\attiny84a" + -mmcu=attiny84a -B "%24(PackRepoDir)\atmel\ATtiny_DFP\1.0.79\gcc\dev\attiny84a" True True True @@ -59,7 +59,7 @@ - %24(PackRepoDir)\atmel\ATtiny_DFP\1.0.68\include + %24(PackRepoDir)\atmel\ATtiny_DFP\1.0.79\include Optimize for size (-Os) @@ -71,13 +71,18 @@ libm + + + %24(PackRepoDir)\atmel\ATtiny_DFP\1.0.79\include + + - -mmcu=attiny84a -B "%24(PackRepoDir)\atmel\ATtiny_DFP\1.0.68\gcc\dev\attiny84a" + -mmcu=attiny84a -B "%24(PackRepoDir)\atmel\ATtiny_DFP\1.0.79\gcc\dev\attiny84a" True True True @@ -92,7 +97,7 @@ - %24(PackRepoDir)\atmel\ATtiny_DFP\1.0.68\include + %24(PackRepoDir)\atmel\ATtiny_DFP\1.0.79\include Optimize (-O1) @@ -105,6 +110,11 @@ libm + + + %24(PackRepoDir)\atmel\ATtiny_DFP\1.0.79\include + + Default (-Wa,-g) diff --git a/DS2450_SHT2X_BMP280/DS2450_SHT2X_BMP280.c b/DS2450_SHT2X_BMP280/DS2450_SHT2X_BMP280.c index d641086..8b3678b 100644 --- a/DS2450_SHT2X_BMP280/DS2450_SHT2X_BMP280.c +++ b/DS2450_SHT2X_BMP280/DS2450_SHT2X_BMP280.c @@ -45,7 +45,7 @@ extern void OWINIT(); extern void EXTERN_SLEEP(); uint8_t owid[8]={0x20, 0xA2, 0xD9, 0x84, 0x00, 0x16, 0x02, 0x5D};/**/ -uint8_t config_info[16]={0x01,14,0x04,0x08, 0x06,0x09, 0x02,16,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; +uint8_t config_info[18]={0x01,14,0x04,0x08, 0x06,0x09, 0x02,16,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; #if (owid>128) #error "Variable not correct" diff --git a/DS2450_SHT2X_BMP280_MAX44009/DS2450_SHT2X_BMP280_MAX44009.c b/DS2450_SHT2X_BMP280_MAX44009/DS2450_SHT2X_BMP280_MAX44009.c index 73cca74..842c9ea 100644 --- a/DS2450_SHT2X_BMP280_MAX44009/DS2450_SHT2X_BMP280_MAX44009.c +++ b/DS2450_SHT2X_BMP280_MAX44009/DS2450_SHT2X_BMP280_MAX44009.c @@ -46,7 +46,7 @@ extern void OWINIT(); extern void EXTERN_SLEEP(); uint8_t owid[8]={0x20, 0xA2, 0xD9, 0x84, 0x00, 0x16, 0x02, 0x5D};/**/ -uint8_t config_info[16]={0x01,14,0x04,0x08, 0x03,15, 0x02,16,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; +uint8_t config_info[18]={0x01,14,0x04,0x08, 0x03,15, 0x02,16,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; #if (owid>128) #error "Variable not correct" diff --git a/DS2450_SHT2X_MAX44009/DS2450_SHT2X_MAX44009.c b/DS2450_SHT2X_MAX44009/DS2450_SHT2X_MAX44009.c index b321c96..e6f570a 100644 --- a/DS2450_SHT2X_MAX44009/DS2450_SHT2X_MAX44009.c +++ b/DS2450_SHT2X_MAX44009/DS2450_SHT2X_MAX44009.c @@ -45,7 +45,7 @@ extern void OWINIT(); extern void EXTERN_SLEEP(); uint8_t owid[8]={0x20, 0xA2, 0xD9, 0x84, 0x00, 0x16, 0x02, 0x5D};/**/ -uint8_t config_info[16]={0x01,14,0x04,0x08, 0x03,15, 0x06,0x09,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; +uint8_t config_info[18]={0x01,14,0x04,0x08, 0x03,15, 0x06,0x09,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; #if (owid>128) #error "Variable not correct" diff --git a/DS2450_VOC_SHT_BMP/DS2450_VOC_SHT_BMP.c b/DS2450_VOC_SHT_BMP/DS2450_VOC_SHT_BMP.c index db77580..660dd28 100644 --- a/DS2450_VOC_SHT_BMP/DS2450_VOC_SHT_BMP.c +++ b/DS2450_VOC_SHT_BMP/DS2450_VOC_SHT_BMP.c @@ -49,7 +49,7 @@ extern void OWINIT(); extern void EXTERN_SLEEP(); uint8_t owid[8]={0x20, 0xA2, 0xD9, 0x84, 0x00, 0x16, 0x02, 0x5D};/**/ -uint8_t config_info[16]={0x01,14, 0x04,0x08, 0x08,1, 0x02,16,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; +uint8_t config_info[18]={0x01,14, 0x04,0x08, 0x08,1, 0x02,16,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; #if (owid>128) #error "Variable not correct" diff --git a/common/OWRomFunctions.s b/common/OWRomFunctions.s index eac94b9..30731e7 100644 --- a/common/OWRomFunctions.s +++ b/common/OWRomFunctions.s @@ -320,8 +320,6 @@ h_fwconfiginfo: cpi r_bytep,17 breq h_fwconfiginfo_all #elif defined _CRC16_ - cpi r_bytep,17 - breq h_fwconfiginfo_crc2 cpi r_bytep,18 breq h_fwconfiginfo_all #else @@ -329,15 +327,23 @@ h_fwconfiginfo: breq h_fwconfiginfo_all #warning No CRC known code implemented #endif +h_fwconfiginfo_end: configZ config_info,r_bytep ld r_rwbyte,Z rjmp handle_end_inc h_fwconfiginfo_crc: +#ifdef _CRC8_ lds r_rwbyte,crc rjmp handle_end_inc -h_fwconfiginfo_crc2: - lds r_rwbyte,crc+1 - rjmp handle_end_inc +#elif defined _CRC16_ + lds r_temp,crc + com r_temp + sts config_info+16,r_temp + lds r_temp,crc+1 + com r_temp + sts config_info+17,r_temp + rjmp h_fwconfiginfo_end +#endif h_fwconfiginfo_all: rjmp handle_end_sleep diff --git a/programmer/flash/flashp18_atmelice.bat b/programmer/flash/flashp18_atmelice.bat index 7c4150c..1ef4978 100644 --- a/programmer/flash/flashp18_atmelice.bat +++ b/programmer/flash/flashp18_atmelice.bat @@ -1,2 +1,3 @@ avrdude -c atmelice_isp -p t84 -U lfuse:w:0xE2:m -U hfuse:w:0xDE:m -U efuse:w:0xFE:m -avrdude -c atmelice_isp -p t84 -e -U flash:w:"../programmer/Release/programmer.hex" +avrdude -c atmelice_isp -p t84 -e -U flash:w:programmer.hex + diff --git a/programmer/programmer/programmer.asmproj b/programmer/programmer/programmer.asmproj index 519af5b..87b98d2 100644 --- a/programmer/programmer/programmer.asmproj +++ b/programmer/programmer/programmer.asmproj @@ -34,7 +34,7 @@ - + @@ -45,15 +45,17 @@ 100000 0 - debugWIRE + + com.atmel.avrdbg.tool.atmelice - J41800000779 + J41800000789 Atmel-ICE - debugWIRE + + - J41800000779 + J41800000789 0x1E930C @@ -63,6 +65,7 @@ %24(PackRepoDir)\atmel\ATtiny_DFP\1.0.68\avrasm\inc %24(PackRepoDir)\atmel\ATtiny_DFP\1.0.68\avrasm\inc + %24(PackRepoDir)\atmel\ATtiny_DFP\1.0.79\avrasm\inc tn84adef.inc @@ -78,6 +81,7 @@ %24(PackRepoDir)\atmel\ATtiny_DFP\1.0.68\avrasm\inc %24(PackRepoDir)\atmel\ATtiny_DFP\1.0.68\avrasm\inc %24(PackRepoDir)\atmel\ATtiny_DFP\1.0.68\avrasm\inc + %24(PackRepoDir)\atmel\ATtiny_DFP\1.0.79\avrasm\inc tn84adef.inc -- 2.34.1