diff --git a/cpu/avr/radio/rf230bb/halbb.c b/cpu/avr/radio/rf230bb/halbb.c index 602d23383..dfa1d1c84 100644 --- a/cpu/avr/radio/rf230bb/halbb.c +++ b/cpu/avr/radio/rf230bb/halbb.c @@ -81,7 +81,7 @@ #define HAL_TRX_CMD_FR (0x20) /**< Frame Receive Mode (long mode). */ #define HAL_TRX_CMD_SW (0x40) /**< SRAM Write. */ #define HAL_TRX_CMD_SR (0x00) /**< SRAM Read. */ -#define HAL_TRX_CMD_RADDRM (0x7F) /**< Register Address Mask. */ +#define HAL_TRX_CMD_RADDRM (0x3F) /**< Register Address Mask. */ #define HAL_CALCULATED_CRC_OK (0) /**< CRC calculated over the frame including the CRC field should be 0. */ /*============================ TYPDEFS =======================================*/ @@ -185,9 +185,10 @@ inline uint8_t spiWrite(uint8_t byte) else HAL_PORT_MOSI &= ~(1 << HAL_MOSI_PIN); //call MOSI.clr(); - HAL_PORT_SCK &= ~(1 << HAL_SCK_PIN); //call SCLK.clr(); if( (HAL_PORT_MISO & (1 << HAL_MISO_PIN)) > 0) //call MISO.get() ) data |= mask; + + HAL_PORT_SCK &= ~(1 << HAL_SCK_PIN); //call SCLK.clr(); HAL_PORT_SCK |= (1 << HAL_SCK_PIN); //call SCLK.set(); } while( (mask >>= 1) != 0 ); return data; @@ -253,7 +254,7 @@ hal_init(void) /* Set SS */ HAL_PORT_SS |= (1 << HAL_SS_PIN); // HAL_SS_HIGH() - HAL_PORT_SCK |= (1 << HAL_SCK_PIN); + HAL_PORT_SCK &= ~(1 << HAL_SCK_PIN); // SCLK.clr() /*TIMER Specific Initialization.*/ // Init count source (Timer B3) diff --git a/cpu/avr/radio/rf230bb/rf230bb.c b/cpu/avr/radio/rf230bb/rf230bb.c index d6ea17e87..02fd18fab 100644 --- a/cpu/avr/radio/rf230bb/rf230bb.c +++ b/cpu/avr/radio/rf230bb/rf230bb.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * @(#)$Id: rf230bb.c,v 1.23 2010/12/21 04:25:15 dak664 Exp $ + * @(#)$Id: rf230bb.c,v 1.24 2010/12/22 20:10:00 dak664 Exp $ */ /* * This code is almost device independent and should be easy to port. @@ -71,6 +71,7 @@ /* Nonzero FOOTER_LEN has not been tested */ #define FOOTER_LEN 0 +/* RF230_CONF_CHECKSUM=0 for automatic hardware checksum */ #ifndef RF230_CONF_CHECKSUM #define RF230_CONF_CHECKSUM 0 #endif /* RF230_CONF_CHECKSUM */ @@ -610,9 +611,6 @@ rf230_transmit(unsigned short payload_len) #if RF230_CONF_TIMESTAMPS struct timestamp timestamp; #endif /* RF230_CONF_TIMESTAMPS */ -#if RF230_CONF_CHECKSUM - uint16_t checksum; -#endif /* RF230_CONF_CHECKSUM */ GET_LOCK(); // DEBUGFLOW('T'); @@ -659,14 +657,14 @@ rf230_transmit(unsigned short payload_len) PRINTF("rf230_transmit:\n"); #if DEBUG>1 -/* Note the dumped packet will have a zero checksum since we don't know what it should be */ +/* Note the dumped packet will have a zero checksum unless compiled with RF230_CONF_CHECKSUM + * since we don't know what it will be if calculated by the hardware. + */ { uint8_t i; PRINTF("0000"); //Start a new wireshark packet -// PRINTF("%02x%02x ", wireshark_offset>>8, wireshark_offset & 0xff); - for (i=0;i>8, wireshark_offset & 0xff); for (i=0;i