From 464ab40e3932a83b30626b99c4b658b4916fc24c Mon Sep 17 00:00:00 2001 From: Stefan Schmidt Date: Tue, 17 Mar 2015 15:30:42 +0100 Subject: [PATCH 1/7] Revert "atusb/fw/usb/: enable MCU reset on USB bus reset after config selection" This reverts commit 9b2696b8488dbc39b0fdcdefdfad775913cb6e2d. With this patch ATUSB resets constantly when I use it in QEMU with USB poassthrough. --- atusb/fw/usb/atu2.c | 7 +------ atusb/fw/usb/usb.c | 1 - atusb/fw/usb/usb.h | 1 - 3 files changed, 1 insertion(+), 8 deletions(-) diff --git a/atusb/fw/usb/atu2.c b/atusb/fw/usb/atu2.c index 409b8e0..e030bfa 100644 --- a/atusb/fw/usb/atu2.c +++ b/atusb/fw/usb/atu2.c @@ -247,12 +247,6 @@ void usb_reset(void) } -void usb_enable_bus_reset(void) -{ - UDCON |= 1 << RSTCPU; /* reset CPU on bus reset */ -} - - void usb_init(void) { USBCON |= 1 << FRZCLK; /* freeze the clock */ @@ -269,6 +263,7 @@ void usb_init(void) UDCON &= ~(1 << DETACH); /* attach the pull-up */ UDIEN = 1 << EORSTE; /* enable device interrupts */ +// UDCON |= 1 << RSTCPU; /* reset CPU on bus reset */ ep_init(); } diff --git a/atusb/fw/usb/usb.c b/atusb/fw/usb/usb.c index 20b4d5f..2a2f720 100644 --- a/atusb/fw/usb/usb.c +++ b/atusb/fw/usb/usb.c @@ -119,7 +119,6 @@ bool handle_setup(const struct setup_request *setup) case TO_DEVICE(SET_CONFIGURATION): if (setup->wValue != config_descriptor[5]) return 0; - usb_enable_bus_reset(); break; /* diff --git a/atusb/fw/usb/usb.h b/atusb/fw/usb/usb.h index 32d8ad7..6428ccd 100644 --- a/atusb/fw/usb/usb.h +++ b/atusb/fw/usb/usb.h @@ -182,7 +182,6 @@ bool handle_setup(const struct setup_request *setup); void set_addr(uint8_t addr); void usb_ep_change(struct ep_descr *ep); void usb_reset(void); -void usb_enable_bus_reset(void); void usb_init(void); #endif /* !USB_H */ From fc7551e5327de4ba94fb034f045af758b115f915 Mon Sep 17 00:00:00 2001 From: Stefan Schmidt Date: Wed, 20 May 2015 15:00:57 +0200 Subject: [PATCH 2/7] atusb/fw: Use RX_AACK_ON instead of RX_ON in the firmware. This allows to run the device in ARET networks as we handle the needed automated ACK in hardware. --- atusb/fw/mac.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/atusb/fw/mac.c b/atusb/fw/mac.c index 2344b99..08ed00a 100644 --- a/atusb/fw/mac.c +++ b/atusb/fw/mac.c @@ -182,7 +182,7 @@ bool mac_rx(int on) if (on) { mac_irq = handle_irq; reg_read(REG_IRQ_STATUS); - change_state(TRX_CMD_RX_ON); + change_state(TRX_CMD_RX_AACK_ON); } else { mac_irq = NULL; change_state(TRX_CMD_FORCE_TRX_OFF); @@ -232,9 +232,9 @@ static void do_tx(void *user) /* * Wait until we reach BUSY_TX, so that we command the transition to - * RX_ON which will be executed upon TX completion. + * RX_AACK_ON which will be executed upon TX completion. */ - change_state(TRX_CMD_RX_ON); + change_state(TRX_CMD_RX_AACK_ON); } From 3ebd17f9e66469063446ad41442540c22d701a14 Mon Sep 17 00:00:00 2001 From: Stefan Schmidt Date: Wed, 20 May 2015 11:56:15 +0200 Subject: [PATCH 3/7] atusb/fw: Add build system support for adding a DFU suffix to the fw file DFU files need to have a valid DFU suffix which provides information about the USB vendor and product ID it should be used for as well as same basic CRC file integrity checking. The dfu-suffix tool can add this and got added to dfu-utils in 0.7. With the Makefile changes we take the original atusb-bin file, make a copy and add the DFU suffix it before flashing. --- atusb/fw/Makefile | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/atusb/fw/Makefile b/atusb/fw/Makefile index 653cc56..fb7d9a4 100644 --- a/atusb/fw/Makefile +++ b/atusb/fw/Makefile @@ -28,7 +28,12 @@ OBJCOPY = $(AVR_PREFIX)objcopy #OBJDUMP = $(AVR_PREFIX)objdump SIZE = $(AVR_PREFIX)size -USB_ID = 20b7:1540 +# BCD notion is 0xJJMM with JJ being major and MM being minor. Thus 0x0020 is +# version 0.2 */ +USB_BCD_VERSION = 0020 +USB_VENDOR_ID = 20b7 +USB_PRODUCT_ID = 1540 +USB_ID = $(USB_VENDOR_ID):$(USB_PRODUCT_ID) OBJS = atusb.o board.o board_app.o sernum.o spi.o descr.o ep0.o \ dfu_common.o usb.o app-atu2.o mac.o @@ -80,6 +85,11 @@ boot.elf: $(BOOT_OBJS) $(BUILD) $(OBJCOPY) -j .text -j .data -O binary $< $@ @echo "build #`cat .version`, `ls -l $@`" +%.dfu: %.bin + cp $(NAME).bin $(NAME).dfu + dfu-suffix -a $(NAME).dfu -d 0x$(USB_BCD_VERSION) \ + -p 0x$(USB_PRODUCT_ID) -v 0x$(USB_VENDOR_ID) + %.hex: %.elf $(BUILD) $(OBJCOPY) -j .text -j .data -O ihex $< $@ @echo "Size: `$(SIZE) -A boot.hex | sed '/Total */s///p;d'` B" @@ -87,7 +97,7 @@ boot.elf: $(BOOT_OBJS) # ----- Cleanup --------------------------------------------------------------- clean: - rm -f $(NAME).bin $(NAME).elf + rm -f $(NAME).bin $(NAME).elf $(NAME).dfu rm -f $(OBJS) $(OBJS:.o=.d) rm -f boot.hex boot.elf rm -f $(BOOT_OBJS) $(BOOT_OBJS:.o=.d) @@ -177,8 +187,8 @@ prog-read: ssh $(HOST) avrdude -F -p $(CHIP) -c nanonote_atusb \ -U flash:r:mcu.bin:r -dfu: $(NAME).bin - dfu-util -d $(USB_ID) -D $(NAME).bin +dfu: $(NAME).dfu + dfu-util -d $(USB_ID) -D $(NAME).dfu update: $(NAME).bin -atrf-reset -a From 809a0935d8833dd463280293cf6075d91e7b62ab Mon Sep 17 00:00:00 2001 From: Stefan Schmidt Date: Wed, 20 May 2015 11:16:18 +0200 Subject: [PATCH 4/7] atusb/fw: Bump minor version to mark first public release. With version 0.2 we made the first public release in binary form of the firmware. This comes together with the merge of the ATUSB driver to the mainline linux kernel. --- atusb/fw/include/atusb/ep0.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/atusb/fw/include/atusb/ep0.h b/atusb/fw/include/atusb/ep0.h index d21878f..8b0ab9a 100644 --- a/atusb/fw/include/atusb/ep0.h +++ b/atusb/fw/include/atusb/ep0.h @@ -22,10 +22,11 @@ * * 0.0 initial release * 0.1 addition of ATUSB_TEST + * 0.2 First public release */ #define EP0ATUSB_MAJOR 0 /* EP0 protocol, major revision */ -#define EP0ATUSB_MINOR 1 /* EP0 protocol, minor revision */ +#define EP0ATUSB_MINOR 2 /* EP0 protocol, minor revision */ #define HW_TYPE_100813 0 /* 2010-08-13 */ #define HW_TYPE_101216 1 /* 2010-12-16 */ From c6a87b488e01cc33a07da0348b35f0c1b5098798 Mon Sep 17 00:00:00 2001 From: Stefan Schmidt Date: Thu, 21 May 2015 15:34:14 +0200 Subject: [PATCH 5/7] web: Update links to linux-wpan project, driver and general status We are in a way better state now than two years ago. :) --- web/index.html | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/web/index.html b/web/index.html index b2ca0d6..7c495ca 100644 --- a/web/index.html +++ b/web/index.html @@ -144,16 +144,14 @@ Here is an overview of the status of the various project elements: Finishing source Device driver - In progress - linux-zigbee project, - ben-wpan kernel branch - + Finishing + mainlining through linux-wpan (bluetooh-next tree) MAC layer In progress - linux-zigbee project + linux-wpan project IPv4 hackDone dirtpan - 6LoWPAN stackTo do + 6LoWPAN stackIn progress

@@ -181,8 +179,9 @@ Shop links at Pulster:


-Last update: 2013-05-07   -Werner Almesberger +Last update: 2015-05-21   +Werner Almesberger, +Stefan Schmidt
From d2a0bfa176c9cc7d2c67593294fff15b0dd2e532 Mon Sep 17 00:00:00 2001 From: Stefan Schmidt Date: Thu, 21 May 2015 15:39:01 +0200 Subject: [PATCH 6/7] web: Add first atusb firmware release to website. I decided to actually keep the file directly in the repo. Its small enough and we have the rest of the website here already. --- web/Makefile | 2 +- web/index.html | 3 ++- web/releases/atusb-0.2.dfu | Bin 0 -> 5800 bytes 3 files changed, 3 insertions(+), 2 deletions(-) create mode 100755 web/releases/atusb-0.2.dfu diff --git a/web/Makefile b/web/Makefile index a37275d..cd036af 100644 --- a/web/Makefile +++ b/web/Makefile @@ -8,7 +8,7 @@ GEN=atben-pcba-small.jpg atusb-pcba-small.jpg \ all: $(GEN) upload: index.html zoom.html $(GEN) $(DL) - rsync -e ssh index.html zoom.html $(DL) $(GEN) \ + rsync -e ssh index.html zoom.html releases $(DL) $(GEN) \ www-data@downloads.qi-hardware.com:werner/wpan/web/ 800px-Atben_atusb_prod_03.jpg: diff --git a/web/index.html b/web/index.html index 7c495ca..f82090c 100644 --- a/web/index.html +++ b/web/index.html @@ -142,7 +142,8 @@ Here is an overview of the status of the various project elements: SMT Firmware Finishing - source + source, + 0.2 release Device driver Finishing mainlining through linux-wpan (bluetooh-next tree) diff --git a/web/releases/atusb-0.2.dfu b/web/releases/atusb-0.2.dfu new file mode 100755 index 0000000000000000000000000000000000000000..a5cd38327683c21a04f7ffe9b9dbb6e786fe48c7 GIT binary patch literal 5800 zcma)A4RjONm40uKkz|a1jEx~cCD{&Gv5{l~#iVQyKTQIg#C8%wph<1hCJiaO{A^DG zyKOzA!9Ow%o?put2&T#QB$O?vrxaKcJYu_DNDm0kc9YPP4bL`lOfb# zY?5#q`^@OgefPfk-u-*`PL6UP%270&qpX78zjc+EbCfl3eI4JQzkz&O&ROg_5l{Sy ze9(QS+ex}elo0Y+52IxX6Q$P|M9mk5^T_L$qXcU+q+iXAntO(A%8u+DRdayGyvMHMxe$b})nQesLbCe3ExyY&e zIxVWN!=heSe4YLT`;kOERcufQ_6#EpAz#N=X;+2jo@glK3`mw(oS&>wTQt?(-L_{*Ctp97*>xSo5yws_L#RlTGc3jUNMz z0PXUc_c5go%9S-Wl`8_(S*JgA4*+UNP%F|{Z|7I(Hnad$=L#)t%4()tDz8n7=t|c1@ zO9X;?Y|4k(n|-ox4gN9yDK42EAXIyqc?;O-!|Yk!1>P0j?|IjIf9Ca+?(pvQUKHb^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Q$PyIJLr?5O9vug6jG%2_7O zVq0x|2Skt+UsQjj9=*0H>)0?mTlHJi{nL(5tL`yt`(4LfzbrUncIdyHc4R`cYo}|C z`o=J;3hJBq4Akb4znXoMlSnb2d+CPt9PNzFBU$I}PYNoh?ya<_8`V0s9)9hzB_QY> z{wDv6{%8G9_?P-=M_{Q+#tZHDx|X?Cx}I~r Date: Fri, 22 May 2015 09:46:14 +0200 Subject: [PATCH 7/7] web: Correct fw path for atusb release and make rsync verbose --- web/Makefile | 2 +- web/index.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/web/Makefile b/web/Makefile index cd036af..67124fc 100644 --- a/web/Makefile +++ b/web/Makefile @@ -8,7 +8,7 @@ GEN=atben-pcba-small.jpg atusb-pcba-small.jpg \ all: $(GEN) upload: index.html zoom.html $(GEN) $(DL) - rsync -e ssh index.html zoom.html releases $(DL) $(GEN) \ + rsync -e ssh -av index.html zoom.html releases/ $(DL) $(GEN) \ www-data@downloads.qi-hardware.com:werner/wpan/web/ 800px-Atben_atusb_prod_03.jpg: diff --git a/web/index.html b/web/index.html index f82090c..7a24797 100644 --- a/web/index.html +++ b/web/index.html @@ -143,7 +143,7 @@ Here is an overview of the status of the various project elements: Firmware Finishing source, - 0.2 release + 0.2 release Device driver Finishing mainlining through linux-wpan (bluetooh-next tree)