Skip to content

Commit 882a485

Browse files
bglodrtucker
authored andcommitted
fx3_firmware: v2.3.0 - Add flash ID command
Allows the SPI flash manufacturer ID and device ID to be reported to the host. Useful for determining the architecture (density, page size, etc.) of the flash chip used on the board.
1 parent 32f84d3 commit 882a485

File tree

5 files changed

+15
-1
lines changed

5 files changed

+15
-1
lines changed

firmware_common/bladeRF.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#define BLADE_USB_CMD_RF_RX 4
3030
#define BLADE_USB_CMD_RF_TX 5
3131
#define BLADE_USB_CMD_QUERY_DEVICE_READY 6
32+
#define BLADE_USB_CMD_QUERY_FLASH_ID 7
3233
#define BLADE_USB_CMD_FLASH_READ 100
3334
#define BLADE_USB_CMD_FLASH_WRITE 101
3435
#define BLADE_USB_CMD_FLASH_ERASE 102

fx3_firmware/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/../host/cmake/modules)
3434

3535
# Update these definitions when updating the firmware version
3636
set(VERSION_INFO_MAJOR 2)
37-
set(VERSION_INFO_MINOR 2)
37+
set(VERSION_INFO_MINOR 3)
3838
set(VERSION_INFO_PATCH 0)
3939

4040
if(NOT DEFINED VERSION_INFO_EXTRA)

fx3_firmware/src/bladeRF.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,11 @@ CyBool_t NuandHandleVendorRequest(
454454
CyU3PUsbSendRetCode(ret);
455455
break;
456456

457+
case BLADE_USB_CMD_QUERY_FLASH_ID:
458+
ret = (NuandGetSPIManufacturer() << 8) | NuandGetSPIDeviceID();
459+
CyU3PUsbSendRetCode(ret);
460+
break;
461+
457462
case BLADE_USB_CMD_SET_LOOPBACK:
458463
NuandRFLinkLoopBack(wValue);
459464
CyU3PUsbSendRetCode(wValue);

fx3_firmware/src/flash.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,13 @@ uint8_t NuandGetSPIManufacturer() {
164164
return spi_mfn[0];
165165
}
166166

167+
uint8_t NuandGetSPIDeviceID() {
168+
if (!cached_spi_mfn) {
169+
cacheSPIManufacturer();
170+
}
171+
return spi_mfn[1];
172+
}
173+
167174
CyU3PReturnStatus_t NuandReadOtp(size_t offset, size_t size, void *buf) {
168175
CyU3PReturnStatus_t status;
169176

fx3_firmware/src/flash.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ CyU3PReturnStatus_t NuandReadOtp(size_t offset, size_t size, void *buf);
2929
CyU3PReturnStatus_t NuandWriteOtp(size_t offset, size_t size, void *buf);
3030
CyU3PReturnStatus_t NuandLockOtp();
3131
uint8_t NuandGetSPIManufacturer();
32+
uint8_t NuandGetSPIDeviceID();
3233
void cacheSPIManufacturer();
3334

3435

0 commit comments

Comments
 (0)