hackrf
                                
                                 hackrf copied to clipboard
                                
                                    hackrf copied to clipboard
                            
                            
                            
                        Is it possible to change size between header blocks in sweep mode?
What would you like to know?
As I understood, right now sweep mode returns data in blocks of 16 384 bytes including header. Function hackrf_init_sweep has parameter num_bytes but it only defines count of blocks with headers. If I tell num_bytes to be 32 768, I'll get two blocks with headers with the same frequency in it. As I see in source code, the code to change tuning frequency calles regardless to num_bytes value. Size of blocks hardcoded in firmware. This behavior leads to a problem with timing data from this two blocks.
I searched firmware and libhackrf projects for all hardcoded values that related to the size between headers and doubled it. List of changes I did in firmware:
- In sgpio_m0.s file:
// Buffer that we're funneling data to/from.
.equ TARGET_DATA_BUFFER,                   0x20008000		// not changed
.equ TARGET_BUFFER_SIZE,                   0x10000		// default: 0x8000
.equ TARGET_BUFFER_MASK,                   0xffff		// default: 0x7fff
- In usb_bulk_buffer.h file:
#define USB_BULK_BUFFER_SIZE 0x10000 // default: 0x8000
#define USB_BULK_BUFFER_MASK 0xFFFF // default: 0x7FFF
- In usb_api_sweep.c file: Searched all 0x4000 and 0x8000 values, and defined them as 0x8000 or double.
#define SWEEP_BLOCK_SIZE  0x8000	// default: 0x4000
List of changes i did in libhackrf:
- In hackrf.c file:
#define TRANSFER_COUNT        4 	// not changed
#define TRANSFER_BUFFER_SIZE  262144	// not changed
#define DEVICE_BUFFER_SIZE    65536 	// default: 32768
#define USB_MAX_SERIAL_LENGTH 32	// not changed
- In hackrf.h file:
/**
 * Number of samples per tuning when sweeping
 * @ingroup streaming
 */
#define SAMPLES_PER_BLOCK 16384 // default: 8192
/**
 * Number of bytes per tuning for sweeping
 * @ingroup streaming
 */
#define BYTES_PER_BLOCK 32768 // default: 16384
But after this change M0 stucks in RX.
do I understand something wrong, or did I missed code with hardcoded value of 16 384, or maybe there is some hardware limitations in HackRF?