diff --git a/fw/atspi/atspi.c b/fw/atspi/atspi.c index c2283bb..0c6a603 100644 --- a/fw/atspi/atspi.c +++ b/fw/atspi/atspi.c @@ -18,6 +18,17 @@ #include "version.h" +void reset_rf(void) +{ + int i; + + nRST_RF = 0; + /* 11.4.12: min 625 ns */ + for (i = 0; i != 10; i++); + nRST_RF = 1; +} + + static void init_io(void) { /* @@ -53,6 +64,26 @@ static void init_io(void) ~((1 << 0) | (1 << 3) | (1 << 4) | (1 << 5) | (1 << 6) | (1 << 7)); /* change 1 << 0 to 1 << 2 once 100813 boards are reworked */ P3 = 0; + +#if 0 + /* + * We can *almost* disable the pull-ups. The only obstacle is that + * MISO is not driven when not in use. So we either need an external + * pull-up/down or keep all the pull-ups on. + */ + + /* + * Disable pull-ups + */ + GPIOCN |= WEAKPUD; +#endif + + /* + * The manual says the reset is optional, but reality disagrees with + * this optimistic assessment quite violently. + */ + + reset_rf(); } diff --git a/fw/atspi/ep0.c b/fw/atspi/ep0.c index 4d457b8..ae4ad2b 100644 --- a/fw/atspi/ep0.c +++ b/fw/atspi/ep0.c @@ -25,6 +25,9 @@ #include "version.h" +extern void reset_rf(void); + + #define debug(...) #define error(...) @@ -138,9 +141,7 @@ static __bit my_setup(struct setup_request *setup) __reentrant case ATSPI_TO_DEV(ATSPI_RF_RESET): debug("ATSPI_RF_RESET\n"); - nRST_RF = 0; - /* 11.4.12 min 625 ns */ - nRST_RF = 1; + reset_rf(); return 1; case ATSPI_TO_DEV(ATSPI_REG_WRITE): diff --git a/tools/atspi-id/atspi-id.c b/tools/atspi-id/atspi-id.c index de6a085..0850b67 100644 --- a/tools/atspi-id/atspi-id.c +++ b/tools/atspi-id/atspi-id.c @@ -15,6 +15,7 @@ #include #include +#include "at86rf230.h" #include "atspi/ep0.h" #include "atspi.h" @@ -72,6 +73,7 @@ static void show_info(usb_dev_handle *dev) uint8_t major, minor, target; char buf[BUF_SIZE+1]; /* +1 for terminating \0 */ int len; + uint8_t part, version, man_id_0, man_id_1; printf("%04x:%04x ", device->descriptor.idVendor, device->descriptor.idProduct); @@ -85,6 +87,13 @@ static void show_info(usb_dev_handle *dev) exit(1); buf[len] = 0; printf("%10s%s\n", "", buf); + + part = atspi_reg_read(dev, AT86RF230_REG_PART_NUM); + version = atspi_reg_read(dev, AT86RF230_REG_VERSION_NUM); + man_id_0 = atspi_reg_read(dev, AT86RF230_REG_MAN_ID_0); + man_id_1 = atspi_reg_read(dev, AT86RF230_REG_MAN_ID_1); + printf("%10spart 0x%02x version %u manufacturer xxxx%02x%02x\n", "", + part, version, man_id_1, man_id_0); }