Date:2011-01-07 18:59:23 (13 years 2 months ago)
Author:Werner Almesberger
Commit:b2d90cd3d3135dd9b59ea4c6033b0c4855afe64f
Message:atrf-txrx: added support for AT86RF231 continuous transmission mode

- atrf-txrx.c (test_mode): moved test mode setup to enter_test_mode_230
- atrf-txrx.c (enter_test_mode_231): enter test mode on AT86RF231 (untested)
- atrf-txrx.c (test_mode): reset AT86RF231 register 0x1c when leaving
Files: tools/atrf-txrx/atrf-txrx.c (3 diffs)

Change Details

tools/atrf-txrx/atrf-txrx.c
196196}
197197
198198
199static int test_mode(struct atrf_dsc *dsc, uint8_t cont_tx, const char *cmd)
199static void enter_test_mode_230(struct atrf_dsc *dsc, uint8_t cont_tx)
200200{
201201    atrf_buf_write(dsc, "", 1);
202202    atrf_reg_write(dsc, REG_CONT_TX_0, CONT_TX_MAGIC);
203203    atrf_reg_write(dsc, REG_CONT_TX_1, cont_tx);
204    int status = 0;
205204
206205    if (!atrf_test_mode(dsc)) {
207206        atrf_reset_rf(dsc);
...... 
213212    wait_for_interrupt(dsc, IRQ_PLL_LOCK, IRQ_PLL_LOCK, 10, 20);
214213
215214    atrf_reg_write(dsc, REG_TRX_STATE, TRX_CMD_TX_START);
215}
216
217
218static void enter_test_mode_231(struct atrf_dsc *dsc, uint8_t cont_tx)
219{
220    uint8_t buf[127];
221
222    switch (cont_tx) {
223    case CONT_TX_M2M:
224        fprintf(stderr,
225            "-2 MHz mode is not supported by the AT86RF231\n");
226        break;
227    case CONT_TX_M500K:
228        memset(buf, 0, sizeof(buf));
229        break;
230    case CONT_TX_P500K:
231        memset(buf, 0xff, sizeof(buf));
232        break;
233    default:
234        abort();
235    }
236
237    atrf_reg_write(dsc, REG_IRQ_MASK, IRQ_PLL_LOCK); /* 2 */
238    atrf_reg_write(dsc, REG_TRX_CTRL_1, 0); /* 3 */
239    atrf_reg_write(dsc, REG_TRX_STATE, TRX_CMD_FORCE_TRX_OFF); /* 4 */
240    atrf_reg_write(dsc, REG_TRX_CTRL_0, CLKM_CTRL_1MHz); /* 5 */
241    atrf_reg_read(dsc, REG_TRX_STATUS); /* 8 */
242    atrf_reg_write(dsc, REG_CONT_TX_0, CONT_TX_MAGIC); /* 9 */
243    atrf_reg_write(dsc, REG_TRX_CTRL_2, OQPSK_DATA_RATE_2000); /*10 */
244    atrf_reg_write(dsc, REG_RX_CTRL, 0xa7); /*11 */
245
246    atrf_buf_write(dsc, buf, sizeof(buf)); /*12 */
247
248    atrf_reg_write(dsc, REG_PART_NUM, 0x54); /*13 */
249    atrf_reg_write(dsc, REG_PART_NUM, 0x46); /*14 */
250
251    atrf_reg_write(dsc, REG_TRX_STATE, TRX_CMD_PLL_ON); /*15 */
252    wait_for_interrupt(dsc, IRQ_PLL_LOCK, IRQ_PLL_LOCK, 10, 20); /*16 */
253
254    atrf_reg_write(dsc, REG_TRX_STATE, TRX_CMD_TX_START); /*17 */
255}
256
257
258
259static int test_mode(struct atrf_dsc *dsc, uint8_t cont_tx, const char *cmd)
260{
261    int status = 0;
262
263    switch (atrf_identify(dsc)) {
264    case artf_at86rf230:
265        enter_test_mode_230(dsc, cont_tx);
266        break;
267    case artf_at86rf231:
268        enter_test_mode_231(dsc, cont_tx);
269        break;
270    default:
271        abort();
272    }
216273
217274    if (cmd)
218275        status = system(cmd);
...... 
221278            sleep(1);
222279    }
223280
281    if (atrf_identify(dsc) == artf_at86rf231)
282        atrf_reg_write(dsc, REG_PART_NUM, 0);
283
224284    atrf_reset_rf(dsc);
225285
226286    return status;

Archive Download the corresponding diff file



interactive