1
0
mirror of git://projects.qi-hardware.com/ben-wpan.git synced 2024-11-23 00:14:59 +02:00

We can now read the transceiver's registers.

- fw/atspi/atspi.c (init_io, reset_rf): reset the transceiver after setting
  up the IOs. Contrary to what the manual claims, the chip only produce
  garbage if not reset.
- fw/atspi/ep0.c (my_setup): call reset_rf instead of open-coding the reset
- fw/atspi/atspi.c (init_io): added #ifdef'ed-out code to disable the
  pull-ups, and an explanation why we can't do this.
- tools/atspi-id/atspi-id.c (show_info): also read and print the
  transceiver's ID registers
This commit is contained in:
Werner Almesberger 2010-08-20 22:16:58 -03:00
parent 14c1b4cbfc
commit 4b204210e7
3 changed files with 44 additions and 3 deletions

View File

@ -18,6 +18,17 @@
#include "version.h" #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) 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)); ~((1 << 0) | (1 << 3) | (1 << 4) | (1 << 5) | (1 << 6) | (1 << 7));
/* change 1 << 0 to 1 << 2 once 100813 boards are reworked */ /* change 1 << 0 to 1 << 2 once 100813 boards are reworked */
P3 = 0; 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();
} }

View File

@ -25,6 +25,9 @@
#include "version.h" #include "version.h"
extern void reset_rf(void);
#define debug(...) #define debug(...)
#define error(...) #define error(...)
@ -138,9 +141,7 @@ static __bit my_setup(struct setup_request *setup) __reentrant
case ATSPI_TO_DEV(ATSPI_RF_RESET): case ATSPI_TO_DEV(ATSPI_RF_RESET):
debug("ATSPI_RF_RESET\n"); debug("ATSPI_RF_RESET\n");
nRST_RF = 0; reset_rf();
/* 11.4.12 min 625 ns */
nRST_RF = 1;
return 1; return 1;
case ATSPI_TO_DEV(ATSPI_REG_WRITE): case ATSPI_TO_DEV(ATSPI_REG_WRITE):

View File

@ -15,6 +15,7 @@
#include <stdio.h> #include <stdio.h>
#include <usb.h> #include <usb.h>
#include "at86rf230.h"
#include "atspi/ep0.h" #include "atspi/ep0.h"
#include "atspi.h" #include "atspi.h"
@ -72,6 +73,7 @@ static void show_info(usb_dev_handle *dev)
uint8_t major, minor, target; uint8_t major, minor, target;
char buf[BUF_SIZE+1]; /* +1 for terminating \0 */ char buf[BUF_SIZE+1]; /* +1 for terminating \0 */
int len; int len;
uint8_t part, version, man_id_0, man_id_1;
printf("%04x:%04x ", printf("%04x:%04x ",
device->descriptor.idVendor, device->descriptor.idProduct); device->descriptor.idVendor, device->descriptor.idProduct);
@ -85,6 +87,13 @@ static void show_info(usb_dev_handle *dev)
exit(1); exit(1);
buf[len] = 0; buf[len] = 0;
printf("%10s%s\n", "", buf); 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);
} }