1
0
mirror of git://projects.qi-hardware.com/ben-wpan.git synced 2024-11-23 17:00:37 +02:00
Commit Graph

1060 Commits

Author SHA1 Message Date
Werner Almesberger
e77658fe26 tools/dirtpan/dirtpan.c: cleaned up embarrassing explanation of control byte
- dirtpan.c: changed control byte from innovative 7 bit layout to the
  more common 8 bits. My, haven't we had our morning coffee yet ?
- dirtpan.c: added explanation that the two highest bits of the
  control byte have to be zero, to avoid conflicting with RFC4944
2011-06-19 08:40:56 -03:00
Werner Almesberger
29664701a8 BOOKSHELF: added RFC4944 (6LoWPAN) as "rfc4944" and "6lowpan" 2011-06-19 08:39:54 -03:00
Stefan Schmidt
a48c6dcb30 usb/dfu.h: Include usb.h to avoid gcc warning
With warnings treated as errors I get this:
In file included from flash.c:19:0:
usb/dfu.h:107:35: error: 'struct setup_request' declared inside parameter list
usb/dfu.h:107:35: error: its scope is only this definition or declaration, which
 is probably not what you want
make: *** [flash.o] Error 1

Struct setup_request is declared in usb.h so include it.

Signed-off-by: Stefan Schmidt <stefan@datenfreihafen.org>
2011-06-17 12:01:38 -03:00
Werner Almesberger
cce781078e web/index.html: removed duplicate IMG tag 2011-06-15 03:22:42 -03:00
Werner Almesberger
7e1b47bc0c web/: added zoomed-in view of atusb in action 2011-06-15 03:21:09 -03:00
Werner Almesberger
394ca56f2c web/Makefile: also upload the ~800 pixels images 2011-06-15 02:01:45 -03:00
Werner Almesberger
ea7103ef8e web/: Ben-WPAN overview page
http://downloads.qi-hardware.com/people/werner/wpan/web/
2011-06-15 01:48:26 -03:00
Werner Almesberger
a800eb8794 tools/dirtpan/dirtpan.c: added missing #include "daemon.h", oops 2011-06-13 20:01:31 -03:00
Werner Almesberger
9ef447865b tools/: rearranged cwtest/atrf-path to be more clear about reset and do re-init
- include/cwtest.h (cw_test_needs_reset), lib/cwtest.c
  (cw_test_needs_reset): new function to indicate all cases where the
  transceiver needs to be reset (instead of using SLP_TR)
- lib/cwtest.c (cw_test_end): use cw_test_needs_reset instead of
  open-coding the decision
- lib/cwtest.c (enter_test_mode_230, start_test_mode_231): always wait
  for the PLL to lock. Contrary to the assumption in the previous
  commit, we should always see this interrupt.
- atrf-path/atrf-path.c (sample): initialize the transceiver if we had
  to reset it
- atrf-path/atrf-path.c (sample), atrf-path/atrf-path.c (do_half_sweep):
  moved the tTR19 delay to "sweep", so that all branches share it and it
  is taken only once
2011-06-13 14:24:59 -03:00
Werner Almesberger
8c00833542 lib/cwtest.c (start_test_mode_231): don't insist on IRQ_PLL_LOCK
We seem to have a path where the PLL is already locked when we get
there. We thus never get an interrupt and hang.

Pending further investigation, just use a timeout that is longer
than the worst-case PLL lock time.
2011-06-13 12:37:42 -03:00
Werner Almesberger
39c37258c5 prod/: P_ON test for atusb can't work as intended ... because we're not in P_ON
The explanation is simple: reset from any state but P_ON throws us
back into TRX_OFF, not P_ON. That's why the P_ON test only worked
predictably after power-cycling the board.

- prod/atusb (gpio_usb): removed P_ON test
- prod/atben (gpio_ben): added comment to P_ON test explaining why
  it works in this case
2011-06-12 07:46:26 -03:00
Werner Almesberger
3e37af63ca prod/doc/setup.hmac: changed boot.hex and atusb.bin to the ce16a16 versions 2011-06-12 07:28:59 -03:00
Werner Almesberger
d135eb2c2a prod/atben (gpio_ben): in TRX_OFF, use that MISO is Z if nSS = H 2011-06-11 21:19:43 -03:00
Werner Almesberger
13f4a35a62 prod/atusb: P_ON test turned out to be unreliable - skip it for now
Some of the transceiver pull-up/downs don't seem to work as
expected. Until further analysis, we perform equivalent testing
in TRX_OFF, which only uses the MCU's pull-ups.
2011-06-11 21:05:46 -03:00
Werner Almesberger
5f3cc767f8 prod/atusb (TRX_OFF): walk all GPIOs. Also, use that MISO is Z if nSS = H 2011-06-11 21:04:25 -03:00
Werner Almesberger
fb80f514b8 prod/atusb (TRX_OFF): C5 was "x" for no good reason - changed to "H" 2011-06-11 20:48:27 -03:00
Werner Almesberger
ce16a16f73 atusb/fw/atusb.c (main): sleep (idle mode) while waiting for interrupts
This saves about 2 mA, leaving about 8 mA when idle. The transceiver
should consume 0.5 mA in TRX_OFF, CLKM up to 4 mA, and the idle MCU
core 1 mA. USB current is unknown.
2011-06-11 14:31:13 -03:00
Werner Almesberger
b42577bb72 atusb/fw/boot.c: adjusted the delay loop and don't race with dfu-util
- boot.c (MS_TO_LOOPS): increased loop count now that we no longer
  have to poll
- boot.c (main): increased delay from 2.0 s to 2.5 s, because we were
  racing with a sleep(2) in dfu-util
2011-06-11 14:26:52 -03:00
Werner Almesberger
376236949b atusb/fw/usb/: we were busy-looping on TXINI. Mask the interrupt when idle.
- usb/usb.h (usb_ep_change), usb/atu2.c (usb_ep_change): new function
  called by the USB stack to notify the hardware-specific driver of
  an endpoint state change (EP_TX or EP_RX)
- usb/usb.c (usb_io): call usb_ep_change
- usb/atu2.c (handle_ep): mask TXINI if we have nothing to send
2011-06-11 14:17:44 -03:00
Werner Almesberger
d03beb2257 atusb/fw/: changed USB stack to use interrupts instead of polling
Note: this change surprisingly _increases_ the DFU wait in the boot
loader. Not yet sure why.

- boot.c (main): move the interrupt vectors to the boot loader
  section
- atusb.c (main): move the interrupt vectors to the application
  section
- boot.c (main): enable global interrupts while looping (disable
  them before jumping to the application)
- board_app.c (__timer_read, timer_read): removed wrapped since
  we're now always called with interrupts disabled
- usb/atu2.c (ep_init): enable endpoint interrupts
- usb/atu2.c (usb_init): enable device interrupts
- usb/atu2.c (usb_poll, USB_GEN_vect, USB_COM_vect): moved poll
  loop code into separate handlers for device and endpoint
  interrupts
- boot.c (main), atusb.c (main): removed call to usb_poll
2011-06-11 11:06:18 -03:00
Werner Almesberger
f9681e5b4f atusb/fw/usb/atu2.c: use implicit race-free "and" when writing to UDINT/UEINTX
The old code could accidently acknowledge interrupts that appeared
between the read and the write in UxINTx &= mask.

- atu2.c (handle_ep): writing to UEINTX implies a race-free "and"
- atu2.c (usb_poll): writing to UDINT implies a race-free "and"
2011-06-11 08:16:23 -03:00
Werner Almesberger
a69916da52 atusb/fw/: make timer code use interrupts instead of polling
- board_app.c (timer_poll): replaced with interrupt handler
- board_app.c (__timer_read): merged polling of timer_poll into the
  read loop (so it works as before, provided that interrupts are
  disabled)
- board_app.c (timer_read): run __timer_read with interrupts disabled
- board_app.c (timer_init): enable timer 1 overflow interrupt
- atusb.c (main): enabled global interrupts
- atusb.c (main): don't call poll_timer anymore
- board.h (timer_poll): removed
2011-06-11 08:13:31 -03:00
Werner Almesberger
2acdaca218 atusb/fw/: moved timer initialization to board_app.c as well
- board.c (board_init), board_app.h (timer_init), board_app.c
  (timer_init): moved timer initialization from board_init to
  new function timer_init
- atusb.c (main): call timer_init
2011-06-11 01:52:16 -03:00
Werner Almesberger
2d7ee91430 atusb/fw/: added transition from runtime to DFU mode according to DFU spec
- descr.c (config_descriptor): added DFU interface descriptor
- ep0.c (my_dfu_setup, my_set_interface, ep0_init): added DFU
  interface switching
- ep0.c (my_reset, ep0_init): CPU-reset (into boot loader) on
  USB bus reset when in appDETACH
- Makefile (OBJS): added dfu_common.o
2011-06-10 23:26:36 -03:00
Werner Almesberger
5f50611735 atusb/fw/usb/: DFU_ITF_DESCR also needs a protocol argument
- dfu.h (enum dfu_itf_proto): bInterfaceProtocol values for DFU
  functional descriptor
- dfu.h (DFU_ITF_DESCR): added protocol argument
- dfu.c (config_descriptor): pass protocol to DFU_ITF_DESCR
2011-06-10 23:15:51 -03:00
Werner Almesberger
2544004a86 atusb/fw/: moved common elements of DFU processing to dfu_common.c
- dfu.c (functional_descriptor, dfu, my_descr), dfu.h (dfu_my_descr):
  moved to dfu_common.c
- dfu.c (my_setup), dfu.h (dfu_setup_common), dfu_common.c
  (dfu_setup_common): moved handling of DFU_GETSTATUS, DFU_CLRSTATUS,
  and DFU_GETSTATE from my_setup to dfu_setup_common
- dfu_common.c (my_descr), dfu.c (dfu_init): renamed my_descr to
  dfu_my_descr
- Makefile (BOOT_OBJS): added dfu_common.o
2011-06-10 22:04:12 -03:00
Werner Almesberger
bbe27fc357 atusb/fw: revert most of the user_setups change and use simple callback instead
This allows us to do other things as well, e.g., change state.

- ep0.c (ep0_init), usb/dfu.c (dfu_init): use user_setup
- usb/atu2.c (usb_poll): no need to reset user_setup - the user's
  reset function can do that
- usb/usb.h (user_setups), usb/usb.c (handle_setup): removed
  user_setups
- usb/usb.h (user_set_interface), usb/usb.c (user_set_interface,
  handle_setup): callback for SET_INTERFACE
2011-06-10 21:50:42 -03:00
Werner Almesberger
7a2c785e29 atusb/fw/usb/dfu.h: define DFU interface descriptor, for later sharing
- dfu.h (DFU_ITF_DESCR): define DFU interface descriptor
- dfu.c (config_descriptor): use DFU_ITF_DESCR instead of open-coding
  the descriptor
2011-06-10 19:33:24 -03:00
Werner Almesberger
3cc92cc4a6 atusb/fw/: define USB bus current (40 mA) in board.h based on measured value
The measured values are:

board idle, looping	  9 mA
LED on			+ 5 mA
TX CW (+3 dBm)		+14 mA
			------
			 28 mA
			======

Adding a margin of 12 mA, we get 40 mA. DFU used 30 mA so far, the
application 50 mA.

- board.h (BOARD_MAX_mA): define maximum USB bus current
- descr.c (config_descriptor), usb/dfu.c (config_descriptor):
  use BOARD_MAX_mA for bMaxPower instead of hard-coding values
2011-06-10 19:33:24 -03:00
Werner Almesberger
89d13ce8f8 atusb/fw/: SET_INTERFACE can now select among interfaces (changes user_setup)
- ep0.c (ep0_init), usb/dfu.c (dfu_init): set user_setups[0] instead
  of user_setup
- usb/atu2.c (usb_poll): reset user_setup on bus reset
- usb/usb.h (user_setups), usb/usb.c (user_setups): array of
  interface-specific setup functions
- usb/usb.c (handle_setup): in SET_INTERFACE, select setup function
  from user_setups according to interface
- usb/usb.c (handle_setup): if user_setup is not set (e.g., the
  optional SET_INTERFACE was never issued), fall back to user_setups[0]
2011-06-10 17:12:57 -03:00
Werner Almesberger
4d4e132f0a atrf-xmit: tightened checking of interrupt behaviour
- atrf-xmit.c (xfer_one): also check that also the sender has no
  pending interrupts before we start sending
- atrf-xmit.c (xfer_one): interrupt poll loop (now disabled) checked
  the sender, not the receiver. oops.
- atrf-xmit.c (xfer_one): upon reception, check that the sender has
  finished (IRQ_TRX_END) as well
2011-06-09 21:08:14 -03:00
Werner Almesberger
256ac01ab2 atusb/fw/board.c (reset_rf): increased 1 us delays to nominally 2 us
They should be at least 625 ns. Can't hurt to have a little tolerance.
2011-06-09 20:55:33 -03:00
Werner Almesberger
78ab017990 tools/atrf-proxy/atrf-proxy.c (cmd_zero): reduce poll delay from 100 ms to 2 ms
The overly generous delay has the effect of encouraging dubious
optimizations elsewhere. Not a good idea.
2011-06-09 20:54:07 -03:00
Werner Almesberger
abe923d2ef atrf-xmit: use receive interrupt instead of polling
- atrf-xmit.c (xfer_one): use wait_for_interrupt instead of polling
- atrf-xmit.c (xfer_one): fail if there's an unexpected receiver
  interrupt
2011-06-09 20:49:36 -03:00
Werner Almesberger
703ce81dfc atrf-xmit.c (xfer_one): pulse SLP_TR instead of sending TRX_CMD_TX_START
This makes sure we use SLP_TR just like the kernel does.
2011-06-09 20:39:24 -03:00
Werner Almesberger
ec7c93789a atusb/fw/: added "lazy enabling" of UART-SPI after ATUSB_GPIO
- spi.h (spi_off), spi.c: disable the UART
- spi.c (spi_initialized, spi_begin, spi_init): initialize the UART
  if necessary
- board_app.c (gpio): call spi_off to disable the UART instead of
  open-coding the operation
- board_app.c (gpio): don't explicitly re-enable the UART but defer it
  to the next communication
2011-06-09 14:02:26 -03:00
Werner Almesberger
814cf6fd78 atusb/fw/boot.c (main): reset_rf implies spi_init - no need to call it here 2011-06-09 12:52:51 -03:00
Werner Almesberger
ed6d43bb35 atusb/fw/board_app.c: removed unnecessary includes 2011-06-09 12:51:13 -03:00
Werner Almesberger
e678401ac3 atusb/fw/: split board functions into app-only/shared part (boot overlflowed)
- board.c (timer_h, reset_cpu, read_irq, slp_tr, timer_poll,
  timer_read, gpio): moved to new file board_app.c
- Makefile (OBJS): added board_app.o
2011-06-09 12:48:44 -03:00
Werner Almesberger
b41076135c atusb: include the position of fiducials in atusb-pos.csv (for fab)
The SMT fab was looking there for the positions (alas, in vain).
Seems as good a place as any.

- atusb.brd: bumped file version to 20110607 (didn't change the version
  printed on the layout since the layout itself didn't change)
- atusb.brd: changed fiducials from "virtual" to "normal+insert", to
  include them in the position report
- atusb.brd: renamed the fiducials to give them unique names
- Makefile: bumped fab files version to 20110607
2011-06-07 16:51:26 -03:00
Werner Almesberger
9f9e77d025 atben: include the position of fiducials in atben-pos.csv
The fab was looking there for the positions (alas, in vain). Seems as
good a place as any.

- atben.brd: bumped file version to 20110607 (didn't change the version
  printed on the layout since the layout itself didn't change)
- atben.brd: changed fiducials from "virtual" to "insert+place", to
  include them in the position report
- atben.brd: renamed the fiducials to give them unique names
- Makefile: bumped fab files version to 20110607
2011-06-07 16:39:17 -03:00
Werner Almesberger
66fb9d808c prod/: use positive and negative offset in spectrum test
This way, we can also spot issues in the digital interface leading to
mis-configurations. E.g., this one would be a defective SLP_TR line
in atusb:
http://downloads.qi-hardware.com/people/werner/wpan/tmp/jagged.png

- prod/Makefile, prod/Common: removed "-T +0.5" to use both offsets
- prod/Makefile (spectrum): print a direction indication before
  running atrf-path
2011-06-07 08:09:20 -03:00
Werner Almesberger
6e3edf3d2e prod/Common: try to obtain more consistent handling of \033 in echo
- Common (g_echo): wrapper for /bin/echo -e
- Common (pass, fail, todo): use g_echo instead of regular "echo" for
  strings containing escape sequences
2011-06-06 21:55:47 -03:00
Werner Almesberger
90ee726285 prod/doc/: atrf-path now accepts keypresses from all the usual places
- setup.hmac, test.hmac: it's no longer necessary to "type into the
  window" (i.e., with the focus there)
2011-06-06 20:26:18 -03:00
Werner Almesberger
6ca63fc6e7 atrf-path: accept keyboard input both from stdin and SDL
- gui.c (old_term, restore_term, raw, get_key): raw and non-blocking
  console input
- gui,c (gui): accept console input in addition to keypressed in the
  SDL window
2011-06-06 20:22:57 -03:00
Werner Almesberger
9a32c66faa prod/doc/test.hmac: we now also have the LED test 2011-06-06 20:06:32 -03:00
Werner Almesberger
ba6dd86b24 prod/atusb (led): added the LED test 2011-06-06 19:58:13 -03:00
Werner Almesberger
8f20b1fb87 atrf-gpio: cleaned up usage
- atrf-gpio.c (usage): added newline after synopsis
- atrf-gpio.c (usage): description of option -p was missing
- atrf-gpio.c (main): invocation without patterns/commands is now an
  error
2011-06-06 19:42:31 -03:00
Werner Almesberger
533dc58824 atrf-gpio.c: rename anything "reg_op" to "command"
- atrf-gpio.c (bad_reg_op, reg_op): renamed "bad_reg_op" to
  "bad_command"
- atrf-gpio.c (bad_command): error message is now "invalid command"
- atrf-gpio.c (reg_op, main): renamed "reg_op" to "command"
2011-06-06 19:38:42 -03:00
Werner Almesberger
7a2e09187f atrf-gpio: option -c to cycle through the pattern sequence with pass/fail input
- atrf-gpio.c: added section titles
- atrf-gpio.c (DEFAULT_DELAY_MS, reg_op, usage): the "delay" command
  now accept an optional delay argument
- atrf-gpio.c (old_term, restore_term, raw, pass_fail): make standard
  input non-blocking and raw, and poll for pass/fail input
- atrf-gpio.c (usage, main): new option -c to cycle through the
  pattern sequence, waiting for pass/fail input
2011-06-06 19:33:11 -03:00