Date:2010-08-21 03:16:58 (9 years 4 months ago)
Author:Werner Almesberger
Commit:4b204210e7785908a3569da4d91dc9794bea2c93
Message: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
Files: fw/atspi/atspi.c (2 diffs)
fw/atspi/ep0.c (2 diffs)
tools/atspi-id/atspi-id.c (3 diffs)

Change Details

fw/atspi/atspi.c
1818#include "version.h"
1919
2020
21void reset_rf(void)
22{
23    int i;
24
25    nRST_RF = 0;
26    /* 11.4.12: min 625 ns */
27    for (i = 0; i != 10; i++);
28    nRST_RF = 1;
29}
30
31
2132static void init_io(void)
2233{
2334    /*
...... 
5364        ~((1 << 0) | (1 << 3) | (1 << 4) | (1 << 5) | (1 << 6) | (1 << 7));
5465        /* change 1 << 0 to 1 << 2 once 100813 boards are reworked */
5566    P3 = 0;
67
68#if 0
69    /*
70     * We can *almost* disable the pull-ups. The only obstacle is that
71     * MISO is not driven when not in use. So we either need an external
72     * pull-up/down or keep all the pull-ups on.
73     */
74
75    /*
76     * Disable pull-ups
77     */
78    GPIOCN |= WEAKPUD;
79#endif
80
81    /*
82     * The manual says the reset is optional, but reality disagrees with
83     * this optimistic assessment quite violently.
84     */
85
86    reset_rf();
5687}
5788
5889
fw/atspi/ep0.c
2525#include "version.h"
2626
2727
28extern void reset_rf(void);
29
30
2831#define debug(...)
2932#define error(...)
3033
...... 
138141
139142    case ATSPI_TO_DEV(ATSPI_RF_RESET):
140143        debug("ATSPI_RF_RESET\n");
141        nRST_RF = 0;
142        /* 11.4.12 min 625 ns */
143        nRST_RF = 1;
144        reset_rf();
144145        return 1;
145146
146147    case ATSPI_TO_DEV(ATSPI_REG_WRITE):
tools/atspi-id/atspi-id.c
1515#include <stdio.h>
1616#include <usb.h>
1717
18#include "at86rf230.h"
1819#include "atspi/ep0.h"
1920#include "atspi.h"
2021
...... 
7273    uint8_t major, minor, target;
7374    char buf[BUF_SIZE+1]; /* +1 for terminating \0 */
7475    int len;
76    uint8_t part, version, man_id_0, man_id_1;
7577
7678    printf("%04x:%04x ",
7779        device->descriptor.idVendor, device->descriptor.idProduct);
...... 
8587        exit(1);
8688    buf[len] = 0;
8789    printf("%10s%s\n", "", buf);
90
91    part = atspi_reg_read(dev, AT86RF230_REG_PART_NUM);
92    version = atspi_reg_read(dev, AT86RF230_REG_VERSION_NUM);
93    man_id_0 = atspi_reg_read(dev, AT86RF230_REG_MAN_ID_0);
94    man_id_1 = atspi_reg_read(dev, AT86RF230_REG_MAN_ID_1);
95    printf("%10spart 0x%02x version %u manufacturer xxxx%02x%02x\n", "",
96        part, version, man_id_1, man_id_0);
8897}
8998
9099

Archive Download the corresponding diff file



interactive