[Hackrf-dev] release 2014.08.1

Karl Koscher supersat at cs.washington.edu
Fri Sep 5 17:36:06 EDT 2014


Sure. Attached.

Keep in mind this is a temporary hack. :) There's some discussion on IRC
about the best way to do CPLD updates going forward.


On Fri, Sep 5, 2014 at 2:30 PM, Matt Carlson <lordsaryon at gmail.com> wrote:

> Would you mind posting the diffs for this?
>
>
> On Fri, Sep 5, 2014 at 4:24 PM, Karl Koscher <supersat at cs.washington.edu>
> wrote:
>
>> Until a better, more permanent solution is in place, I have a work around
>> for those who can't wait:
>> https://homes.cs.washington.edu/~supersat/hackrf-tools-cpld-update-hack.zip
>>
>> I've modified the firmware to use a Windows-compatible way to getting the
>> HackRF into the CPLD programming mode, and made a corresponding change to
>> libhackrf. To update the CPLD, you'll need to reflash the LPC43xx firmware,
>> reset the HackRF, and then apply the CPLD update.
>>
>>
>>
>> On Thu, Aug 28, 2014 at 12:47 PM, Michael Ossmann <mike at ossmann.com>
>> wrote:
>>
>>> As a reminder, there is a known bug with CPLD update on Windows:
>>> https://github.com/mossmann/hackrf/issues/113
>>> _______________________________________________
>>> HackRF-dev mailing list
>>> HackRF-dev at greatscottgadgets.com
>>> http://nine.pairlist.net/mailman/listinfo/hackrf-dev
>>>
>>
>>
>> _______________________________________________
>> HackRF-dev mailing list
>> HackRF-dev at greatscottgadgets.com
>> http://nine.pairlist.net/mailman/listinfo/hackrf-dev
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nine.pairlist.net/pipermail/hackrf-dev/attachments/20140905/4c326b7b/attachment.html>
-------------- next part --------------
diff --git a/firmware/common/hackrf_core.h b/firmware/common/hackrf_core.h
index 8ce6c94..584a428 100644
--- a/firmware/common/hackrf_core.h
+++ b/firmware/common/hackrf_core.h
@@ -345,7 +345,8 @@ extern "C"
 typedef enum {
 	TRANSCEIVER_MODE_OFF = 0,
 	TRANSCEIVER_MODE_RX = 1,
-	TRANSCEIVER_MODE_TX = 2
+	TRANSCEIVER_MODE_TX = 2,
+	TRANSCEIVER_MODE_CPLD_UPDATE = 4
 } transceiver_mode_t;
 
 void delay(uint32_t duration);
diff --git a/firmware/hackrf_usb/hackrf_usb.c b/firmware/hackrf_usb/hackrf_usb.c
index 42fc448..22ef47c 100644
--- a/firmware/hackrf_usb/hackrf_usb.c
+++ b/firmware/hackrf_usb/hackrf_usb.c
@@ -96,6 +96,11 @@ usb_request_status_t usb_vendor_request_set_transceiver_mode(
 			set_transceiver_mode(endpoint->setup.value);
 			usb_transfer_schedule_ack(endpoint->in);
 			return USB_REQUEST_STATUS_OK;
+		case TRANSCEIVER_MODE_CPLD_UPDATE:
+			usb_endpoint_init(&usb_endpoint_bulk_out);
+			start_cpld_update = true;
+			usb_transfer_schedule_ack(endpoint->in);
+			return USB_REQUEST_STATUS_OK;
 		default:
 			return USB_REQUEST_STATUS_STALL;
 		}
diff --git a/firmware/hackrf_usb/usb_api_cpld.c b/firmware/hackrf_usb/usb_api_cpld.c
index e29007c..e8c8123 100644
--- a/firmware/hackrf_usb/usb_api_cpld.c
+++ b/firmware/hackrf_usb/usb_api_cpld.c
@@ -65,10 +65,14 @@ void cpld_update(void)
 	int i;
 	int error;
 
+	gpio_set(PORT_LED1_3, PIN_LED2);
+	gpio_clear(PORT_LED1_3, PIN_LED1 | PIN_LED3);
+
 	usb_queue_flush_endpoint(&usb_endpoint_bulk_in);
 	usb_queue_flush_endpoint(&usb_endpoint_bulk_out);
 
 	refill_cpld_buffer();
+	gpio_set(PORT_LED1_3, PIN_LED3);
 
 	error = cpld_jtag_program(sizeof(cpld_xsvf_buffer),
 				  cpld_xsvf_buffer,
diff --git a/host/hackrf-tools/src/hackrf_transfer.c b/host/hackrf-tools/src/hackrf_transfer.c
index 6c7b044..e522ebd 100644
--- a/host/hackrf-tools/src/hackrf_transfer.c
+++ b/host/hackrf-tools/src/hackrf_transfer.c
@@ -172,8 +172,7 @@ typedef enum {
 	TRANSCEIVER_MODE_OFF = 0,
 	TRANSCEIVER_MODE_RX = 1,
 	TRANSCEIVER_MODE_TX = 2,
-	TRANSCEIVER_MODE_SS = 3
-
+	TRANSCEIVER_MODE_SS = 3,
 } transceiver_mode_t;
 static transceiver_mode_t transceiver_mode = TRANSCEIVER_MODE_RX;
 
diff --git a/host/libhackrf/src/hackrf.c b/host/libhackrf/src/hackrf.c
index c4a2109..5bf6844 100644
--- a/host/libhackrf/src/hackrf.c
+++ b/host/libhackrf/src/hackrf.c
@@ -642,24 +642,16 @@ int ADDCALL hackrf_spiflash_read(hackrf_device* device, const uint32_t address,
 int ADDCALL hackrf_cpld_write(hackrf_device* device,
 		unsigned char* const data, const unsigned int total_length)
 {
-	int result = libusb_release_interface(device->usb_device, 0);
-	if (result != LIBUSB_SUCCESS) {
-		return HACKRF_ERROR_LIBUSB;
-	}
-
-	result = libusb_set_configuration(device->usb_device, 2);
-	if (result != LIBUSB_SUCCESS) {
-		return HACKRF_ERROR_LIBUSB;
-	}
-
-	result = libusb_claim_interface(device->usb_device, 0);
-	if (result != LIBUSB_SUCCESS) {
-		return HACKRF_ERROR_LIBUSB;
-	}
-
 	const unsigned int chunk_size = 512;
 	unsigned int i;
 	int transferred = 0;
+	int result;
+
+	result = hackrf_set_transceiver_mode(device, 4);
+	if (result != 0)
+		return result;
+	
+	Sleep(1000);
 	for (i = 0; i < total_length; i += chunk_size)
 	{
 		result = libusb_bulk_transfer(


More information about the HackRF-dev mailing list